Class MLDSACompositeSecretBCPGKey

All Implemented Interfaces:
BCPGKey, org.bouncycastle.util.Encodable

public class MLDSACompositeSecretBCPGKey extends OctetArrayBCPGKey
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 Details

    • MLDSA_SEED_LENGTH

      public static final int MLDSA_SEED_LENGTH
      Length of the ML-DSA secret key in seed format (xi).
      See Also:
  • Constructor Details

  • Method Details

    • getAlgorithm

      public int getAlgorithm()
      Return the public key algorithm ID this key belongs to.
      Returns:
      PublicKeyAlgorithmTags.MLDSA65_Ed25519 or PublicKeyAlgorithmTags.MLDSA87_Ed448
    • 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