EVP_SIGNATURE-RSA.7ossl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_SIGNATURE-RSA 7ossl"
  58. .TH EVP_SIGNATURE-RSA 7ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_SIGNATURE\-RSA
  65. \&\- The EVP_PKEY RSA signature implementation
  66. .SH DESCRIPTION
  67. .IX Header "DESCRIPTION"
  68. Support for computing RSA signatures.
  69. See \fBEVP_PKEY\-RSA\fR\|(7) for information related to RSA keys.
  70. .SS "Algorithm Names"
  71. .IX Subsection "Algorithm Names"
  72. In this list, names are grouped together to signify that they are the same
  73. algorithm having multiple names. This also includes the OID in canonical
  74. decimal form (which means that they are possible to fetch if the caller has a
  75. mere OID which came out in this form after a call to \fBOBJ_obj2txt\fR\|(3)).
  76. .IP """RSA"", ""rsaEncryption"", ""1.2.840.113549.1.1.1""" 4
  77. .IX Item """RSA"", ""rsaEncryption"", ""1.2.840.113549.1.1.1"""
  78. The base signature algorithm, supported explicitly fetched with
  79. \&\fBEVP_PKEY_sign_init_ex2\fR\|(3), and implicitly fetched (through
  80. RSA keys) with \fBEVP_DigestSignInit\fR\|(3) and
  81. \&\fBEVP_DigestVerifyInit\fR\|(3).
  82. .Sp
  83. It can't be used with \fBEVP_PKEY_sign_message_init\fR\|(3)
  84. .IP """RSA\-RIPEMD160"", ""ripemd160WithRSA"", ""1.3.36.3.3.1.2""" 4
  85. .IX Item """RSA-RIPEMD160"", ""ripemd160WithRSA"", ""1.3.36.3.3.1.2"""
  86. .PD 0
  87. .IP """RSA\-SHA2\-256"", ""RSA\-SHA256"", ""sha256WithRSAEncryption"", ""1.2.840.113549.1.1.11""" 4
  88. .IX Item """RSA-SHA2-256"", ""RSA-SHA256"", ""sha256WithRSAEncryption"", ""1.2.840.113549.1.1.11"""
  89. .IP """RSA\-SHA2\-384"", ""RSA\-SHA384"", ""sha384WithRSAEncryption"", ""1.2.840.113549.1.1.12""" 4
  90. .IX Item """RSA-SHA2-384"", ""RSA-SHA384"", ""sha384WithRSAEncryption"", ""1.2.840.113549.1.1.12"""
  91. .IP """RSA\-SHA2\-512"", ""RSA\-SHA512"", ""sha512WithRSAEncryption"", ""1.2.840.113549.1.1.13""" 4
  92. .IX Item """RSA-SHA2-512"", ""RSA-SHA512"", ""sha512WithRSAEncryption"", ""1.2.840.113549.1.1.13"""
  93. .IP """RSA\-SHA2\-224"", ""RSA\-SHA224"", ""sha224WithRSAEncryption"", ""1.2.840.113549.1.1.14""" 4
  94. .IX Item """RSA-SHA2-224"", ""RSA-SHA224"", ""sha224WithRSAEncryption"", ""1.2.840.113549.1.1.14"""
  95. .IP """RSA\-SHA2\-512/224"", ""RSA\-SHA512\-224"", ""sha512\-224WithRSAEncryption"", ""1.2.840.113549.1.1.15""" 4
  96. .IX Item """RSA-SHA2-512/224"", ""RSA-SHA512-224"", ""sha512-224WithRSAEncryption"", ""1.2.840.113549.1.1.15"""
  97. .IP """RSA\-SHA2\-512/256"", ""RSA\-SHA512\-256"", ""sha512\-256WithRSAEncryption"", ""1.2.840.113549.1.1.16""" 4
  98. .IX Item """RSA-SHA2-512/256"", ""RSA-SHA512-256"", ""sha512-256WithRSAEncryption"", ""1.2.840.113549.1.1.16"""
  99. .IP """RSA\-SHA3\-224"", ""id\-rsassa\-pkcs1\-v1_5\-with\-sha3\-224"", ""2.16.840.1.101.3.4.3.13""" 4
  100. .IX Item """RSA-SHA3-224"", ""id-rsassa-pkcs1-v1_5-with-sha3-224"", ""2.16.840.1.101.3.4.3.13"""
  101. .IP """RSA\-SHA3\-256"", ""id\-rsassa\-pkcs1\-v1_5\-with\-sha3\-256"", ""2.16.840.1.101.3.4.3.14""" 4
  102. .IX Item """RSA-SHA3-256"", ""id-rsassa-pkcs1-v1_5-with-sha3-256"", ""2.16.840.1.101.3.4.3.14"""
  103. .IP """RSA\-SHA3\-384"", ""id\-rsassa\-pkcs1\-v1_5\-with\-sha3\-384"", ""2.16.840.1.101.3.4.3.15""" 4
  104. .IX Item """RSA-SHA3-384"", ""id-rsassa-pkcs1-v1_5-with-sha3-384"", ""2.16.840.1.101.3.4.3.15"""
  105. .IP """RSA\-SHA3\-512"", ""id\-rsassa\-pkcs1\-v1_5\-with\-sha3\-512"", ""2.16.840.1.101.3.4.3.16""" 4
  106. .IX Item """RSA-SHA3-512"", ""id-rsassa-pkcs1-v1_5-with-sha3-512"", ""2.16.840.1.101.3.4.3.16"""
  107. .IP """RSA\-SM3"", ""sm3WithRSAEncryption"", ""1.2.156.10197.1.504""" 4
  108. .IX Item """RSA-SM3"", ""sm3WithRSAEncryption"", ""1.2.156.10197.1.504"""
  109. .PD
  110. PKCS#1 v1.5 RSA signature schemes with diverse message digest algorithms. They
  111. are all supported explicitly fetched with \fBEVP_PKEY_sign_init_ex2\fR\|(3) and
  112. \&\fBEVP_PKEY_sign_message_init\fR\|(3).
  113. They are all pre-set to use the pad mode "pkcs1". This cannot be changed.
  114. .SS "Signature Parameters"
  115. .IX Subsection "Signature Parameters"
  116. The following signature parameters can be set using \fBEVP_PKEY_CTX_set_params()\fR.
  117. This may be called after \fBEVP_PKEY_sign_init()\fR or \fBEVP_PKEY_verify_init()\fR,
  118. and before calling \fBEVP_PKEY_sign()\fR or \fBEVP_PKEY_verify()\fR. They may also be set
  119. using \fBEVP_PKEY_sign_init_ex()\fR or \fBEVP_PKEY_verify_init_ex()\fR.
  120. .IP """digest"" (\fBOSSL_SIGNATURE_PARAM_DIGEST\fR) <UTF8 string>" 4
  121. .IX Item """digest"" (OSSL_SIGNATURE_PARAM_DIGEST) <UTF8 string>"
  122. .PD 0
  123. .IP """properties"" (\fBOSSL_SIGNATURE_PARAM_PROPERTIES\fR) <UTF8 string>" 4
  124. .IX Item """properties"" (OSSL_SIGNATURE_PARAM_PROPERTIES) <UTF8 string>"
  125. .PD
  126. These are not supported with the RSA signature schemes that already include a
  127. message digest algorithm, See "Algorithm Names" above.
  128. .Sp
  129. These common parameters are described in \fBprovider\-signature\fR\|(7).
  130. .IP """pad-mode"" (\fBOSSL_SIGNATURE_PARAM_PAD_MODE\fR) <UTF8 string>" 4
  131. .IX Item """pad-mode"" (OSSL_SIGNATURE_PARAM_PAD_MODE) <UTF8 string>"
  132. The type of padding to be used. Its value can be one of the following:
  133. .RS 4
  134. .IP """none"" (\fBOSSL_PKEY_RSA_PAD_MODE_NONE\fR)" 4
  135. .IX Item """none"" (OSSL_PKEY_RSA_PAD_MODE_NONE)"
  136. .PD 0
  137. .IP """pkcs1"" (\fBOSSL_PKEY_RSA_PAD_MODE_PKCSV15\fR)" 4
  138. .IX Item """pkcs1"" (OSSL_PKEY_RSA_PAD_MODE_PKCSV15)"
  139. .IP """x931"" (\fBOSSL_PKEY_RSA_PAD_MODE_X931\fR)" 4
  140. .IX Item """x931"" (OSSL_PKEY_RSA_PAD_MODE_X931)"
  141. .PD
  142. This padding mode is no longer supported by the FIPS provider for signature
  143. generation, but may be used for signature verification for legacy use cases.
  144. (This is a FIPS 140\-3 requirement)
  145. .IP """pss"" (\fBOSSL_PKEY_RSA_PAD_MODE_PSS\fR)" 4
  146. .IX Item """pss"" (OSSL_PKEY_RSA_PAD_MODE_PSS)"
  147. .RE
  148. .RS 4
  149. .RE
  150. .PD 0
  151. .IP """mgf1\-digest"" (\fBOSSL_SIGNATURE_PARAM_MGF1_DIGEST\fR) <UTF8 string>" 4
  152. .IX Item """mgf1-digest"" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST) <UTF8 string>"
  153. .PD
  154. The digest algorithm name to use for the maskGenAlgorithm used by "pss" mode.
  155. .IP """mgf1\-properties"" (\fBOSSL_SIGNATURE_PARAM_MGF1_PROPERTIES\fR) <UTF8 string>" 4
  156. .IX Item """mgf1-properties"" (OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES) <UTF8 string>"
  157. Sets the name of the property query associated with the "mgf1\-digest" algorithm.
  158. NULL is used if this optional value is not set.
  159. .IP """saltlen"" (\fBOSSL_SIGNATURE_PARAM_PSS_SALTLEN\fR) <integer> or <UTF8 string>" 4
  160. .IX Item """saltlen"" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or <UTF8 string>"
  161. The "pss" mode minimum salt length. The value can either be an integer,
  162. a string value representing a number or one of the following string values:
  163. .RS 4
  164. .IP """digest"" (\fBOSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST\fR)" 4
  165. .IX Item """digest"" (OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST)"
  166. Use the same length as the digest size.
  167. .IP """max"" (\fBOSSL_PKEY_RSA_PSS_SALT_LEN_MAX\fR)" 4
  168. .IX Item """max"" (OSSL_PKEY_RSA_PSS_SALT_LEN_MAX)"
  169. Use the maximum salt length.
  170. .IP """auto"" (\fBOSSL_PKEY_RSA_PSS_SALT_LEN_AUTO\fR)" 4
  171. .IX Item """auto"" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO)"
  172. Auto detect the salt length.
  173. .IP """auto-digestmax"" (\fBOSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX\fR)" 4
  174. .IX Item """auto-digestmax"" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX)"
  175. Auto detect the salt length when verifying. Maximize the salt length up to the
  176. digest size when signing to comply with FIPS 186\-4 section 5.5.
  177. .RE
  178. .RS 4
  179. .RE
  180. .PP
  181. The OpenSSL FIPS provider also supports the following parameters:
  182. .IP """key-check"" (\fBOSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK\fR) <integer>" 4
  183. .IX Item """key-check"" (OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK) <integer>"
  184. .PD 0
  185. .IP """digest-check"" (\fBOSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK\fR) <integer>" 4
  186. .IX Item """digest-check"" (OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK) <integer>"
  187. .IP """sign\-x931\-pad\-check"" (\fBOSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK\fR) <integer>" 4
  188. .IX Item """sign-x931-pad-check"" (OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK) <integer>"
  189. .PD
  190. These parameters are described in \fBprovider\-signature\fR\|(7).
  191. .IP """rsa-pss-saltlen-check"" (\fBOSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK\fR) <integer>" 4
  192. .IX Item """rsa-pss-saltlen-check"" (OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK) <integer>"
  193. The default value of 1 causes an error during signature generation or
  194. verification if salt length (\fBOSSL_SIGNATURE_PARAM_PSS_SALTLEN\fR) is not between
  195. zero and the output block size of the digest function (inclusive).
  196. Setting this to zero will ignore the error and set the approved "fips-indicator"
  197. to 0.
  198. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  199. to return 0.
  200. .PP
  201. The following signature parameters can be retrieved using
  202. \&\fBEVP_PKEY_CTX_get_params()\fR.
  203. .IP """algorithm-id"" (\fBOSSL_SIGNATURE_PARAM_ALGORITHM_ID\fR) <octet string>" 4
  204. .IX Item """algorithm-id"" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>"
  205. .PD 0
  206. .IP """fips-indicator"" (\fBOSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
  207. .IX Item """fips-indicator"" (OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
  208. .IP """verify-message"" (\fBOSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE\fR <integer>" 4
  209. .IX Item """verify-message"" (OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE <integer>"
  210. .PD
  211. These common parameter are described in \fBprovider\-signature\fR\|(7).
  212. .IP """digest"" (\fBOSSL_SIGNATURE_PARAM_DIGEST\fR) <UTF8 string>" 4
  213. .IX Item """digest"" (OSSL_SIGNATURE_PARAM_DIGEST) <UTF8 string>"
  214. .PD 0
  215. .IP """pad-mode"" (\fBOSSL_SIGNATURE_PARAM_PAD_MODE\fR) <UTF8 string>" 4
  216. .IX Item """pad-mode"" (OSSL_SIGNATURE_PARAM_PAD_MODE) <UTF8 string>"
  217. .IP """mgf1\-digest"" (\fBOSSL_SIGNATURE_PARAM_MGF1_DIGEST\fR) <UTF8 string>" 4
  218. .IX Item """mgf1-digest"" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST) <UTF8 string>"
  219. .IP """saltlen"" (\fBOSSL_SIGNATURE_PARAM_PSS_SALTLEN\fR) <integer> or <UTF8 string>" 4
  220. .IX Item """saltlen"" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or <UTF8 string>"
  221. .PD
  222. These parameters are as described above.
  223. .SH "SEE ALSO"
  224. .IX Header "SEE ALSO"
  225. \&\fBEVP_PKEY_CTX_set_params\fR\|(3),
  226. \&\fBEVP_PKEY_sign\fR\|(3),
  227. \&\fBEVP_PKEY_verify\fR\|(3),
  228. \&\fBprovider\-signature\fR\|(7),
  229. .SH COPYRIGHT
  230. .IX Header "COPYRIGHT"
  231. Copyright 2020\-2024 The OpenSSL Project Authors. All Rights Reserved.
  232. .PP
  233. Licensed under the Apache License 2.0 (the "License"). You may not use
  234. this file except in compliance with the License. You can obtain a copy
  235. in the file LICENSE in the source distribution or at
  236. <https://www.openssl.org/source/license.html>.