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§
source§impl<'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§
source§impl<'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.source§fn 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.
source§impl 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.