CryptoSys PQC
1.0.0
|
Key-Encapsulation Mechanism (KEM) methods. More...
Classes | |
struct | EncapOutput |
Structure to receive KEM encapsulation output (ss, ct) More... | |
struct | KeyPair |
Structure to receive a key pair (ek, dk) More... | |
Public Types | |
enum class | Alg |
Key-Encapsulation Mechanism (KEM) algorithm. More... | |
Static Public Member Functions | |
static KeyPair | KeyGen (Alg alg, const std::string ¶ms="") |
Generate an encapsulation/decapsulation key pair (ek, dk). More... | |
static EncapOutput | Encaps (Alg alg, bvec_t ek, const std::string ¶ms="") |
Carry out the KEM encapsulation algorithm. More... | |
static bvec_t | Decaps (Alg alg, bvec_t ct, bvec_t dk) |
Carry out the KEM decapsulation algorithm. More... | |
static int | EncapKeySize (Alg alg) |
Return length of encapulation ("public") key ek in bytes. | |
static int | DecapKeySize (Alg alg) |
Return length of expanded decapulation ("private") key dk in bytes. | |
static int | CipherTextSize (Alg alg) |
Return length of ciphertext ct in bytes. | |
static int | SharedKeySize (Alg alg) |
Return length of shared secret key ss (K ) in bytes. | |
static std::string | AlgName (Alg alg) |
Get algorithm name from its alg code. | |
Key-Encapsulation Mechanism (KEM) methods.
|
strong |
Generate an encapsulation/decapsulation key pair (ek, dk).
alg | KEM algorithm. |
params | Optional parameters string. Use to pass a known test random value encoded in hexadecimal. [default = add fresh randomness]. |
|
static |
Carry out the KEM encapsulation algorithm.
alg | KEM algorithm. |
ek | Encapsulation key. |
params | Optional parameters string. Use to pass a known test random value encoded in hexadecimal. [default = add fresh randomness]. |
Carry out the KEM decapsulation algorithm.
alg | KEM algorithm. |
ct | Ciphertext (ct) in a byte array. |
dk | Decapsulation key. |
dk
may be passed in expanded form (1632|2400|3168 bytes) or as a 64-byte seed. The key form is detected automatically by its length.