EVP\_SIGNATURE-SM2(7ossl) OpenSSL EVP\_SIGNATURE-SM2(7ossl)

# [NAME](#NAME)

EVP\_SIGNATURE-SM2 - The EVP\_PKEY SM2 signature implementation.

# [DESCRIPTION](#DESCRIPTION)

Support for computing SM2 signatures. See [**EVP\_PKEY-SM2**(7)](/man/os/openssl-4.0/EVP_PKEY-SM2.7) for information related to SM2 keys.

This signature algorithm can be explicitly fetched with [**EVP\_PKEY\_sign\_init\_ex2**(3)](/man/os/openssl-4.0/EVP_PKEY_sign_init_ex2.3), and implicitly fetched (through SM2 keys) with [**EVP\_DigestSignInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestSignInit_ex.3) and [**EVP\_DigestVerifyInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestVerifyInit_ex.3).

## [SM2 Signature Parameters](#SM2_Signature_Parameters)

The following signature parameters can be set using [**EVP\_PKEY\_CTX\_set\_params**(3)](/man/os/openssl-4.0/EVP_PKEY_CTX_set_params.3), [**EVP\_DigestSignInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestSignInit_ex.3) or [**EVP\_DigestVerifyInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestVerifyInit_ex.3).

"digest" (**OSSL\_SIGNATURE\_PARAM\_DIGEST**) &lt;UTF8 string&gt;

This defaults to the "SM3" digest if not explicitly specified.

"digest-size" (**OSSL\_SIGNATURE\_PARAM\_DIGEST**) &lt;size\_t&gt;

This defaults to 32 bytes if not explicitly specified. Digests of a different size are not supported with **SM2**.

"distid" (**OSSL\_PKEY\_PARAM\_DIST\_ID**) &lt;UTF8 string&gt;

The *distinguishing identifier* defaults to 1234567812345678 if not explicitly specified.

An explicit empty distinguishing identifier value may need to be used to verify or create signatures that are compatible with versions of OpenSSL prior to 4.0. With the commandline tools an empty value can be specified with the use of either the **-pkeyopt** ([**openssl-pkeyutl**(1)](/man/os/openssl-4.0/openssl-pkeyutl.1)) or **-sigopt** ([**openssl-dgst**(1)](/man/os/openssl-4.0/openssl-dgst.1)) option with a value of "distid:".

"tls-version" (**OSSL\_SIGNATURE\_PARAM\_TLS\_VERSION**) &lt;uint&gt;

The OpenSSL 4.0 or later TLS protocol engine passes this parameter to the underlying signature algorithm when signing or verifying TLS **CertificateVerify** messages. When the protocol version is TLS 1.3 (0x0304), the SM2 signature algorithm will use the RFC8998 *distinguished identifier* instead of the default value noted above.

The following signature parameters can be retrieved using **EVP\_PKEY\_CTX\_get\_params()**.

"algorithm-id" (**OSSL\_SIGNATURE\_PARAM\_ALGORITHM\_ID**) &lt;octet string&gt;

This returns the DER encoding of the **SM2-with-SM3** signature OID.

"digest" (**OSSL\_SIGNATURE\_PARAM\_DIGEST**) &lt;UTF8 string&gt;

"digest-size" (**OSSL\_SIGNATURE\_PARAM\_DIGEST**) &lt;size\_t&gt;

# [SEE ALSO](#SEE_ALSO)

[**EVP\_PKEY\_CTX\_set\_params**(3)](/man/os/openssl-4.0/EVP_PKEY_CTX_set_params.3), [**EVP\_PKEY\_sign**(3)](/man/os/openssl-4.0/EVP_PKEY_sign.3), [**EVP\_PKEY\_verify**(3)](/man/os/openssl-4.0/EVP_PKEY_verify.3), [**EVP\_DigestSignInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestSignInit_ex.3), [**EVP\_DigestVerifyInit\_ex**(3)](/man/os/openssl-4.0/EVP_DigestVerifyInit_ex.3), [**provider-signature**(7)](/man/os/openssl-4.0/provider-signature.7),

# [HISTORY](#HISTORY)

The default value of the SM2 distinguishing identifier changed from empty to 1234567812345678 as of OpenSSL 4.0.

Support for the **OSSL\_SIGNATURE\_PARAM\_TLS\_VERSION** parameter was added in OpenSSL 4.0.

# [COPYRIGHT](#COPYRIGHT)

Copyright 2020-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 &lt;https://www.openssl.org/source/license.html&gt;.

2026-09-29 4.0.3

---

Document: EVP_SIGNATURE-SM2(7ossl) from openssl-4.0 4.0.3-r7 (Chainguard OS)
