Struct classic_mceliece_rust::SecretKey
source · [−]pub struct SecretKey<'a>(_);
Expand description
A Classic McEliece secret key.
Should be kept on the device where it’s generated. Used to decapsulate the SharedSecret
from the Ciphertext
received from the encapsulator.
Implementations
sourceimpl<'a> SecretKey<'a>
impl<'a> SecretKey<'a>
sourcepub fn to_owned(&self) -> SecretKey<'static>
Available on crate feature alloc
only.
pub fn to_owned(&self) -> SecretKey<'static>
alloc
only.Copies the key to the heap and makes it 'static
.
sourcepub fn as_array(&self) -> &[u8; 6492]
pub fn as_array(&self) -> &[u8; 6492]
Returns the secret key as an array of bytes.
Please note that depending on your threat model, moving the data out of the
SecretKey
can be bad for security. The SecretKey
type is designed to keep the
backing data in a single location in memory and zeroing it out when it goes out
of scope.
Trait Implementations
sourceimpl<'sk> Decapsulator<Ciphertext> for SecretKey<'sk>
Available on crate feature kem
only.
impl<'sk> Decapsulator<Ciphertext> for SecretKey<'sk>
Available on crate feature
kem
only.sourcefn try_decap(
&self,
ciphertext: &Ciphertext
) -> Result<SharedSecret<Ciphertext>, Error>
fn try_decap(
&self,
ciphertext: &Ciphertext
) -> Result<SharedSecret<Ciphertext>, Error>
Attempt to decapsulate the given encapsulated key. Returns the shared secret on success, or an error if something went wrong. Read more
sourceimpl From<Box<[u8; 6492], Global>> for SecretKey<'static>
Available on crate feature alloc
only.
impl From<Box<[u8; 6492], Global>> for SecretKey<'static>
Available on crate feature
alloc
only.impl<'a> ZeroizeOnDrop for SecretKey<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for SecretKey<'a>
impl<'a> Send for SecretKey<'a>
impl<'a> Sync for SecretKey<'a>
impl<'a> Unpin for SecretKey<'a>
impl<'a> !UnwindSafe for SecretKey<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more