1RSA_GET0_KEY(3ossl)                 OpenSSL                RSA_GET0_KEY(3ossl)
2
3
4

NAME

6       RSA_set0_key, RSA_set0_factors, RSA_set0_crt_params, RSA_get0_key,
7       RSA_get0_factors, RSA_get0_crt_params, RSA_get0_n, RSA_get0_e,
8       RSA_get0_d, RSA_get0_p, RSA_get0_q, RSA_get0_dmp1, RSA_get0_dmq1,
9       RSA_get0_iqmp, RSA_get0_pss_params, RSA_clear_flags, RSA_test_flags,
10       RSA_set_flags, RSA_get0_engine, RSA_get_multi_prime_extra_count,
11       RSA_get0_multi_prime_factors, RSA_get0_multi_prime_crt_params,
12       RSA_set0_multi_prime_params, RSA_get_version - Routines for getting and
13       setting data in an RSA object
14

SYNOPSIS

16        #include <openssl/rsa.h>
17
18       The following functions have been deprecated since OpenSSL 3.0, and can
19       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
20       version value, see openssl_user_macros(7):
21
22        int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
23        int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
24        int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
25        void RSA_get0_key(const RSA *r,
26                          const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
27        void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
28        void RSA_get0_crt_params(const RSA *r,
29                                 const BIGNUM **dmp1, const BIGNUM **dmq1,
30                                 const BIGNUM **iqmp);
31        const BIGNUM *RSA_get0_n(const RSA *d);
32        const BIGNUM *RSA_get0_e(const RSA *d);
33        const BIGNUM *RSA_get0_d(const RSA *d);
34        const BIGNUM *RSA_get0_p(const RSA *d);
35        const BIGNUM *RSA_get0_q(const RSA *d);
36        const BIGNUM *RSA_get0_dmp1(const RSA *r);
37        const BIGNUM *RSA_get0_dmq1(const RSA *r);
38        const BIGNUM *RSA_get0_iqmp(const RSA *r);
39        const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r);
40        void RSA_clear_flags(RSA *r, int flags);
41        int RSA_test_flags(const RSA *r, int flags);
42        void RSA_set_flags(RSA *r, int flags);
43        ENGINE *RSA_get0_engine(RSA *r);
44        int RSA_get_multi_prime_extra_count(const RSA *r);
45        int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]);
46        int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[],
47                                            const BIGNUM *coeffs[]);
48        int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[],
49                                       BIGNUM *coeffs[], int pnum);
50        int RSA_get_version(RSA *r);
51

DESCRIPTION

53       All of the functions described on this page are deprecated.
54       Applications should instead use EVP_PKEY_get_bn_param(3) for any
55       methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more
56       information.
57
58       An RSA object contains the components for the public and private key,
59       n, e, d, p, q, dmp1, dmq1 and iqmp.  n is the modulus common to both
60       public and private key, e is the public exponent and d is the private
61       exponent.  p, q, dmp1, dmq1 and iqmp are the factors for the second
62       representation of a private key (see PKCS#1 section 3 Key Types), where
63       p and q are the first and second factor of n and dmp1, dmq1 and iqmp
64       are the exponents and coefficient for CRT calculations.
65
66       For multi-prime RSA (defined in RFC 8017), there are also one or more
67       'triplet' in an RSA object. A triplet contains three members, r, d and
68       t. r is the additional prime besides p and q. d and t are the exponent
69       and coefficient for CRT calculations.
70
71       The n, e and d parameters can be obtained by calling RSA_get0_key().
72       If they have not been set yet, then *n, *e and *d will be set to NULL.
73       Otherwise, they are set to pointers to their respective values. These
74       point directly to the internal representations of the values and
75       therefore should not be freed by the caller.
76
77       The n, e and d parameter values can be set by calling RSA_set0_key()
78       and passing the new values for n, e and d as parameters to the
79       function.  The values n and e must be non-NULL the first time this
80       function is called on a given RSA object. The value d may be NULL. On
81       subsequent calls any of these values may be NULL which means the
82       corresponding RSA field is left untouched.  Calling this function
83       transfers the memory management of the values to the RSA object, and
84       therefore the values that have been passed in should not be freed by
85       the caller after this function has been called.
86
87       In a similar fashion, the p and q parameters can be obtained and set
88       with RSA_get0_factors() and RSA_set0_factors(), and the dmp1, dmq1 and
89       iqmp parameters can be obtained and set with RSA_get0_crt_params() and
90       RSA_set0_crt_params().
91
92       For RSA_get0_key(), RSA_get0_factors(), and RSA_get0_crt_params(), NULL
93       value BIGNUM ** output parameters are permitted. The functions ignore
94       NULL parameters but return values for other, non-NULL, parameters.
95
96       For multi-prime RSA, RSA_get0_multi_prime_factors() and
97       RSA_get0_multi_prime_params() can be used to obtain other primes and
98       related CRT parameters. The return values are stored in an array of
99       BIGNUM *. RSA_set0_multi_prime_params() sets a collect of multi-prime
100       'triplet' members (prime, exponent and coefficient) into an RSA object.
101
102       Any of the values n, e, d, p, q, dmp1, dmq1, and iqmp can also be
103       retrieved separately by the corresponding function RSA_get0_n(),
104       RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(),
105       RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp(), respectively.
106
107       RSA_get0_pss_params() is used to retrieve the RSA-PSS parameters.
108
109       RSA_set_flags() sets the flags in the flags parameter on the RSA
110       object. Multiple flags can be passed in one go (bitwise ORed together).
111       Any flags that are already set are left set. RSA_test_flags() tests to
112       see whether the flags passed in the flags parameter are currently set
113       in the RSA object. Multiple flags can be tested in one go. All flags
114       that are currently set are returned, or zero if none of the flags are
115       set. RSA_clear_flags() clears the specified flags within the RSA
116       object.
117
118       RSA_get0_engine() returns a handle to the ENGINE that has been set for
119       this RSA object, or NULL if no such ENGINE has been set.
120
121       RSA_get_version() returns the version of an RSA object r.
122

NOTES

124       Values retrieved with RSA_get0_key() are owned by the RSA object used
125       in the call and may therefore not be passed to RSA_set0_key().  If
126       needed, duplicate the received value using BN_dup() and pass the
127       duplicate.  The same applies to RSA_get0_factors() and
128       RSA_set0_factors() as well as RSA_get0_crt_params() and
129       RSA_set0_crt_params().
130
131       The caller should obtain the size by calling
132       RSA_get_multi_prime_extra_count() in advance and allocate sufficient
133       buffer to store the return values before calling
134       RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_params().
135
136       RSA_set0_multi_prime_params() always clears the original multi-prime
137       triplets in RSA object r and assign the new set of triplets into it.
138

RETURN VALUES

140       RSA_set0_key(), RSA_set0_factors(), RSA_set0_crt_params() and
141       RSA_set0_multi_prime_params() return 1 on success or 0 on failure.
142
143       RSA_get0_n(), RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(),
144       RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp() return the
145       respective value.
146
147       RSA_get0_pss_params() returns a RSA_PSS_PARAMS pointer, or NULL if
148       there is none.
149
150       RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_crt_params()
151       return 1 on success or 0 on failure.
152
153       RSA_get_multi_prime_extra_count() returns two less than the number of
154       primes in use, which is 0 for traditional RSA and the number of extra
155       primes for multi-prime RSA.
156
157       RSA_get_version() returns RSA_ASN1_VERSION_MULTI for multi-prime RSA
158       and RSA_ASN1_VERSION_DEFAULT for normal two-prime RSA, as defined in
159       RFC 8017.
160
161       RSA_test_flags() returns the current state of the flags in the RSA
162       object.
163
164       RSA_get0_engine() returns the ENGINE set for the RSA object or NULL if
165       no ENGINE has been set.
166

SEE ALSO

168       RSA_new(3), RSA_size(3)
169

HISTORY

171       The RSA_get0_pss_params() function was added in OpenSSL 1.1.1e.
172
173       The RSA_get_multi_prime_extra_count(), RSA_get0_multi_prime_factors(),
174       RSA_get0_multi_prime_crt_params(), RSA_set0_multi_prime_params(), and
175       RSA_get_version() functions were added in OpenSSL 1.1.1.
176
177       Other functions described here were added in OpenSSL 1.1.0.
178
179       All of these functions were deprecated in OpenSSL 3.0.
180
182       Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
183
184       Licensed under the Apache License 2.0 (the "License").  You may not use
185       this file except in compliance with the License.  You can obtain a copy
186       in the file LICENSE in the source distribution or at
187       <https://www.openssl.org/source/license.html>.
188
189
190
1913.1.1                             2023-08-31               RSA_GET0_KEY(3ossl)
Impressum