EVP_SIGNATURE-SLH-DSA(7ossl)
π EVP_SIGNATURE-SLH-DSA β the SLH-DSA signature glow-up (7ossl) π
okay bestie so this is the EVP_SIGNATURE-SLH-DSA(7ossl) page, and it's all about the EVP_PKEY SLH-DSA signature implementations. buckle up, post-quantum era is here π¦
β¨ NAME β¨
EVP_SIGNATURE-SLH-DSA, EVP_SIGNATURE-SLH-DSA-SHA2-128s, EVP_SIGNATURE-SLH-DSA-SHA2-128f, EVP_SIGNATURE-SLH-DSA-SHA2-192s, EVP_SIGNATURE-SLH-DSA-SHA2-192f, EVP_SIGNATURE-SLH-DSA-SHA2-256s, EVP_SIGNATURE-SLH-DSA-SHA2-256f, EVP_SIGNATURE-SLH-DSA-SHAKE-128s, EVP_SIGNATURE-SLH-DSA-SHAKE-128f, EVP_SIGNATURE-SLH-DSA-SHAKE-192s, EVP_SIGNATURE-SLH-DSA-SHAKE-192f, EVP_SIGNATURE-SLH-DSA-SHAKE-256s, EVP_SIGNATURE-SLH-DSA-SHAKE-256f β the EVP_PKEY SLH-DSA signature implementations π
πΈ DESCRIPTION πΈ
So the whole lineup β SLH-DSA-SHA2-128s, EVP_PKEY-SLH-DSA-SHA2-128f, SLH-DSA-SHA2-192s, EVP_PKEY-SLH-DSA-SHA2-192f, SLH-DSA-SHA2-256s, EVP_PKEY-SLH-DSA-SHA2-256f, SLH-DSA-SHAKE-128s, EVP_PKEY-SLH-DSA-SHAKE-128f, SLH-DSA-SHAKE-192s, EVP_PKEY-SLH-DSA-SHAKE-192f, SLH-DSA-SHAKE-256s and EVP_PKEY-SLH-DSA-SHAKE-256f (yes, literally all of those, that's the list, don't come for me) β these EVP_PKEY implementations support key generation, one-shot sign and verify using the SLH-DSA signature schemes described in FIPS 205. no cap π«Ά
The different algorithm names correspond to the parameter sets defined in FIPS 205 Section 11 Table 2. lowkey important: the "s" types have smaller signature sizes, and the "f" variants are faster (the signatures range from ~8K to ~50K depending on the type chosen). and there are 3 different security categories, also depending on the type. pick your fighter π
EVP_SIGNATURE_fetch(3) can be used to explicitly fetch one of the 12 algorithms, which can then be used with EVP_PKEY_sign_message_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_message_init(3), and EVP_PKEY_verify(3) to perform one-shot message signing or verification. one shot, one opportunity, etc β¨
The normal signing process (called Pure SLH-DSA Signature Generation) encodes the message internally as:
0x00 || len(ctx) || ctx || message
where ctx is some optional value of size 0x00..0xFF. OpenSSL also allows the message to not be encoded, which is required for testing. OpenSSL does not support Pre Hash SLH-DSA Signature Generation β but you can still do it yourself by doing pre hash encoding externally and then choosing the option to not encode the message. DIY queen behavior, honestly π§
π SLH-DSA Signature Parameters π
The "context-string" parameter (described below) can be used for both signing and verification. It may be set by passing an OSSL_PARAM array to EVP_PKEY_sign_init_ex2(3) or EVP_PKEY_verify_init_ex2(3).
"context-string"(OSSL_SIGNATURE_PARAM_CONTEXT_STRING) <octet string> β a string of octets with length at most 255. by default it's the empty string. π«§
The following parameters can be used when signing β they can be set by passing an OSSL_PARAM array to EVP_PKEY_sign_init_ex2(3):
"message-encoding"(OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING) <integer> β the default value of1uses 'Pure SLH-DSA Signature Generation' as described above. setting it to0does not encode the message, which is used for testing, but can also be used for 'Pre Hash SLH-DSA Signature Generation'. two vibes, one flag π"test-entropy"(OSSL_SIGNATURE_PARAM_TEST_ENTROPY<octet string β used for testing to pass a optional random value. (and yes, that's literally how the page writes it, missing closing paren and all β I don't make the rules, I just report them π)"deterministic"(OSSL_SIGNATURE_PARAM_DETERMINISTIC) <integer> β the default value of0generates a random value (using a DRBG), this is used when processing the message. setting this to1causes the private key seed to be used instead. β οΈ this value is ignored if"test-entropy"is set. periodt.
See EVP_PKEY-SLH-DSA(7) for information related to SLH-DSA keys. π
π FIPS indicator π
The following parameter can be retrieved using EVP_PKEY_CTX_get_params(3):
"fips-indicator"(OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR) <integer> β the OpenSSL FIPS provider returns1if the operation is FIPS approved, or0otherwise. see "FIPS indicators" infips_module(7)for more information. heads up though: supplying the test-only"test-entropy"parameter causes this indicator to return0π
β NOTES β
For backwards compatibility reasons EVP_DigestSignInit_ex(), EVP_DigestSign(), EVP_DigestVerifyInit_ex() and EVP_DigestVerify() may also be used, but the digest passed in mdname must be NULL. like, must must. no digest bestie, it's not that kind of function π
π₯ EXAMPLES π₯
To sign a message using an SLH-DSA EVP_PKEY structure:
void do_sign(EVP_PKEY *key, unsigned char *msg, size_t msg_len)
{
size_t sig_len;
unsigned char *sig = NULL;
const OSSL_PARAM params[] = {
OSSL_PARAM_octet_string("context-string", (unsigned char *)"A context string", 33),
OSSL_PARAM_END
};
EVP_PKEY_CTX *sctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL);
EVP_SIGNATURE *sig_alg = EVP_SIGNATURE_fetch(NULL, "SLH-DSA-SHA2-128s", NULL);
EVP_PKEY_sign_message_init(sctx, sig_alg, params);
/* Calculate the required size for the signature by passing a NULL buffer. */
EVP_PKEY_sign(sctx, NULL, &sig_len, msg, msg_len);
sig = OPENSSL_zalloc(sig_len);
EVP_PKEY_sign(sctx, sig, &sig_len, msg, msg_len);
...
OPENSSL_free(sig);
EVP_SIGNATURE_free(sig_alg);
EVP_PKEY_CTX_free(sctx);
}
(and yeah the snippet says pkey while the signature says key β copy it exactly as shown, it's the manual's business not ours π)
π¦ SEE ALSO π¦
EVP_PKEY-SLH-DSA(7) provider-signature(7), EVP_PKEY_sign(3), EVP_PKEY_verify(3),
π HISTORY π
This functionality was added in OpenSSL 3.5. iconic, brand new, fresh off the press β¨
π COPYRIGHT π
Copyright 2024-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page bestie, mwah π β this was OpenSSL 3.5.9, dated 2026-09-29, signing off from EVP_SIGNATURE-SLH-DSA(7ossl) ππ«Άπ
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms