Class MLDSACompositePublicBCPGKey
java.lang.Object
org.bouncycastle.bcpg.BCPGObject
org.bouncycastle.bcpg.OctetArrayBCPGKey
org.bouncycastle.bcpg.MLDSACompositePublicBCPGKey
- All Implemented Interfaces:
BCPGKey, org.bouncycastle.util.Encodable
Public key of the ML-DSA + EdDSA composite signature algorithms
PublicKeyAlgorithmTags.MLDSA65_Ed25519
and PublicKeyAlgorithmTags.MLDSA87_Ed448 (RFC 9980 sec. 5.3.2.1): the fixed-length EdDSA public key
in the RFC 8032 encoding of its curve, followed by the fixed-length ML-DSA public key in the FIPS 204 encoding.
The component lengths are fixed by the algorithm ID (RFC 9980 Tables 6 and 7), so the key knows which
algorithm it belongs to and the two components can be read back with getEdDSAPublicKey() and
getMLDSAPublicKey().
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMLDSACompositePublicBCPGKey(int algorithm, byte[] eddsaPublicKey, byte[] mldsaPublicKey) Construct the public key of the given composite algorithm from its two components.MLDSACompositePublicBCPGKey(int algorithm, BCPGInputStream in) Parse the public key of the given composite algorithm from the packet stream. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the public key algorithm ID this key belongs to.byte[]Return the EdDSA (Ed25519 or Ed448) public key component.static intgetEdDSAPublicKeyLength(int algorithm) Return the length of the EdDSA public key component (RFC 9980 Table 6).static intgetEdDSASignatureLength(int algorithm) Return the length of the EdDSA signature component of a composite signature (RFC 9980 Table 6).static intgetLength(int algorithm) Return the length of the algorithm-specific public key material for the given composite algorithm.byte[]Return the ML-DSA public key component.static intgetMLDSAPublicKeyLength(int algorithm) Return the length of the ML-DSA public key component (RFC 9980 Table 7).static intgetMLDSASignatureLength(int algorithm) Return the length of the ML-DSA signature component of a composite signature (RFC 9980 Table 7).static intgetSignatureLength(int algorithm) Return the total length of a composite signature: the EdDSA signature followed by the ML-DSA signature (RFC 9980 sec.Methods inherited from class OctetArrayBCPGKey
encode, getEncoded, getFormat, getKey
-
Constructor Details
-
MLDSACompositePublicBCPGKey
Parse the public key of the given composite algorithm from the packet stream.- Parameters:
algorithm- public key algorithm ID,PublicKeyAlgorithmTags.MLDSA65_Ed25519orPublicKeyAlgorithmTags.MLDSA87_Ed448in- packet input stream positioned at the algorithm-specific key material- Throws:
IOException- if the key cannot be read
-
MLDSACompositePublicBCPGKey
public MLDSACompositePublicBCPGKey(int algorithm, byte[] eddsaPublicKey, byte[] mldsaPublicKey) Construct the public key of the given composite algorithm from its two components.- Parameters:
algorithm- public key algorithm ID,PublicKeyAlgorithmTags.MLDSA65_Ed25519orPublicKeyAlgorithmTags.MLDSA87_Ed448eddsaPublicKey- the Ed25519 (32 octets) or Ed448 (57 octets) public keymldsaPublicKey- the ML-DSA-65 (1952 octets) or ML-DSA-87 (2592 octets) public key
-
-
Method Details
-
getAlgorithm
public int getAlgorithm()Return the public key algorithm ID this key belongs to. -
getEdDSAPublicKey
public byte[] getEdDSAPublicKey()Return the EdDSA (Ed25519 or Ed448) public key component.- Returns:
- EdDSA public key in RFC 8032 encoding
-
getMLDSAPublicKey
public byte[] getMLDSAPublicKey()Return the ML-DSA public key component.- Returns:
- ML-DSA public key in FIPS 204 encoding
-
getLength
public static int getLength(int algorithm) Return the length of the algorithm-specific public key material for the given composite algorithm.- Parameters:
algorithm- public key algorithm ID- Returns:
- total octet length of the EdDSA and ML-DSA public keys
-
getEdDSAPublicKeyLength
public static int getEdDSAPublicKeyLength(int algorithm) Return the length of the EdDSA public key component (RFC 9980 Table 6).- Parameters:
algorithm- public key algorithm ID- Returns:
- 32 for Ed25519, 57 for Ed448
-
getMLDSAPublicKeyLength
public static int getMLDSAPublicKeyLength(int algorithm) Return the length of the ML-DSA public key component (RFC 9980 Table 7).- Parameters:
algorithm- public key algorithm ID- Returns:
- 1952 for ML-DSA-65, 2592 for ML-DSA-87
-
getEdDSASignatureLength
public static int getEdDSASignatureLength(int algorithm) Return the length of the EdDSA signature component of a composite signature (RFC 9980 Table 6).- Parameters:
algorithm- public key algorithm ID- Returns:
- 64 for Ed25519, 114 for Ed448
-
getMLDSASignatureLength
public static int getMLDSASignatureLength(int algorithm) Return the length of the ML-DSA signature component of a composite signature (RFC 9980 Table 7).- Parameters:
algorithm- public key algorithm ID- Returns:
- 3309 for ML-DSA-65, 4627 for ML-DSA-87
-
getSignatureLength
public static int getSignatureLength(int algorithm) Return the total length of a composite signature: the EdDSA signature followed by the ML-DSA signature (RFC 9980 sec. 5.3.1).- Parameters:
algorithm- public key algorithm ID- Returns:
- 3373 for ML-DSA-65 + Ed25519, 4741 for ML-DSA-87 + Ed448
-