Click or drag to resize

KemKeyGen Method

Generate an encapsulation/decapsulation key pair (ek, dk): (ek,dk)<--KeyGen()

Namespace: CryptoSysPQC
Assembly: diCrSysPQCNet (in diCrSysPQCNet.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static KemKeyPair KeyGen(
	KemAlg alg,
	string paramstr = ""
)

Parameters

alg  KemAlg
KEM algorithm.
paramstr  String  (Optional)
Optional parameters string. Use to pass a known test random seed (d||z) representing exactly 64 bytes encoded in hexadecimal. [Default = use a fresh random value]

Return Value

KemKeyPair
Keypair (ek, dk) in a KemKeyPair object, where ek is the encapsulation ("public") key and dk the decapsulation ("private") key.
Remarks
If provided, the known test seed (d||z) must consist of two concatenated 32-byte values where d is the 32-byte "randomness" for the key generation and z is the 32-byte "implicit rejection value" to be used on a Decaps failure.
Example
C#
// 1. Use known test vector seed = deterministic
Kem.KeyPair kp = Kem.KeyGen(Kem.Alg.ML_KEM_512, 
    "2CB843A02EF02EE109305F39119FABF49AB90A57FFECB3A0E75E179450F52761" 
  + "84CC9121AE56FBF39E67ADBD83AD2D3E3BB80843645206BDD9F2F629E3CC49B7");

// 2. Use fresh randomness
Kem.KeyPair kp = Kem.KeyGen(Kem.Alg.ML_KEM_512);
See Also