Skip to main content

Crate base64_ng_sanitization

Crate base64_ng_sanitization 

Source
Expand description

Optional sanitization integration helpers for base64-ng.

This crate deliberately lives outside the core base64-ng package so the base crate keeps its zero-runtime-dependency contract. Applications that already admit sanitization can opt into this companion crate and decode secret-bearing Base64 directly into sanitization secret containers.

The extension trait targets base64_ng::ct::CtEngine rather than the ordinary strict decoder. sanitization 2.1.0’s native ct primitives are re-exported for callers that want Choice-based verification after decode. Enable memory-lock or high-assurance for locked secret containers on supported native targets.

use base64_ng::ct;
use base64_ng_sanitization::{CtDecodeSanitizationExt, SanitizationCtEqExt};

let secret = ct::STANDARD
    .decode_secret_bytes::<5>(b"aGVsbG8=")
    .unwrap();
assert!(secret.sanitization_verify(b"hello", "example declassifies equality"));

Modules§

ct
Data-oblivious primitives for secret-handling code.

Enums§

LockedDecodeError
Error returned by fail-closed locked-secret decode helpers.
ProtectedAllocation
Which protected allocation failed during a two-allocation decode.
SanitizationDecodeError
Error returned by fixed-size sanitization decode helpers.
SanitizationProtectedDecodeError
Redacted failure from a 2.0 protected sanitization decode.
SecretVecDecodeError
Error returned by bounded heap-backed secret decode helpers.

Constants§

DEFAULT_SECRET_VEC_DECODE_MAX_LEN
Default decoded-byte ceiling for dynamic secret convenience methods.
MAX_SANITIZATION_STACK_SECRET_BYTES
Maximum secret capacity allocated on the stack by this companion crate.

Traits§

CtDecodeSanitizationBoundedExt
Explicitly bounded, fallibly allocated dynamic secret decode helpers.
CtDecodeSanitizationExt
Extension helpers for decoding with base64_ng::ct::CtEngine into sanitization secret containers.
CtDecodeSanitizationProtectedExt
Detailed fail-closed decode helpers for protected locked storage.
LockedSanitizationCtEqExt
Integrity-checked comparison helpers for locked secret containers.
SanitizationCtEqExt
Native sanitization::ct comparison helpers for decoded secret containers.
SanitizationProtectedDecodeExt
2.0 decode helpers with separately protected staging and destination.

Functions§

sanitization_ct_eq_public_len
Compare two byte slices through sanitization::ct with public length.