public class MLKEMCompositeSecretBCPGKey extends OctetArrayBCPGKey
PublicKeyAlgorithmTags.MLKEM768_X25519
and PublicKeyAlgorithmTags.MLKEM1024_X448 (RFC 9980 sec. 4.3.2.2): the fixed-length ECDH secret key
in the RFC 7748 encoding of its curve, followed by the 64 octet ML-KEM secret key in seed format - the
concatenation of the values d and z of FIPS 203 ML-KEM.KeyGen, from which the decapsulation key is expanded
with ML-KEM.KeyGen_internal before use.| Modifier and Type | Field and Description |
|---|---|
static int |
MLKEM_SEED_LENGTH
Length of the ML-KEM secret key in seed format: d || z, 32 octets each.
|
| Constructor and Description |
|---|
MLKEMCompositeSecretBCPGKey(int algorithm,
BCPGInputStream in)
Parse the secret key of the given composite algorithm from the (decrypted) secret key material.
|
MLKEMCompositeSecretBCPGKey(int algorithm,
byte[] ecdhSecretKey,
byte[] mlkemSeed)
Construct the secret key of the given composite algorithm from its two components.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getAlgorithm()
Return the public key algorithm ID this key belongs to.
|
byte[] |
getECDHSecretKey()
Return the ECDH (X25519 or X448) secret key component.
|
static int |
getECDHSecretKeyLength(int algorithm)
Return the length of the ECDH secret key component (RFC 9980 Table 3).
|
static int |
getLength(int algorithm)
Return the length of the algorithm-specific secret key material for the given composite algorithm.
|
byte[] |
getMLKEMSeed()
Return the ML-KEM seed d || z.
|
encode, getEncoded, getFormat, getKeypublic static final int MLKEM_SEED_LENGTH
public MLKEMCompositeSecretBCPGKey(int algorithm,
BCPGInputStream in)
throws java.io.IOException
algorithm - public key algorithm ID, PublicKeyAlgorithmTags.MLKEM768_X25519 or
PublicKeyAlgorithmTags.MLKEM1024_X448in - input stream positioned at the algorithm-specific secret key materialjava.io.IOException - if the key cannot be readpublic MLKEMCompositeSecretBCPGKey(int algorithm,
byte[] ecdhSecretKey,
byte[] mlkemSeed)
algorithm - public key algorithm ID, PublicKeyAlgorithmTags.MLKEM768_X25519 or
PublicKeyAlgorithmTags.MLKEM1024_X448ecdhSecretKey - the X25519 (32 octets) or X448 (56 octets) secret keymlkemSeed - the 64 octet ML-KEM seed d || zpublic int getAlgorithm()
public byte[] getECDHSecretKey()
public byte[] getMLKEMSeed()
public static int getLength(int algorithm)
algorithm - public key algorithm IDpublic static int getECDHSecretKeyLength(int algorithm)
algorithm - public key algorithm ID