EVP_PKEY-LMS7ssl
Evp_pkey leighton-micali signature (lms) keytype and algorithm support
Overview
The LMS keytype is implemented in OpenSSL's default and FIPS providers. The OpenSSL providers only support LMS signature verification, as this is a [SP 800-208](https://csrc.nist.gov/pubs/sp/800/208/final) requirement for FIPS software modules.
Common LMS parameters
LMS public keys are encoded in XDR format (i.e. not ASN1 format). The following parameters are used by EVP_PKEY_fromdata() and by the LMS keymanager for import and export.
- "pub" (
OSSL_PKEY_PARAM_PUB_KEY) <octet string> -
Used for getting and setting the encoding of an LMS public key. The public key is expected to be in XDR format.
Notes
LMS support is disabled by default at compile-time. To enable it, specify the enable-lms build configuration option.
Examples
NOTE error checking has been omitted in these examples
An EVP_PKEY context can be obtained by calling:
EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(libctx, "LMS", propq);
An LMS public key can be loaded simply like this:
EVP_PKEY *pkey = NULL;OSSL_DECODER_CTX *dctx = NULL;int selection = OSSL_KEYMGMT_SELECT_PUBLIC_KEY;dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "XDR", NULL,"LMS", selection, libctx, propq);ret = OSSL_DECODER_from_bio(dctx, bio);OSSL_DECODER_CTX_free(dctx);
To load a LMS key from XDR encoded "data" of size "datalen":
EVP_PKEY *key = NULL;OSSL_PARAM params[2];params[0] =OSSL_PARAM_construct_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY,(unsigned char *)data, datalen);params[1] = OSSL_PARAM_construct_end();ret = EVP_PKEY_fromdata_init(ctx)ret = EVP_PKEY_fromdata(ctx, &key, EVP_PKEY_PUBLIC_KEY, params);