Skip to main content

Zeroize

Trait Zeroize 

pub trait Zeroize {
    // Required method
    fn zeroize(&mut self);
}
Available on crate features crypto and std only.
Expand description

Trait for securely erasing values from memory.

Required Methods§

fn zeroize(&mut self)

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl Zeroize for NonZero<i8>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<i16>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<i32>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<i64>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<i128>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<isize>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<u8>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<u16>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<u32>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<u64>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<u128>

§

fn zeroize(&mut self)

§

impl Zeroize for NonZero<usize>

§

fn zeroize(&mut self)

§

impl Zeroize for __m128

§

fn zeroize(&mut self)

§

impl Zeroize for __m256

§

fn zeroize(&mut self)

§

impl Zeroize for __m512

§

fn zeroize(&mut self)

§

impl Zeroize for __m128d

§

fn zeroize(&mut self)

§

impl Zeroize for __m128i

§

fn zeroize(&mut self)

§

impl Zeroize for __m256d

§

fn zeroize(&mut self)

§

impl Zeroize for __m256i

§

fn zeroize(&mut self)

§

impl Zeroize for __m512d

§

fn zeroize(&mut self)

§

impl Zeroize for __m512i

§

fn zeroize(&mut self)

§

impl Zeroize for str

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E, F, G, H, I, J> Zeroize for (A, B, C, D, E, F, G, H, I, J)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize, I: Zeroize, J: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E, F, G, H, I> Zeroize for (A, B, C, D, E, F, G, H, I)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize, I: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E, F, G, H> Zeroize for (A, B, C, D, E, F, G, H)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize, H: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E, F, G> Zeroize for (A, B, C, D, E, F, G)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize, G: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E, F> Zeroize for (A, B, C, D, E, F)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize, F: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D, E> Zeroize for (A, B, C, D, E)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize, E: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C, D> Zeroize for (A, B, C, D)
where A: Zeroize, B: Zeroize, C: Zeroize, D: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B, C> Zeroize for (A, B, C)
where A: Zeroize, B: Zeroize, C: Zeroize,

§

fn zeroize(&mut self)

§

impl<A, B> Zeroize for (A, B)
where A: Zeroize, B: Zeroize,

§

fn zeroize(&mut self)

§

impl<A> Zeroize for (A,)
where A: Zeroize,

§

fn zeroize(&mut self)

§

impl<Z, const N: usize> Zeroize for [Z; N]
where Z: Zeroize,

Impl Zeroize on arrays of types that impl Zeroize.

§

fn zeroize(&mut self)

§

impl<Z> Zeroize for PhantomData<Z>

PhantomData is always zero sized so provide a Zeroize implementation.

§

fn zeroize(&mut self)

§

impl<Z> Zeroize for Wrapping<Z>
where Z: Zeroize,

§

fn zeroize(&mut self)

§

impl<Z> Zeroize for [MaybeUninit<Z>]

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.

§

fn zeroize(&mut self)

§

impl<Z> Zeroize for [Z]
where Z: DefaultIsZeroes,

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().

§

fn zeroize(&mut self)

Implementors§

§

impl Zeroize for Box<str>

Available on crate feature alloc only.
§

impl Zeroize for PrivateKeyDer<'static>

Available on crate feature alloc only.
§

impl Zeroize for PrivatePkcs1KeyDer<'static>

Available on crate feature alloc only.
§

impl Zeroize for PrivatePkcs8KeyDer<'static>

Available on crate feature alloc only.
§

impl Zeroize for PrivateSec1KeyDer<'static>

Available on crate feature alloc only.
§

impl Zeroize for String

Available on crate feature alloc only.
§

impl<Z> Zeroize for Box<[Z]>
where Z: Zeroize,

Available on crate feature alloc only.
§

impl<Z> Zeroize for IterMut<'_, Z>
where Z: Zeroize,

§

impl<Z> Zeroize for MaybeUninit<Z>

Impl Zeroize on MaybeUninit types.

This fills the memory with zeroes. Note that this ignore invariants that Z might have, because MaybeUninit removes all invariants.

§

impl<Z> Zeroize for Option<Z>
where Z: Zeroize,

§

impl<Z> Zeroize for Vec<Z>
where Z: Zeroize,

Available on crate feature alloc only.
§

impl<Z> Zeroize for Z
where Z: DefaultIsZeroes,

§

impl<Z> Zeroize for Zeroizing<Z>
where Z: Zeroize + ?Sized,