Class MLDSACompositeSecretBCPGKey
java.lang.Object
org.bouncycastle.bcpg.BCPGObject
org.bouncycastle.bcpg.OctetArrayBCPGKey
org.bouncycastle.bcpg.MLDSACompositeSecretBCPGKey
- All Implemented Interfaces:
BCPGKey, org.bouncycastle.util.Encodable
Secret key of the ML-DSA + EdDSA composite signature algorithms
PublicKeyAlgorithmTags.MLDSA65_Ed25519
and PublicKeyAlgorithmTags.MLDSA87_Ed448 (RFC 9980 sec. 5.3.2.2): the fixed-length EdDSA secret key
in the RFC 8032 encoding of its curve, followed by the 32 octet ML-DSA secret key in seed format - the value
xi of FIPS 204 ML-DSA.KeyGen, from which the signing key is expanded with ML-DSA.KeyGen_internal before use.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLength of the ML-DSA secret key in seed format (xi). -
Constructor Summary
ConstructorsConstructorDescriptionMLDSACompositeSecretBCPGKey(int algorithm, byte[] eddsaSecretKey, byte[] mldsaSeed) Construct the secret key of the given composite algorithm from its two components.MLDSACompositeSecretBCPGKey(int algorithm, BCPGInputStream in) Parse the secret key of the given composite algorithm from the (decrypted) secret key material. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the public key algorithm ID this key belongs to.byte[]Return the EdDSA (Ed25519 or Ed448) secret key component.static intgetEdDSASecretKeyLength(int algorithm) Return the length of the EdDSA secret key component (RFC 9980 Table 6).static intgetLength(int algorithm) Return the length of the algorithm-specific secret key material for the given composite algorithm.byte[]Return the ML-DSA seed xi.Methods inherited from class OctetArrayBCPGKey
encode, getEncoded, getFormat, getKey
-
Field Details
-
MLDSA_SEED_LENGTH
public static final int MLDSA_SEED_LENGTHLength of the ML-DSA secret key in seed format (xi).- See Also:
-
-
Constructor Details
-
MLDSACompositeSecretBCPGKey
Parse the secret key of the given composite algorithm from the (decrypted) secret key material.- Parameters:
algorithm- public key algorithm ID,PublicKeyAlgorithmTags.MLDSA65_Ed25519orPublicKeyAlgorithmTags.MLDSA87_Ed448in- input stream positioned at the algorithm-specific secret key material- Throws:
IOException- if the key cannot be read
-
MLDSACompositeSecretBCPGKey
public MLDSACompositeSecretBCPGKey(int algorithm, byte[] eddsaSecretKey, byte[] mldsaSeed) Construct the secret key of the given composite algorithm from its two components.- Parameters:
algorithm- public key algorithm ID,PublicKeyAlgorithmTags.MLDSA65_Ed25519orPublicKeyAlgorithmTags.MLDSA87_Ed448eddsaSecretKey- the Ed25519 (32 octets) or Ed448 (57 octets) secret keymldsaSeed- the 32 octet ML-DSA seed xi
-
-
Method Details
-
getAlgorithm
public int getAlgorithm()Return the public key algorithm ID this key belongs to. -
getEdDSASecretKey
public byte[] getEdDSASecretKey()Return the EdDSA (Ed25519 or Ed448) secret key component.- Returns:
- EdDSA secret key in RFC 8032 encoding
-
getMLDSASeed
public byte[] getMLDSASeed()Return the ML-DSA seed xi.- Returns:
- 32 octet ML-DSA seed
-
getLength
public static int getLength(int algorithm) Return the length of the algorithm-specific secret key material for the given composite algorithm.- Parameters:
algorithm- public key algorithm ID- Returns:
- total octet length of the EdDSA secret key and the ML-DSA seed
-
getEdDSASecretKeyLength
public static int getEdDSASecretKeyLength(int algorithm) Return the length of the EdDSA secret key component (RFC 9980 Table 6).- Parameters:
algorithm- public key algorithm ID- Returns:
- 32 for Ed25519, 57 for Ed448
-