Merkle Tree Signatures (MTS) are a method for signing a large but fixed number of messages. An MTS system depends on a one-time signature method and a collision-resistant hash function.
This specification makes use of the hash-based algorithm specified in [
HASHSIG], which is the Leighton and Micali adaptation [
LM] of the original Lamport-Diffie-Winternitz-Merkle one-time signature system [
M1979] [
M1987] [
M1989a] [
M1989b].
As implied by the name, the hash-based signature algorithm depends on a collision-resistant hash function. The hash-based signature algorithm specified in [
HASHSIG] uses only the SHA-256 one-way hash function [
SHS], but it establishes an IANA registry [
IANA-LMS] to permit the registration of additional one-way hash functions in the future.
The MTS system specified in [
HASHSIG] uses a hierarchy of trees. The N-time 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 [
HASHSIG] carries the number of signed public keys (Nspk), followed by that number of signed public keys, followed by the LMS signature as described in
Section 2.2. 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 bottom-most tree signs the actual message. The signature over the public key and the signature over the actual message are LMS signatures as described in
Section 2.2.
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 [
HASHSIG].
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[Nspk-2] ||
signed_public_key[Nspk-1] ||
lms_signature /* signature of message */
where, as defined in
Section 3.3 of [
HASHSIG], 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.
Each tree in the system specified in [
HASHSIG] uses the Leighton-Micali 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 [
HASHSIG] specification supports five values for this parameter: h=5, h=10, h=15, h=20, and h=25. Note that 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 [
HASHSIG] specification supports only the SHA-256 hash function [
SHS], with m=32. As a result, the [
HASHSIG] specification supports five tree sizes; they are identified as:
-
LMS_SHA256_M32_H5
-
LMS_SHA256_M32_H10
-
LMS_SHA256_M32_H15
-
LMS_SHA256_M32_H20
-
LMS_SHA256_M32_H25
The [
HASHSIG] specification establishes an IANA registry [
IANA-LMS] to permit the registration of additional hash functions and additional tree sizes in the future.
As specified in [
HASHSIG], the LMS public key consists of four elements: the lms_algorithm_type from the list above, the otstype to identify the Leighton-Micali One-Time Signature (LM-OTS) type as discussed in
Section 2.3, the private key identifier (I) as described in
Section 5.3 of [
HASHSIG], and the m-byte 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 [
HASHSIG], an LMS signature consists of four elements: the number of the leaf (q) associated with the LM-OTS signature value, an LM-OTS signature value as described in
Section 2.3, 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 LM-OTS 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[h-1]
Merkle Tree Signatures (MTS) depend on a one-time signature method, and [
HASHSIG] specifies the use of the LM-OTS, which has five parameters:
-
n:
-
The length in bytes of the hash function output. [HASHSIG] supports only SHA-256 [SHS], with n=32.
-
H:
-
A preimage-resistant hash function that accepts byte strings of any length and returns an n-byte string.
-
w:
-
The width in bits of the Winternitz coefficients. [HASHSIG] supports four values for this parameter: w=1, w=2, w=4, and w=8.
-
p:
-
The number of n-byte string elements that make up the LM-OTS signature value.
-
ls:
-
The number of bits that are left-shifted in the final step ofthe checksum function, which is defined in Section 4.4 of [HASHSIG].
The values of p and ls are dependent on the choices of the parameters n and w, as described in
Appendix B of [
HASHSIG].
The [
HASHSIG] specification supports four LM-OTS variants:
-
LMOTS_SHA256_N32_W1
-
LMOTS_SHA256_N32_W2
-
LMOTS_SHA256_N32_W4
-
LMOTS_SHA256_N32_W8
The [
HASHSIG] specification establishes an IANA registry [
IANA-LMS] to permit the registration of additional variants in the future.
Signing involves the generation of C, an n-byte random value.
The LM-OTS signature value can be summarized as the identifier of the LM-OTS variant, the random value, and a sequence of hash values (y[0] through y[p-1]) that correspond to the elements of the public key, as described in
Section 4.5 of [
HASHSIG]:
u32str(otstype) || C || y[0] || ... || y[p-1]