public class MLKEMCompositePublicBCPGKey extends OctetArrayBCPGKey
PublicKeyAlgorithmTags.MLKEM768_X25519
and PublicKeyAlgorithmTags.MLKEM1024_X448 (RFC 9980 sec. 4.3.2.1): the fixed-length ECDH public key
in the RFC 7748 encoding of its curve, followed by the fixed-length ML-KEM encapsulation key in the FIPS 203
encoding.
The component lengths are fixed by the algorithm ID (RFC 9980 Tables 3 and 4), so the key knows which
algorithm it belongs to and the two components can be read back with getECDHPublicKey() and
getMLKEMPublicKey().
| Constructor and Description |
|---|
MLKEMCompositePublicBCPGKey(int algorithm,
BCPGInputStream in)
Parse the public key of the given composite algorithm from the packet stream.
|
MLKEMCompositePublicBCPGKey(int algorithm,
byte[] ecdhPublicKey,
byte[] mlkemPublicKey)
Construct the public 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[] |
getECDHPublicKey()
Return the ECDH (X25519 or X448) public key component.
|
static int |
getECDHPublicKeyLength(int algorithm)
Return the length of the ECDH public key component (RFC 9980 Table 3).
|
static int |
getLength(int algorithm)
Return the length of the algorithm-specific public key material for the given composite algorithm.
|
static int |
getMLKEMCiphertextLength(int algorithm)
Return the length of the ML-KEM ciphertext carried in a PKESK packet (RFC 9980 Table 4).
|
byte[] |
getMLKEMPublicKey()
Return the ML-KEM encapsulation key component.
|
static int |
getMLKEMPublicKeyLength(int algorithm)
Return the length of the ML-KEM encapsulation key component (RFC 9980 Table 4).
|
encode, getEncoded, getFormat, getKeypublic MLKEMCompositePublicBCPGKey(int algorithm,
BCPGInputStream in)
throws java.io.IOException
algorithm - public key algorithm ID, PublicKeyAlgorithmTags.MLKEM768_X25519 or
PublicKeyAlgorithmTags.MLKEM1024_X448in - packet input stream positioned at the algorithm-specific key materialjava.io.IOException - if the key cannot be readpublic MLKEMCompositePublicBCPGKey(int algorithm,
byte[] ecdhPublicKey,
byte[] mlkemPublicKey)
algorithm - public key algorithm ID, PublicKeyAlgorithmTags.MLKEM768_X25519 or
PublicKeyAlgorithmTags.MLKEM1024_X448ecdhPublicKey - the X25519 (32 octets) or X448 (56 octets) public keymlkemPublicKey - the ML-KEM-768 (1184 octets) or ML-KEM-1024 (1568 octets) encapsulation keypublic int getAlgorithm()
public byte[] getECDHPublicKey()
public byte[] getMLKEMPublicKey()
public static int getLength(int algorithm)
algorithm - public key algorithm IDpublic static int getECDHPublicKeyLength(int algorithm)
algorithm - public key algorithm IDpublic static int getMLKEMPublicKeyLength(int algorithm)
algorithm - public key algorithm IDpublic static int getMLKEMCiphertextLength(int algorithm)
algorithm - public key algorithm ID