Class SLHDSASecretBCPGKey

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

public class SLHDSASecretBCPGKey extends OctetArrayBCPGKey
Secret key of the SLH-DSA signature algorithms PublicKeyAlgorithmTags.SLHDSA_SHAKE_128s, PublicKeyAlgorithmTags.SLHDSA_SHAKE_128f and PublicKeyAlgorithmTags.SLHDSA_SHAKE_256s (RFC 9980 sec. 6.2.2.2): the fixed-length SLH-DSA secret key in the FIPS 205 encoding (SK.seed || SK.prf || PK.seed || PK.root).
See Also:
  • Constructor Details

    • SLHDSASecretBCPGKey

      public SLHDSASecretBCPGKey(int algorithm, BCPGInputStream in) throws IOException
      Parse the secret key of the given SLH-DSA algorithm from the (decrypted) secret key material.
      Parameters:
      algorithm - public key algorithm ID, one of the SLH-DSA code points
      in - input stream positioned at the algorithm-specific secret key material
      Throws:
      IOException - if the key cannot be read
    • SLHDSASecretBCPGKey

      public SLHDSASecretBCPGKey(int algorithm, byte[] key)
      Construct the secret key of the given SLH-DSA algorithm.
      Parameters:
      algorithm - public key algorithm ID, one of the SLH-DSA code points
      key - the SLH-DSA secret key, 64 octets for the 128-bit parameter sets and 128 for SLH-DSA-SHAKE-256s
  • Method Details

    • getAlgorithm

      public int getAlgorithm()
      Return the public key algorithm ID this key belongs to.
      Returns:
      one of the SLH-DSA code points
    • getLength

      public static int getLength(int algorithm)
      Return the length of the SLH-DSA secret key (RFC 9980 Table 8).
      Parameters:
      algorithm - public key algorithm ID
      Returns:
      64 for SLH-DSA-SHAKE-128s and -128f, 128 for SLH-DSA-SHAKE-256s