Trait zeroize::Zeroize

source ·
pub trait Zeroize {
    fn zeroize(&mut self);
}
Expand description

Trait for securely erasing values from memory.

Required Methods§

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Implementations on Foreign Types§

Impl Zeroize on arrays of types that impl Zeroize.

Impl Zeroize on slices of MaybeUninit types.

This impl can eventually be optimized using an memset intrinsic, such as core::intrinsics::volatile_set_memory.

This fills the slice with zeroes.

Note that this ignore invariants that Z might have, because MaybeUninit removes all invariants.

Impl Zeroize on slices of types that can be zeroized with Default.

This impl can eventually be optimized using an memset intrinsic, such as core::intrinsics::volatile_set_memory. For that reason the blanket impl on slices is bounded by DefaultIsZeroes.

To zeroize a mut slice of Z: Zeroize which does not impl DefaultIsZeroes, call iter_mut().zeroize().

PhantomData is always zero sized so provide a Zeroize implementation.

PhantomPinned is zero sized so provide a Zeroize implementation.

() is zero sized so provide a Zeroize implementation.

Generic implementation of Zeroize for tuples up to 10 parameters.

“Best effort” zeroization for Vec.

Ensures the entire capacity of the Vec is zeroed. Cannot ensure that previous reallocations did not leave values on the heap.

Unlike Vec, Box<[Z]> cannot reallocate, so we can be sure that we are not leaving values on the heap.

Implementors§

impl Zeroize for Scalar

impl<const LENGTH: usize> Zeroize for HeapByteArray<LENGTH>

impl Zeroize for State

impl<EphemeralPublicKey, Mac, Data> Zeroize for DryocBox<EphemeralPublicKey, Mac, Data>where
    Option<EphemeralPublicKey>: Zeroize,
    EphemeralPublicKey: Zeroize + ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>,
    Mac: Zeroize + ByteArray<CRYPTO_BOX_MACBYTES>,
    Data: Zeroize + Bytes,

impl<Mac, Data> Zeroize for DryocSecretBox<Mac, Data>where
    Mac: Zeroize + ByteArray<CRYPTO_SECRETBOX_MACBYTES>,
    Data: Zeroize + Bytes,

impl<Mode> Zeroize for DryocStream<Mode>where
    PhantomData<Mode>: Zeroize,
    Mode: Zeroize,

impl<Key, Context> Zeroize for Kdf<Key, Context>where
    Key: Zeroize + ByteArray<CRYPTO_KDF_KEYBYTES>,
    Context: Zeroize + ByteArray<CRYPTO_KDF_CONTEXTBYTES>,

impl<PublicKey, SecretKey> Zeroize for KeyPair<PublicKey, SecretKey>where
    PublicKey: Zeroize + ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>,
    SecretKey: Zeroize + ByteArray<CRYPTO_BOX_SECRETKEYBYTES>,

impl<SessionKey> Zeroize for Session<SessionKey>where
    SessionKey: Zeroize + ByteArray<CRYPTO_KX_SESSIONKEYBYTES>,

impl Zeroize for Config

impl<Hash, Salt> Zeroize for PwHash<Hash, Salt>where
    Hash: Zeroize + Bytes,
    Salt: Zeroize + Bytes,

impl<PublicKey, SecretKey> Zeroize for SigningKeyPair<PublicKey, SecretKey>where
    PublicKey: Zeroize + ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>,
    SecretKey: Zeroize + ByteArray<CRYPTO_SIGN_SECRETKEYBYTES>,

impl<Signature, Message> Zeroize for SignedMessage<Signature, Message>where
    Signature: Zeroize + ByteArray<CRYPTO_SIGN_BYTES>,
    Message: Zeroize + Bytes,

impl<const LENGTH: usize> Zeroize for StackByteArray<LENGTH>