Skip to main content

Module rfc9909

Module rfc9909 

Source
Expand description

RFC 9909 standard ASN.1 DER and PEM codecs for FIPS 205 SLH-DSA-SHAKE SubjectPublicKeyInfo (SPKI) and PKCS#8 (OneAsymmetricKey / PrivateKeyInfo).

§Official NIST CSOR OIDs (RFC 9909)

  • SLH-DSA-SHAKE-128s: 2.16.840.1.101.3.4.3.26 (... 04 03 1A)
  • SLH-DSA-SHAKE-128f: 2.16.840.1.101.3.4.3.27 (... 04 03 1B)
  • SLH-DSA-SHAKE-192s: 2.16.840.1.101.3.4.3.28 (... 04 03 1C)
  • SLH-DSA-SHAKE-192f: 2.16.840.1.101.3.4.3.29 (... 04 03 1D)
  • SLH-DSA-SHAKE-256s: 2.16.840.1.101.3.4.3.30 (... 04 03 1E)
  • SLH-DSA-SHAKE-256f: 2.16.840.1.101.3.4.3.31 (... 04 03 1F)

Per RFC 9909:

  • AlgorithmIdentifier.parameters MUST be absent (no NULL).
  • SPKI carries the raw 2n-byte public key (PK.seed || PK.root) inside BIT STRING.
  • PKCS#8 carries the raw 4n-byte private key (SK.seed || SK.prf || PK.seed || PK.root) inside privateKey OCTET STRING.
  • PKCS#8 decoding strictly enforces RFC 5958 OneAsymmetricKey: version 0 MUST omit [1] publicKey, and version 1 MUST include [1] publicKey, which must equal the PK.seed || PK.root embedded in the private key. Well-formed [0] attributes are accepted and ignored. Encoders emit version 0 without a public key.
  • Secret intermediates are held in zeroize-on-drop buffers, and private-key PEM uses constant-time base64.

Functions§

decode_pkcs8_der
Decodes an RFC 9909 PKCS#8 DER private key while enforcing policy.
decode_pkcs8_pem
Decodes an RFC 9909 PEM private key (-----BEGIN PRIVATE KEY-----).
decode_spki_der
Decodes an RFC 9909 SPKI DER verifying key while enforcing policy.
decode_spki_pem
Decodes an RFC 9909 PEM verifying key (-----BEGIN PUBLIC KEY-----).
encode_pkcs8_der
Encodes an SLH-DSA 4n-byte private key into RFC 9909 PKCS#8 DER.
encode_pkcs8_pem
Encodes an SLH-DSA private key into RFC 9909 PEM (-----BEGIN PRIVATE KEY-----).
encode_spki_der
Encodes an SLH-DSA verifying key into RFC 9909 SPKI DER.
encode_spki_pem
Encodes an SLH-DSA verifying key into RFC 9909 PEM (-----BEGIN PUBLIC KEY-----).