Class SLHDSAPublicBCPGKey

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

public class SLHDSAPublicBCPGKey extends OctetArrayBCPGKey
Public 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.1): the fixed-length SLH-DSA public key in the FIPS 205 encoding (PK.seed || PK.root).
See Also:
  • Constructor Details

    • SLHDSAPublicBCPGKey

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

      public SLHDSAPublicBCPGKey(int algorithm, byte[] key)
      Construct the public key of the given SLH-DSA algorithm.
      Parameters:
      algorithm - public key algorithm ID, one of the SLH-DSA code points
      key - the SLH-DSA public key, 32 octets for the 128-bit parameter sets and 64 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 public key (RFC 9980 Table 8).
      Parameters:
      algorithm - public key algorithm ID
      Returns:
      32 for SLH-DSA-SHAKE-128s and -128f, 64 for SLH-DSA-SHAKE-256s
    • getSignatureLength

      public static int getSignatureLength(int algorithm)
      Return the length of an SLH-DSA signature (RFC 9980 Table 8).
      Parameters:
      algorithm - public key algorithm ID
      Returns:
      7856 for SLH-DSA-SHAKE-128s, 17088 for SLH-DSA-SHAKE-128f, 29792 for SLH-DSA-SHAKE-256s