Use of the HSS/LMS HashBased Signature Algorithm in the Cryptographic Message Syntax (CMS)
Vigil Security, LLC
516 Dranesville Road
Herndon
VA
20170
United States of America
housley@vigilsec.com
LAMPS Working Group
This document specifies the conventions for using the Hierarchical
Signature System (HSS) / LeightonMicali Signature (LMS) hashbased
signature algorithm with the Cryptographic Message Syntax (CMS). In
addition, the algorithm identifier and public key syntax are
provided. The HSS/LMS algorithm is one form of hashbased digital
signature; it is described in RFC 8554. This document obsoletes RFC 8708.
Introduction
This document specifies the conventions for using the Hierarchical
Signature System (HSS) / LeightonMicali Signature (LMS) hashbased
signature algorithm with the Cryptographic Message Syntax (CMS)
signeddata content type. The LMS system provides a onetime digital
signature that is a variant of Merkle Tree Signatures (MTS). The HSS
is built on top of the LMS system to efficiently scale for a larger
numbers of signatures. The HSS/LMS algorithm is one form of
hashbased digital signature, and it is described in
. The
HSS/LMS signature algorithm can only be used for a fixed number of
signing operations with a given private key, and the number of
signing operations depends upon the size of the tree. The HSS/LMS
signature algorithm uses small public keys, and it has low
computational cost; however, the signatures are quite large. The
HSS/LMS private key can be very small when the signer is willing to
perform additional computation at signing time; alternatively, the
private key can consume additional memory and provide a faster
signing time. The HSS/LMS signatures
are currently defined
to use SHA256 and SHAKE256
.
ASN.1
CMS values are generated using ASN.1 ,
using the Basic Encoding Rules (BER) and the Distinguished Encoding Rules (DER)
.
Terminology
The key words "MUST", "MUST NOT", "REQUIRED",
"SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL"
in this document are to be interpreted as described in BCP 14
when, and only when, they appear in all capitals, as shown here.
Motivation
Recent advances in cryptanalysis and progress in the
development of quantum computers pose a threat to widely
deployed digital signature algorithms. As a result, there is a need
to prepare for a day when cryptosystems such as RSA and DSA that
depend on discrete logarithms and factoring cannot be depended upon.
If cryptographically relevant quantum computers (CRQCs) are ever built, these computers will
be able to break many of the public key cryptosystems currently in
use. A postquantum cryptosystem is a system that is secure
against quantum computers that have more than a trivial number of
quantum bits (qubits). It is open to conjecture when it will be
feasible to build such computers; however, RSA, DSA, Elliptic Curve Digital
Signature Algorithm (ECDSA), and Edwardscurve Digital Signature Algorithm (EdDSA)
are all vulnerable if CRQCs are ever developed.
Since the HSS/LMS signature algorithm does not depend on the
difficulty of discrete logarithms or factoring, but on a
secondpreimageresistant cryptographic hash function, the HSS/LMS
signature algorithm is considered to be postquantum secure. One use
of postquantumsecure signatures is the protection of software updates,
perhaps using the format described in ,
to enable deployment of software that implements new cryptosystems.
Changes Since RFC 8708
At the time RFC 8708 was published, there were no plans to put an HSS/LMS public key
in a certificate. The expectation was that the HSS/LMS public key would be
distributed by some other means. Today, there are plans to put an HSS/LMS public key
in a certificate. The KEY field of the pkHSSLMSHashSig definition in the ASN.1
module does not come into play when using HSS/LMS signatures in the CMS; however, it
needs to be consistent with the yettobepublished document that will describe the
conventions for carrying an HSS/LMS public key in a certificate. The
pkHSSLMSHashSig definition is updated to reflect no ASN.1 wrapping
for the public key.
Additional HSS/LMS tree sizes have been defined. The list in
was expanded to include the recently defined ones.
Additional LMOTS Signatures have been defined. The list in
was expanded to include the recently defined ones.
Provide more detail in regarding allowed values in
the X.509 certificate key usage extension for an HSS/LMS public key.
HSS/LMS HashBased Signature Algorithm Overview
Merkle Tree Signatures (MTS) are a method for signing a large but
fixed number of messages. An MTS system depends on a onetime
signature method and a collisionresistant hash function.
This specification makes use of the hashbased algorithm specified in
, which is the
Leighton and Micali adaptation of the
original LamportDiffieWinternitzMerkle onetime signature system
.
As implied by the name, the hashbased signature algorithm depends on
a collisionresistant hash function. The hashbased signature
algorithm specified in uses
only the SHA256 oneway hash function ,
but it establishes an IANA registry to
permit the registration of additional oneway hash functions in the future.
Hierarchical Signature System (HSS)
The MTS system specified in
uses a hierarchy of trees. The
Ntime Hierarchical Signature System (HSS) allows subordinate trees
to be generated when needed by the signer. Otherwise, generation of
the entire tree might take weeks or longer.
An HSS signature as specified in carries the number of
signed public keys (Nspk), followed by that number of signed public
keys, followed by the LMS signature as described in . The
public key for the topmost LMS tree is the public key of the HSS
system. The LMS private key in the parent tree signs the LMS public
key in the child tree, and the LMS private key in the bottommost
tree signs the actual message. The signature over the public key and
the signature over the actual message are LMS signatures as described
in .
The elements of the HSS signature value for a standalone tree (a top
tree with no children) can be summarized as:
u32str(0) 
lms_signature /* signature of message */
where, u32str() and  are used as defined in .
The elements of the HSS signature value for a tree with Nspk signed
public keys can be summarized as:
u32str(Nspk) 
signed_public_key[0] 
signed_public_key[1] 
...
signed_public_key[Nspk2] 
signed_public_key[Nspk1] 
lms_signature /* signature of message */
where, as defined in , the signed_public_key
structure contains the lms_signature over the public key, followed by
the public key itself. Note that Nspk is the number of levels in the
hierarchy of trees minus 1.
LeightonMicali Signature (LMS)
Each tree in the system specified in uses the LeightonMicali Signature (LMS) system. LMS systems have two parameters. The
first parameter is the height of the tree, h, which is the number of
levels in the tree minus one. The specification supports
five values for this parameter: h=5, h=10, h=15, h=20, and h=25.
There are 2^h leaves in the tree. The second parameter, m,
is the number of bytes output by the hash function, and it is the
amount of data associated with each node in the tree. The
specification supports the SHA256 hash function , with
m=32. Recently, support for SHA256 with m=24,
SHAKE256 with m=32, and SHAKE256 with m=24
have been specified. As a result, the HSS/LMS supports the following tree sizes:
 LMS_SHA256_M32_H5
 LMS_SHA256_M32_H10
 LMS_SHA256_M32_H15
 LMS_SHA256_M32_H20
 LMS_SHA256_M32_H25
 LMS_SHA256_M24_H5
 LMS_SHA256_M24_H10
 LMS_SHA256_M24_H15
 LMS_SHA256_M24_H20
 LMS_SHA256_M24_H25
 LMS_SHAKE_M32_H5
 LMS_SHAKE_M32_H10
 LMS_SHAKE_M32_H15
 LMS_SHAKE_M32_H20
 LMS_SHAKE_M32_H25
 LMS_SHAKE_M24_H5
 LMS_SHAKE_M24_H10
 LMS_SHAKE_M24_H15
 LMS_SHAKE_M24_H20
 LMS_SHAKE_M24_H25
All of these appear in the IANA registry .
Additional hash functions and tree sizes may be registered in the future.
As specified in , the LMS public key consists of four
elements: the lms_algorithm_type from the list above, the otstype to
identify the LeightonMicali OneTime Signature (LMOTS) type as discussed in , the private key
identifier (I) as described in , and the mbyte string
associated with the root node of the tree (T[1]).
The LMS public key can be summarized as:
u32str(lms_algorithm_type)  u32str(otstype)  I  T[1]
As specified in , an LMS signature consists of four
elements: the number of the leaf (q) associated with the LMOTS
signature value, an LMOTS signature value as described in , a
typecode indicating the particular LMS algorithm, and an array of
values that is associated with the path through the tree from the
leaf associated with the LMOTS signature value to the root. The array of
values contains the siblings of the nodes on the path from the leaf
to the root but does not contain the nodes on the path itself. The
array for a tree with height h will have h values. The first value
is the sibling of the leaf, the next value is the sibling of the
parent of the leaf, and so on up the path to the root.
The four elements of the LMS signature value can be summarized as:
u32str(q) 
ots_signature 
u32str(type) 
path[0]  path[1]  ...  path[h1]
LeightonMicali OneTime Signature (LMOTS) Algorithm
Merkle Tree Signatures (MTS) depend on a onetime signature method,
and specifies the use of the LMOTS, which has five
parameters:
 n:
 The length in bytes of the hash function output.
 H:
 A preimageresistant hash function that accepts byte strings of any length and returns an nbyte string.
 w:
 The width in bits of the Winternitz coefficients. supports four values for this parameter: w=1, w=2, w=4, and w=8.
 p:
 The number of nbyte string elements that make up the LMOTS signature value.
 ls:
 The number of bits that are leftshifted in the final step of the checksum function, which is defined in .
The values of p and ls are dependent on the choices of the parameters
n and w, as described in .
The specifies four LMOTS variants. Recently,
support for SHA256 with n=24, SHAKE256 with n=32, and SHAKE256 with n=24
have been specified. As a result, the LMOTS Signatures are:
 LMOTS_SHA256_N32_W1
 LMOTS_SHA256_N32_W2
 LMOTS_SHA256_N32_W4
 LMOTS_SHA256_N32_W8
 LMOTS_SHA256_N24_W1
 LMOTS_SHA256_N24_W2
 LMOTS_SHA256_N24_W4
 LMOTS_SHA256_N24_W8
 LMOTS_SHAKE_N32_W1
 LMOTS_SHAKE_N32_W2
 LMOTS_SHAKE_N32_W4
 LMOTS_SHAKE_N32_W8
 LMOTS_SHAKE_N24_W1
 LMOTS_SHAKE_N24_W2
 LMOTS_SHAKE_N24_W4
 LMOTS_SHAKE_N24_W8
All of these appear in the IANA registry .
Additional LMOTS signatures may be registered in the future.
Signing involves the generation of C, an nbyte random value.
The LMOTS signature value can be summarized as the identifier of the
LMOTS variant, the random value, and a sequence of hash values (y[0]
through y[p1]) that correspond to the elements of the public key, as
described in :
u32str(otstype)  C  y[0]  ...  y[p1]
Algorithm Identifiers and Parameters
The algorithm identifier for an HSS/LMS hashbased signature is:
idalghsslmshashsig OBJECT IDENTIFIER ::= { iso(1)
memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) alg(3) 17 }
When this object identifier is used for an HSS/LMS signature, the
AlgorithmIdentifier parameters field MUST be absent (that is, the
parameters are not present, and the parameters are not set to NULL).
In the CMS, the HSS/LMS signature value is a large OCTET STRING. The HSS/LMS
signature generation is described in of this document. The
signature format is designed for easy parsing. The HSS, LMS, and LMOTS components
of the signature value each include a counter and a typecode that indirectly provide
all of the information that is needed to parse the value during signature validation.
The signature value identifies the hash function used in the HSS/LMS
tree.
HSS/LMS Public Key Identifier
The AlgorithmIdentifier for an HSS/LMS public key uses the
idalghsslmshashsig object identifier, and the parameters
field MUST be absent.
When this AlgorithmIdentifier appears in the SubjectPublicKeyInfo
field of a certification authority (CA) X.509 certificate
, the
certificate key usage extension MUST contain at least one of the
following values: digitalSignature, nonRepudiation, keyCertSign, and cRLSign.
However, it MUST NOT contain other values.
When this AlgorithmIdentifier appears in the SubjectPublicKeyInfo
field of an end entity X.509 certificate
, the
certificate key usage extension MUST contain at least one of the
following: digitalSignature or nonRepudiation. However, it MUST NOT
contain other values.
pkHSSLMSHashSig PUBLICKEY ::= {
IDENTIFIER idalghsslmshashsig
 KEY no ASN.1 wrapping 
PARAMS ARE absent
CERTKEYUSAGE
{ digitalSignature, nonRepudiation, keyCertSign, cRLSign } }
HSSLMSHashSigPublicKey ::= OCTET STRING
The idalghsslmshashsig algorithm identifier is also
referred to as idalgmtshashsig. This synonym is based on the
terminology used in an early draft version of the document that became
.
When the public key appears outside a certificate, it is an
OCTET STRING. Like the signature format, it is designed for easy
parsing. The value is the number of levels in the public key, L,
followed by the LMS public key.
The HSS/LMS public key value can be described as:
u32str(L)  lms_public_key
The public key for the topmost LMS tree is the public key
of the HSS system. When L=1, the HSS system is a single tree.
SignedData Conventions
As specified in , the digital signature is produced from the
message digest and the signer's private key. The signature is
computed over different values depending on whether signed attributes
are absent or present.
When signed attributes are absent, the HSS/LMS signature is computed
over the content. When signed attributes are present, a hash is
computed over the content using the same hash function that is used
in the HSS/LMS tree, then a messagedigest attribute is constructed with
the hash of the content, and then the HSS/LMS
signature is computed over the DERencoded set of signed attributes
(which MUST include a contenttype attribute and a messagedigest
attribute). In summary:
IF (signed attributes are absent)
THEN HSS_LMS_Sign(content)
ELSE messagedigest attribute = Hash(content);
HSS_LMS_Sign(DER(SignedAttributes))
When using , the fields in the SignerInfo are used as
follows:

digestAlgorithm MUST contain the oneway hash function used in the
HSS/LMS tree. For convenience, the AlgorithmIdentifier for SHA256
from and the
AlgorithmIdentifier for SHAKE256 from
are repeated here:
mdasha256 DIGESTALGORITHM ::= {
IDENTIFIER idsha256
PARAMS TYPE NULL ARE preferredAbsent }
idsha256 OBJECT IDENTIFIER ::= { jointisoitut(2)
country(16) us(840) organization(1) gov(101) csor(3)
nistAlgorithms(4) hashalgs(2) 1 }
mdashake256 DIGESTALGORITHM ::= {
IDENTIFIER idshake256 }
idshake256 OBJECT IDENTIFIER ::= { jointisoitut(2)
country(16) us(840) organization(1) gov(101) csor(3)
nistAlgorithm(4) hashAlgs(2) 12 }

signatureAlgorithm MUST contain idalghsslmshashsig, and the
algorithm parameters field MUST be absent.

signature contains the single HSS/LMS signature value resulting from
the signing operation as specified in .
Security Considerations
Implementations MUST protect the private keys. Compromise of the
private keys will result in the ability to forge signatures. Along
with the private key, the implementation MUST keep track of which
leaf nodes in the tree have been used. Loss of integrity of this
tracking data can cause a onetime key to be used more than once. As
a result, when a private key and the tracking data are stored on nonvolatile
media or in a virtual machine environment, failed
writes, virtual machine snapshotting or cloning, and other
operational concerns must be considered to ensure confidentiality and
integrity.
When generating an LMS key pair, an implementation MUST generate each
key pair independently of all other key pairs in the HSS tree.
An implementation MUST ensure that an LMOTS private key is used to
generate a signature only one time and ensure that it cannot be used
for any other purpose.
The generation of private keys relies on random numbers. The use of
inadequate pseudorandom number generators (PRNGs) to generate these
values can result in little or no security. An attacker may find it
much easier to reproduce the PRNG environment that produced the keys,
searching the resulting small set of possibilities, rather than bruteforce searching the whole key space. The generation of quality
random numbers is difficult, and offers important guidance
in this area.
The generation of hashbased signatures also depends on random
numbers. While the consequences of an inadequate pseudorandom
number generator (PRNG) to generate these values is much less severe
than in the generation of private keys, the guidance in
remains important.
When computing signatures, the same hash function SHOULD be used to
compute the message digest of the content and the signed attributes, if they are present.
IANA Considerations
In the "SMI Security for S/MIME Module Identifier (1.2.840.113549.1.9.16.0)"
registry, IANA is requested to change the reference for value 64 to point to this
document.
In the "SMI Security for S/MIME Algorithms (1.2.840.113549.1.9.16.3)"
registry, IANA is requested to change the reference for value 17 to
point to this document.
References
Normative References
Information technology  Abstract Syntax Notation One (ASN.1): Specification of basic notation
ITUT
Information technology  ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)
ITUT
Cryptographic Message Syntax (CMS)
LeightonMicali HashBased Signatures
Key words for use in RFCs to Indicate Requirement Levels
Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
Secure Hash Standard (SHS)
National Institute of Standards and Technology (NIST)
SHA3 Standard: PermutationBased Hash and ExtendableOutput Functions
National Institute of Standards and Technology
Internet X.509 Public Key Infrastructure: Additional Algorithm Identifiers for RSASSAPSS and ECDSA Using SHAKEs
Informative References
The Factoring Dead: Preparing for the Cryptopocalypse
New ASN.1 Modules for Cryptographic Message Syntax (CMS) and S/MIME
Additional New ASN.1 Modules for the Cryptographic Message Syntax (CMS) and the Public Key Infrastructure Using X.509 (PKIX)
Using Cryptographic Message Syntax (CMS) to Protect Firmware Packages
LeightonMicali Signatures (LMS)
IANA
Large provably fast and secure digital signature schemes based on secure hash functions
Secrecy, Authentication, and Public Key Systems
A Digital Signature Based on a Conventional Encryption Function
Advances in Cryptology  CRYPTO '87 Proceedings
Lecture Notes in Computer Science Vol. 293
A Certified Digital Signature
Advances in Cryptology  CRYPTO '89 Proceedings
Lecture Notes in Computer Science Vol. 435
One Way Hash Functions and DES
Advances in Cryptology  CRYPTO '89 Proceedings
Lecture Notes in Computer Science Vol. 435
Quantum Computing: Progress and Prospects
National Academies of Sciences, Engineering, and Medicine
The National Academies Press
New ASN.1 Modules for the Public Key Infrastructure Using X.509 (PKIX)
Introduction to postquantum cryptography
Randomness Requirements for Security
ASN.1 Module
MTSHashSig2013
{ iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
idsmime(16) idmod(0) idmodmtshashsig2013(64) }
DEFINITIONS IMPLICIT TAGS ::= BEGIN
EXPORTS ALL;
IMPORTS
PUBLICKEY, SIGNATUREALGORITHM, SMIMECAPS
FROM AlgorithmInformation2009  RFC 5911 [CMSASN1]
{ iso(1) identifiedorganization(3) dod(6) internet(1)
security(5) mechanisms(5) pkix(7) idmod(0)
idmodalgorithmInformation02(58) } ;

 Object Identifiers

idalghsslmshashsig OBJECT IDENTIFIER ::= { iso(1)
memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
smime(16) alg(3) 17 }
idalgmtshashsig OBJECT IDENTIFIER ::= idalghsslmshashsig

 Signature Algorithm and Public Key

saHSSLMSHashSig SIGNATUREALGORITHM ::= {
IDENTIFIER idalghsslmshashsig
PARAMS ARE absent
PUBLICKEYS { pkHSSLMSHashSig }
SMIMECAPS { IDENTIFIED BY idalghsslmshashsig } }
pkHSSLMSHashSig PUBLICKEY ::= {
IDENTIFIER idalghsslmshashsig
 KEY no ASN.1 wrapping 
PARAMS ARE absent
CERTKEYUSAGE
{ digitalSignature, nonRepudiation, keyCertSign, cRLSign } }
HSSLMSHashSigPublicKey ::= OCTET STRING

 Expand the signature algorithm set used by CMS [CMSASN1U]

SignatureAlgorithmSet SIGNATUREALGORITHM ::=
{ saHSSLMSHashSig, ... }

 Expand the S/MIME capabilities set used by CMS [CMSASN1]

SMimeCaps SMIMECAPS ::=
{ saHSSLMSHashSig.&smimeCaps, ... }
END
Acknowledgements
Many thanks to the people that provided comments on the draft documents that
resulted in RFC 8708. Thanks to
,
,
,
,
,
,
,
,
,
,
, and
for their careful review and comments.
Many thanks to for motivating the
creation of this document.