.\" $NetBSD: EVP_PKEY-RSA.7,v 1.2.2.3 2023/11/02 19:32:23 sborrill Exp $ .\" .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "EVP_PKEY-RSA 7" .TH EVP_PKEY-RSA 7 "2023-10-25" "3.0.12" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" EVP_PKEY\-RSA, EVP_KEYMGMT\-RSA, RSA \&\- EVP_PKEY RSA keytype and algorithm support .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fB\s-1RSA\s0\fR keytype is implemented in OpenSSL's default and \s-1FIPS\s0 providers. That implementation supports the basic \s-1RSA\s0 keys, containing the modulus \fIn\fR, the public exponent \fIe\fR, the private exponent \fId\fR, and a collection of prime factors, exponents and coefficient for \s-1CRT\s0 calculations, of which the first few are known as \fIp\fR and \fIq\fR, \fIdP\fR and \fIdQ\fR, and \fIqInv\fR. .SS "Common \s-1RSA\s0 parameters" .IX Subsection "Common RSA parameters" In addition to the common parameters that all keytypes should support (see \&\*(L"Common parameters\*(R" in \fBprovider\-keymgmt\fR\|(7)), the \fB\s-1RSA\s0\fR keytype implementation supports the following. .ie n .IP """n"" (\fB\s-1OSSL_PKEY_PARAM_RSA_N\s0\fR) " 4 .el .IP "``n'' (\fB\s-1OSSL_PKEY_PARAM_RSA_N\s0\fR) " 4 .IX Item "n (OSSL_PKEY_PARAM_RSA_N) " The \s-1RSA\s0 modulus \*(L"n\*(R" value. .ie n .IP """e"" (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) " 4 .el .IP "``e'' (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) " 4 .IX Item "e (OSSL_PKEY_PARAM_RSA_E) " The \s-1RSA\s0 public exponent \*(L"e\*(R" value. This value must always be set when creating a raw key using \fBEVP_PKEY_fromdata\fR\|(3). Note that when a decryption operation is performed, that this value is used for blinding purposes to prevent timing attacks. .ie n .IP """d"" (\fB\s-1OSSL_PKEY_PARAM_RSA_D\s0\fR) " 4 .el .IP "``d'' (\fB\s-1OSSL_PKEY_PARAM_RSA_D\s0\fR) " 4 .IX Item "d (OSSL_PKEY_PARAM_RSA_D) " The \s-1RSA\s0 private exponent \*(L"d\*(R" value. .ie n .IP """rsa\-factor1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR1\s0\fR) " 4 .el .IP "``rsa\-factor1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR1\s0\fR) " 4 .IX Item "rsa-factor1 (OSSL_PKEY_PARAM_RSA_FACTOR1) " .PD 0 .ie n .IP """rsa\-factor2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR2\s0\fR) " 4 .el .IP "``rsa\-factor2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR2\s0\fR) " 4 .IX Item "rsa-factor2 (OSSL_PKEY_PARAM_RSA_FACTOR2) " .ie n .IP """rsa\-factor3"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR3\s0\fR) " 4 .el .IP "``rsa\-factor3'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR3\s0\fR) " 4 .IX Item "rsa-factor3 (OSSL_PKEY_PARAM_RSA_FACTOR3) " .ie n .IP """rsa\-factor4"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR4\s0\fR) " 4 .el .IP "``rsa\-factor4'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR4\s0\fR) " 4 .IX Item "rsa-factor4 (OSSL_PKEY_PARAM_RSA_FACTOR4) " .ie n .IP """rsa\-factor5"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR5\s0\fR) " 4 .el .IP "``rsa\-factor5'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR5\s0\fR) " 4 .IX Item "rsa-factor5 (OSSL_PKEY_PARAM_RSA_FACTOR5) " .ie n .IP """rsa\-factor6"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR6\s0\fR) " 4 .el .IP "``rsa\-factor6'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR6\s0\fR) " 4 .IX Item "rsa-factor6 (OSSL_PKEY_PARAM_RSA_FACTOR6) " .ie n .IP """rsa\-factor7"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR7\s0\fR) " 4 .el .IP "``rsa\-factor7'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR7\s0\fR) " 4 .IX Item "rsa-factor7 (OSSL_PKEY_PARAM_RSA_FACTOR7) " .ie n .IP """rsa\-factor8"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR8\s0\fR) " 4 .el .IP "``rsa\-factor8'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR8\s0\fR) " 4 .IX Item "rsa-factor8 (OSSL_PKEY_PARAM_RSA_FACTOR8) " .ie n .IP """rsa\-factor9"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR9\s0\fR) " 4 .el .IP "``rsa\-factor9'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR9\s0\fR) " 4 .IX Item "rsa-factor9 (OSSL_PKEY_PARAM_RSA_FACTOR9) " .ie n .IP """rsa\-factor10"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR10\s0\fR) " 4 .el .IP "``rsa\-factor10'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR10\s0\fR) " 4 .IX Item "rsa-factor10 (OSSL_PKEY_PARAM_RSA_FACTOR10) " .PD \&\s-1RSA\s0 prime factors. The factors are known as \*(L"p\*(R", \*(L"q\*(R" and \*(L"r_i\*(R" in \s-1RFC8017.\s0 Up to eight additional \*(L"r_i\*(R" prime factors are supported. .ie n .IP """rsa\-exponent1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT1\s0\fR) " 4 .el .IP "``rsa\-exponent1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT1\s0\fR) " 4 .IX Item "rsa-exponent1 (OSSL_PKEY_PARAM_RSA_EXPONENT1) " .PD 0 .ie n .IP """rsa\-exponent2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT2\s0\fR) " 4 .el .IP "``rsa\-exponent2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT2\s0\fR) " 4 .IX Item "rsa-exponent2 (OSSL_PKEY_PARAM_RSA_EXPONENT2) " .ie n .IP """rsa\-exponent3"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT3\s0\fR) " 4 .el .IP "``rsa\-exponent3'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT3\s0\fR) " 4 .IX Item "rsa-exponent3 (OSSL_PKEY_PARAM_RSA_EXPONENT3) " .ie n .IP """rsa\-exponent4"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT4\s0\fR) " 4 .el .IP "``rsa\-exponent4'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT4\s0\fR) " 4 .IX Item "rsa-exponent4 (OSSL_PKEY_PARAM_RSA_EXPONENT4) " .ie n .IP """rsa\-exponent5"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT5\s0\fR) " 4 .el .IP "``rsa\-exponent5'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT5\s0\fR) " 4 .IX Item "rsa-exponent5 (OSSL_PKEY_PARAM_RSA_EXPONENT5) " .ie n .IP """rsa\-exponent6"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT6\s0\fR) " 4 .el .IP "``rsa\-exponent6'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT6\s0\fR) " 4 .IX Item "rsa-exponent6 (OSSL_PKEY_PARAM_RSA_EXPONENT6) " .ie n .IP """rsa\-exponent7"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT7\s0\fR) " 4 .el .IP "``rsa\-exponent7'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT7\s0\fR) " 4 .IX Item "rsa-exponent7 (OSSL_PKEY_PARAM_RSA_EXPONENT7) " .ie n .IP """rsa\-exponent8"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT8\s0\fR) " 4 .el .IP "``rsa\-exponent8'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT8\s0\fR) " 4 .IX Item "rsa-exponent8 (OSSL_PKEY_PARAM_RSA_EXPONENT8) " .ie n .IP """rsa\-exponent9"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT9\s0\fR) " 4 .el .IP "``rsa\-exponent9'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT9\s0\fR) " 4 .IX Item "rsa-exponent9 (OSSL_PKEY_PARAM_RSA_EXPONENT9) " .ie n .IP """rsa\-exponent10"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT10\s0\fR) " 4 .el .IP "``rsa\-exponent10'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT10\s0\fR) " 4 .IX Item "rsa-exponent10 (OSSL_PKEY_PARAM_RSA_EXPONENT10) " .PD \&\s-1RSA CRT\s0 (Chinese Remainder Theorem) exponents. The exponents are known as \*(L"dP\*(R", \*(L"dQ\*(R" and \*(L"d_i in \s-1RFC8017\*(R".\s0 Up to eight additional \*(L"d_i\*(R" exponents are supported. .ie n .IP """rsa\-coefficient1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT1\s0\fR) " 4 .el .IP "``rsa\-coefficient1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT1\s0\fR) " 4 .IX Item "rsa-coefficient1 (OSSL_PKEY_PARAM_RSA_COEFFICIENT1) " .PD 0 .ie n .IP """rsa\-coefficient2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT2\s0\fR) " 4 .el .IP "``rsa\-coefficient2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT2\s0\fR) " 4 .IX Item "rsa-coefficient2 (OSSL_PKEY_PARAM_RSA_COEFFICIENT2) " .ie n .IP """rsa\-coefficient3"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT3\s0\fR) " 4 .el .IP "``rsa\-coefficient3'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT3\s0\fR) " 4 .IX Item "rsa-coefficient3 (OSSL_PKEY_PARAM_RSA_COEFFICIENT3) " .ie n .IP """rsa\-coefficient4"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT4\s0\fR) " 4 .el .IP "``rsa\-coefficient4'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT4\s0\fR) " 4 .IX Item "rsa-coefficient4 (OSSL_PKEY_PARAM_RSA_COEFFICIENT4) " .ie n .IP """rsa\-coefficient5"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT5\s0\fR) " 4 .el .IP "``rsa\-coefficient5'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT5\s0\fR) " 4 .IX Item "rsa-coefficient5 (OSSL_PKEY_PARAM_RSA_COEFFICIENT5) " .ie n .IP """rsa\-coefficient6"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT6\s0\fR) " 4 .el .IP "``rsa\-coefficient6'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT6\s0\fR) " 4 .IX Item "rsa-coefficient6 (OSSL_PKEY_PARAM_RSA_COEFFICIENT6) " .ie n .IP """rsa\-coefficient7"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT7\s0\fR) " 4 .el .IP "``rsa\-coefficient7'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT7\s0\fR) " 4 .IX Item "rsa-coefficient7 (OSSL_PKEY_PARAM_RSA_COEFFICIENT7) " .ie n .IP """rsa\-coefficient8"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT8\s0\fR) " 4 .el .IP "``rsa\-coefficient8'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT8\s0\fR) " 4 .IX Item "rsa-coefficient8 (OSSL_PKEY_PARAM_RSA_COEFFICIENT8) " .ie n .IP """rsa\-coefficient9"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT9\s0\fR) " 4 .el .IP "``rsa\-coefficient9'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT9\s0\fR) " 4 .IX Item "rsa-coefficient9 (OSSL_PKEY_PARAM_RSA_COEFFICIENT9) " .PD \&\s-1RSA CRT\s0 (Chinese Remainder Theorem) coefficients. The coefficients are known as \&\*(L"qInv\*(R" and \*(L"t_i\*(R". Up to eight additional \*(L"t_i\*(R" exponents are supported. .SS "\s-1RSA\s0 key generation parameters" .IX Subsection "RSA key generation parameters" When generating \s-1RSA\s0 keys, the following key generation parameters may be used. .ie n .IP """bits"" (\fB\s-1OSSL_PKEY_PARAM_RSA_BITS\s0\fR) " 4 .el .IP "``bits'' (\fB\s-1OSSL_PKEY_PARAM_RSA_BITS\s0\fR) " 4 .IX Item "bits (OSSL_PKEY_PARAM_RSA_BITS) " The value should be the cryptographic length for the \fB\s-1RSA\s0\fR cryptosystem, in bits. .ie n .IP """primes"" (\fB\s-1OSSL_PKEY_PARAM_RSA_PRIMES\s0\fR) " 4 .el .IP "``primes'' (\fB\s-1OSSL_PKEY_PARAM_RSA_PRIMES\s0\fR) " 4 .IX Item "primes (OSSL_PKEY_PARAM_RSA_PRIMES) " The value should be the number of primes for the generated \fB\s-1RSA\s0\fR key. The default is 2. It isn't permitted to specify a larger number of primes than 10. Additionally, the number of primes is limited by the length of the key being generated so the maximum number could be less. Some providers may only support a value of 2. .ie n .IP """e"" (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) " 4 .el .IP "``e'' (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) " 4 .IX Item "e (OSSL_PKEY_PARAM_RSA_E) " The \s-1RSA\s0 \*(L"e\*(R" value. The value may be any odd number greater than or equal to 65537. The default value is 65537. For legacy reasons a value of 3 is currently accepted but is deprecated. .SS "\s-1RSA\s0 key generation parameters for \s-1FIPS\s0 module testing" .IX Subsection "RSA key generation parameters for FIPS module testing" When generating \s-1RSA\s0 keys, the following additional key generation parameters may be used for algorithm testing purposes only. Do not use these to generate \&\s-1RSA\s0 keys for a production environment. .ie n .IP """xp"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP\s0\fR) " 4 .el .IP "``xp'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP\s0\fR) " 4 .IX Item "xp (OSSL_PKEY_PARAM_RSA_TEST_XP) " .PD 0 .ie n .IP """xq"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ\s0\fR) " 4 .el .IP "``xq'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ\s0\fR) " 4 .IX Item "xq (OSSL_PKEY_PARAM_RSA_TEST_XQ) " .PD These 2 fields are normally randomly generated and are used to generate \*(L"p\*(R" and \&\*(L"q\*(R". .ie n .IP """xp1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP1\s0\fR) " 4 .el .IP "``xp1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP1\s0\fR) " 4 .IX Item "xp1 (OSSL_PKEY_PARAM_RSA_TEST_XP1) " .PD 0 .ie n .IP """xp2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP2\s0\fR) " 4 .el .IP "``xp2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XP2\s0\fR) " 4 .IX Item "xp2 (OSSL_PKEY_PARAM_RSA_TEST_XP2) " .ie n .IP """xq1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ1\s0\fR) " 4 .el .IP "``xq1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ1\s0\fR) " 4 .IX Item "xq1 (OSSL_PKEY_PARAM_RSA_TEST_XQ1) " .ie n .IP """xq2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ2\s0\fR) " 4 .el .IP "``xq2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_XQ2\s0\fR) " 4 .IX Item "xq2 (OSSL_PKEY_PARAM_RSA_TEST_XQ2) " .PD These 4 fields are normally randomly generated. The prime factors \*(L"p1\*(R", \*(L"p2\*(R", \&\*(L"q1\*(R" and \*(L"q2\*(R" are determined from these values. .SS "\s-1RSA\s0 key parameters for \s-1FIPS\s0 module testing" .IX Subsection "RSA key parameters for FIPS module testing" The following intermediate values can be retrieved only if the values specified in \*(L"\s-1RSA\s0 key generation parameters for \s-1FIPS\s0 module testing\*(R" are set. These should not be accessed in a production environment. .ie n .IP """p1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_P1\s0\fR) " 4 .el .IP "``p1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_P1\s0\fR) " 4 .IX Item "p1 (OSSL_PKEY_PARAM_RSA_TEST_P1) " .PD 0 .ie n .IP """p2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_P2\s0\fR) " 4 .el .IP "``p2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_P2\s0\fR) " 4 .IX Item "p2 (OSSL_PKEY_PARAM_RSA_TEST_P2) " .ie n .IP """q1"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_Q1\s0\fR) " 4 .el .IP "``q1'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_Q1\s0\fR) " 4 .IX Item "q1 (OSSL_PKEY_PARAM_RSA_TEST_Q1) " .ie n .IP """q2"" (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_Q2\s0\fR) " 4 .el .IP "``q2'' (\fB\s-1OSSL_PKEY_PARAM_RSA_TEST_Q2\s0\fR) " 4 .IX Item "q2 (OSSL_PKEY_PARAM_RSA_TEST_Q2) " .PD The auxiliary probable primes. .SS "\s-1RSA\s0 key validation" .IX Subsection "RSA key validation" For \s-1RSA\s0 keys, \fBEVP_PKEY_param_check\fR\|(3) and \fBEVP_PKEY_param_check_quick\fR\|(3) both return 1 unconditionally. .PP For \s-1RSA\s0 keys, \fBEVP_PKEY_public_check\fR\|(3) conforms to the SP800\-56Br1 \fIpublic key check\fR when the OpenSSL \s-1FIPS\s0 provider is used. The OpenSSL default provider performs similar tests but relaxes the keysize restrictions for backwards compatibility. .PP For \s-1RSA\s0 keys, \fBEVP_PKEY_public_check_quick\fR\|(3) is the same as \&\fBEVP_PKEY_public_check\fR\|(3). .PP For \s-1RSA\s0 keys, \fBEVP_PKEY_private_check\fR\|(3) conforms to the SP800\-56Br1 \&\fIprivate key test\fR. .PP For \s-1RSA\s0 keys, \fBEVP_PKEY_pairwise_check\fR\|(3) conforms to the SP800\-56Br1 \fIKeyPair Validation check\fR for the OpenSSL \s-1FIPS\s0 provider. The OpenSSL default provider allows testing of the validity of multi-primes. .SH "CONFORMING TO" .IX Header "CONFORMING TO" .IP "\s-1FIPS186\-4\s0" 4 .IX Item "FIPS186-4" Section B.3.6 Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes .IP "\s-1RFC 8017,\s0 excluding RSA-PSS and RSA-OAEP" 4 .IX Item "RFC 8017, excluding RSA-PSS and RSA-OAEP" .SH "EXAMPLES" .IX Header "EXAMPLES" An \fB\s-1EVP_PKEY\s0\fR context can be obtained by calling: .PP .Vb 2 \& EVP_PKEY_CTX *pctx = \& EVP_PKEY_CTX_new_from_name(NULL, "RSA", NULL); .Ve .PP An \fB\s-1RSA\s0\fR key can be generated simply like this: .PP .Vb 1 \& pkey = EVP_RSA_gen(4096); .Ve .PP or like this: .PP .Vb 3 \& EVP_PKEY *pkey = NULL; \& EVP_PKEY_CTX *pctx = \& EVP_PKEY_CTX_new_from_name(NULL, "RSA", NULL); \& \& EVP_PKEY_keygen_init(pctx); \& EVP_PKEY_generate(pctx, &pkey); \& EVP_PKEY_CTX_free(pctx); .Ve .PP An \fB\s-1RSA\s0\fR key can be generated with key generation parameters: .PP .Vb 5 \& unsigned int primes = 3; \& unsigned int bits = 4096; \& OSSL_PARAM params[3]; \& EVP_PKEY *pkey = NULL; \& EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, "RSA", NULL); \& \& EVP_PKEY_keygen_init(pctx); \& \& params[0] = OSSL_PARAM_construct_uint("bits", &bits); \& params[1] = OSSL_PARAM_construct_uint("primes", &primes); \& params[2] = OSSL_PARAM_construct_end(); \& EVP_PKEY_CTX_set_params(pctx, params); \& \& EVP_PKEY_generate(pctx, &pkey); \& EVP_PKEY_print_private(bio_out, pkey, 0, NULL); \& EVP_PKEY_CTX_free(pctx); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBEVP_RSA_gen\fR\|(3), \s-1\fBEVP_KEYMGMT\s0\fR\|(3), \s-1\fBEVP_PKEY\s0\fR\|(3), \fBprovider\-keymgmt\fR\|(7) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2020\-2023 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at .