Struct oqs::kem::Kem [−][src]
pub struct Kem { /* fields omitted */ }
Expand description
KEM algorithm
Example
use oqs;
oqs::init();
let kem = oqs::kem::Kem::new(oqs::kem::Algorithm::Kyber512).unwrap();
let (pk, sk) = kem.keypair().unwrap();
let (ct, ss) = kem.encapsulate(&pk).unwrap();
let ss2 = kem.decapsulate(&sk, &ct).unwrap();
assert_eq!(ss, ss2);
Implementations
Get the claimed nist level
Is the algorithm ind_cca secure
Get the length of the public key
Get the length of the secret key
Get the length of the ciphertext
Get the length of a shared secret
Obtain a secret key objects from bytes
Returns None if the secret key is not the correct length.
Obtain a public key from bytes
Returns None if the public key is not the correct length.
Obtain a ciphertext from bytes
Returns None if the ciphertext is not the correct length.
Obtain a secret key from bytes
Returns None if the shared secret is not the correct length.
pub fn encapsulate<'a, P: Into<PublicKeyRef<'a>>>(
&self,
pk: P
) -> Result<(Ciphertext, SharedSecret)>
pub fn encapsulate<'a, P: Into<PublicKeyRef<'a>>>(
&self,
pk: P
) -> Result<(Ciphertext, SharedSecret)>
Encapsulate to the provided public key
pub fn decapsulate<'a, 'b, S: Into<SecretKeyRef<'a>>, C: Into<CiphertextRef<'b>>>(
&self,
sk: S,
ct: C
) -> Result<SharedSecret>
pub fn decapsulate<'a, 'b, S: Into<SecretKeyRef<'a>>, C: Into<CiphertextRef<'b>>>(
&self,
sk: S,
ct: C
) -> Result<SharedSecret>
Decapsulate the provided ciphertext