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

Construct a new algorithm

Get the algorithm used by this Kem

Get the version of the implementation

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.

Generate a new keypair

Encapsulate to the provided public key

Decapsulate the provided ciphertext

Trait Implementations

Executes the destructor for this type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.