1*660113a2Stb.\" $OpenBSD: RSA_get0_key.3,v 1.8 2025/01/05 15:40:42 tb Exp $ 26f64bd5eSschwarze.\" selective merge up to: OpenSSL 665d899f Aug 2 02:19:43 2017 +0800 36f64bd5eSschwarze.\" 4580f9ab4Sschwarze.\" This file is a derived work. 5580f9ab4Sschwarze.\" The changes are covered by the following Copyright and license: 6580f9ab4Sschwarze.\" 7580f9ab4Sschwarze.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 8580f9ab4Sschwarze.\" 9580f9ab4Sschwarze.\" Permission to use, copy, modify, and distribute this software for any 10580f9ab4Sschwarze.\" purpose with or without fee is hereby granted, provided that the above 11580f9ab4Sschwarze.\" copyright notice and this permission notice appear in all copies. 12580f9ab4Sschwarze.\" 13580f9ab4Sschwarze.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14580f9ab4Sschwarze.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15580f9ab4Sschwarze.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16580f9ab4Sschwarze.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17580f9ab4Sschwarze.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18580f9ab4Sschwarze.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19580f9ab4Sschwarze.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20580f9ab4Sschwarze.\" 21580f9ab4Sschwarze.\" The original file was written by Richard Levitte <levitte@openssl.org> 226f64bd5eSschwarze.\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. 236f64bd5eSschwarze.\" 246f64bd5eSschwarze.\" Redistribution and use in source and binary forms, with or without 256f64bd5eSschwarze.\" modification, are permitted provided that the following conditions 266f64bd5eSschwarze.\" are met: 276f64bd5eSschwarze.\" 286f64bd5eSschwarze.\" 1. Redistributions of source code must retain the above copyright 296f64bd5eSschwarze.\" notice, this list of conditions and the following disclaimer. 306f64bd5eSschwarze.\" 316f64bd5eSschwarze.\" 2. Redistributions in binary form must reproduce the above copyright 326f64bd5eSschwarze.\" notice, this list of conditions and the following disclaimer in 336f64bd5eSschwarze.\" the documentation and/or other materials provided with the 346f64bd5eSschwarze.\" distribution. 356f64bd5eSschwarze.\" 366f64bd5eSschwarze.\" 3. All advertising materials mentioning features or use of this 376f64bd5eSschwarze.\" software must display the following acknowledgment: 386f64bd5eSschwarze.\" "This product includes software developed by the OpenSSL Project 396f64bd5eSschwarze.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 406f64bd5eSschwarze.\" 416f64bd5eSschwarze.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 426f64bd5eSschwarze.\" endorse or promote products derived from this software without 436f64bd5eSschwarze.\" prior written permission. For written permission, please contact 446f64bd5eSschwarze.\" openssl-core@openssl.org. 456f64bd5eSschwarze.\" 466f64bd5eSschwarze.\" 5. Products derived from this software may not be called "OpenSSL" 476f64bd5eSschwarze.\" nor may "OpenSSL" appear in their names without prior written 486f64bd5eSschwarze.\" permission of the OpenSSL Project. 496f64bd5eSschwarze.\" 506f64bd5eSschwarze.\" 6. Redistributions of any form whatsoever must retain the following 516f64bd5eSschwarze.\" acknowledgment: 526f64bd5eSschwarze.\" "This product includes software developed by the OpenSSL Project 536f64bd5eSschwarze.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 546f64bd5eSschwarze.\" 556f64bd5eSschwarze.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 566f64bd5eSschwarze.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 576f64bd5eSschwarze.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 586f64bd5eSschwarze.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 596f64bd5eSschwarze.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 606f64bd5eSschwarze.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 616f64bd5eSschwarze.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 626f64bd5eSschwarze.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 636f64bd5eSschwarze.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 646f64bd5eSschwarze.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 656f64bd5eSschwarze.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 666f64bd5eSschwarze.\" OF THE POSSIBILITY OF SUCH DAMAGE. 676f64bd5eSschwarze.\" 68*660113a2Stb.Dd $Mdocdate: January 5 2025 $ 696f64bd5eSschwarze.Dt RSA_GET0_KEY 3 706f64bd5eSschwarze.Os 716f64bd5eSschwarze.Sh NAME 726f64bd5eSschwarze.Nm RSA_get0_key , 7345f6f80eStb.Nm RSA_get0_n , 7445f6f80eStb.Nm RSA_get0_e , 7545f6f80eStb.Nm RSA_get0_d , 76bbc89669Sschwarze.Nm RSA_set0_key , 77bbc89669Sschwarze.Nm RSA_get0_factors , 7845f6f80eStb.Nm RSA_get0_p , 7945f6f80eStb.Nm RSA_get0_q , 80bbc89669Sschwarze.Nm RSA_set0_factors , 81bbc89669Sschwarze.Nm RSA_get0_crt_params , 8245f6f80eStb.Nm RSA_get0_dmp1 , 8345f6f80eStb.Nm RSA_get0_dmq1 , 8445f6f80eStb.Nm RSA_get0_iqmp , 8575854016Sschwarze.Nm RSA_set0_crt_params , 8675854016Sschwarze.Nm RSA_clear_flags , 8775854016Sschwarze.Nm RSA_test_flags , 8875854016Sschwarze.Nm RSA_set_flags 896f64bd5eSschwarze.Nd get and set data in an RSA object 906f64bd5eSschwarze.Sh SYNOPSIS 916f64bd5eSschwarze.In openssl/rsa.h 926f64bd5eSschwarze.Ft void 936f64bd5eSschwarze.Fo RSA_get0_key 946f64bd5eSschwarze.Fa "const RSA *r" 956f64bd5eSschwarze.Fa "const BIGNUM **n" 966f64bd5eSschwarze.Fa "const BIGNUM **e" 976f64bd5eSschwarze.Fa "const BIGNUM **d" 986f64bd5eSschwarze.Fc 9945f6f80eStb.Ft "const BIGNUM *" 10045f6f80eStb.Fo RSA_get0_n 10145f6f80eStb.Fa "const RSA *r" 10245f6f80eStb.Fc 10345f6f80eStb.Ft "const BIGNUM *" 10445f6f80eStb.Fo RSA_get0_e 10545f6f80eStb.Fa "const RSA *r" 10645f6f80eStb.Fc 10745f6f80eStb.Ft "const BIGNUM *" 10845f6f80eStb.Fo RSA_get0_d 10945f6f80eStb.Fa "const RSA *r" 11045f6f80eStb.Fc 1116f64bd5eSschwarze.Ft int 1126f64bd5eSschwarze.Fo RSA_set0_key 1136f64bd5eSschwarze.Fa "RSA *r" 1146f64bd5eSschwarze.Fa "BIGNUM *n" 1156f64bd5eSschwarze.Fa "BIGNUM *e" 1166f64bd5eSschwarze.Fa "BIGNUM *d" 1176f64bd5eSschwarze.Fc 118bbc89669Sschwarze.Ft void 119bbc89669Sschwarze.Fo RSA_get0_factors 120bbc89669Sschwarze.Fa "const RSA *r" 121bbc89669Sschwarze.Fa "const BIGNUM **p" 122bbc89669Sschwarze.Fa "const BIGNUM **q" 123bbc89669Sschwarze.Fc 12445f6f80eStb.Ft "const BIGNUM *" 12545f6f80eStb.Fo RSA_get0_p 12645f6f80eStb.Fa "const RSA *r" 12745f6f80eStb.Fc 12845f6f80eStb.Ft "const BIGNUM *" 12945f6f80eStb.Fo RSA_get0_q 13045f6f80eStb.Fa "const RSA *r" 13145f6f80eStb.Fc 132bbc89669Sschwarze.Ft int 133bbc89669Sschwarze.Fo RSA_set0_factors 134bbc89669Sschwarze.Fa "RSA *r" 135bbc89669Sschwarze.Fa "BIGNUM *p" 136bbc89669Sschwarze.Fa "BIGNUM *q" 137bbc89669Sschwarze.Fc 138bbc89669Sschwarze.Ft void 139bbc89669Sschwarze.Fo RSA_get0_crt_params 140bbc89669Sschwarze.Fa "const RSA *r" 141bbc89669Sschwarze.Fa "const BIGNUM **dmp1" 142bbc89669Sschwarze.Fa "const BIGNUM **dmq1" 143bbc89669Sschwarze.Fa "const BIGNUM **iqmp" 144bbc89669Sschwarze.Fc 14545f6f80eStb.Ft "const BIGNUM *" 14645f6f80eStb.Fo RSA_get0_dmp1 14745f6f80eStb.Fa "const RSA *r" 14845f6f80eStb.Fc 14945f6f80eStb.Ft "const BIGNUM *" 15045f6f80eStb.Fo RSA_get0_dmq1 15145f6f80eStb.Fa "const RSA *r" 15245f6f80eStb.Fc 15345f6f80eStb.Ft "const BIGNUM *" 15445f6f80eStb.Fo RSA_get0_iqmp 15545f6f80eStb.Fa "const RSA *r" 15645f6f80eStb.Fc 157bbc89669Sschwarze.Ft int 158bbc89669Sschwarze.Fo RSA_set0_crt_params 159bbc89669Sschwarze.Fa "RSA *r" 160bbc89669Sschwarze.Fa "BIGNUM *dmp1" 161bbc89669Sschwarze.Fa "BIGNUM *dmq1" 162bbc89669Sschwarze.Fa "BIGNUM *iqmp" 163bbc89669Sschwarze.Fc 16475854016Sschwarze.Ft void 16575854016Sschwarze.Fo RSA_clear_flags 16675854016Sschwarze.Fa "RSA *r" 16775854016Sschwarze.Fa "int flags" 16875854016Sschwarze.Fc 16975854016Sschwarze.Ft int 17075854016Sschwarze.Fo RSA_test_flags 17175854016Sschwarze.Fa "const RSA *r" 17275854016Sschwarze.Fa "int flags" 17375854016Sschwarze.Fc 17475854016Sschwarze.Ft void 17575854016Sschwarze.Fo RSA_set_flags 17675854016Sschwarze.Fa "RSA *r" 17775854016Sschwarze.Fa "int flags" 17875854016Sschwarze.Fc 1796f64bd5eSschwarze.Sh DESCRIPTION 1806f64bd5eSschwarzeAn 1816f64bd5eSschwarze.Vt RSA 1826f64bd5eSschwarzeobject contains the components for the public and private key. 1836f64bd5eSschwarze.Fa n 1846f64bd5eSschwarzeis the modulus common to both public and private key, 1856f64bd5eSschwarze.Fa e 1866f64bd5eSschwarzeis the public exponent and 1876f64bd5eSschwarze.Fa d 1886f64bd5eSschwarzeis the private exponent. 189bbc89669Sschwarze.Fa p , 190bbc89669Sschwarze.Fa q , 191bbc89669Sschwarze.Fa dmp1 , 192bbc89669Sschwarze.Fa dmq1 , 193bbc89669Sschwarzeand 194bbc89669Sschwarze.Fa iqmp 195bbc89669Sschwarzeare the factors for the second representation of a private key 196bbc89669Sschwarze(see PKCS#1 section 3 Key Types), where 197bbc89669Sschwarze.Fa p 198bbc89669Sschwarzeand 199bbc89669Sschwarze.Fa q 200bbc89669Sschwarzeare the first and second factor of 201bbc89669Sschwarze.Fa n . 202bbc89669Sschwarze.Fa dmp1 , 203bbc89669Sschwarze.Fa dmq1 , 204bbc89669Sschwarzeand 205bbc89669Sschwarze.Fa iqmp 2061e09e4a4Sschwarzeare the exponents and coefficient 2071e09e4a4Sschwarzefor Chinese Remainder Theorem (CRT) calculations. 208bbc89669Sschwarze.Pp 209bbc89669SschwarzeThe 210bbc89669Sschwarze.Fa n , 211bbc89669Sschwarze.Fa e , 212bbc89669Sschwarzeand 213bbc89669Sschwarze.Fa d 214bbc89669Sschwarzeparameters can be obtained by calling 2156f64bd5eSschwarze.Fn RSA_get0_key . 2166f64bd5eSschwarzeIf they have not been set yet, then 2176f64bd5eSschwarze.Pf * Fa n , 2186f64bd5eSschwarze.Pf * Fa e , 2196f64bd5eSschwarzeand 2206f64bd5eSschwarze.Pf * Fa d 221bbc89669Sschwarzeare set to 2226f64bd5eSschwarze.Dv NULL . 2236f64bd5eSschwarzeOtherwise, they are set to pointers to the internal representations 2246f64bd5eSschwarzeof the values that should not be freed by the caller. 2256f64bd5eSschwarze.Pp 2266f64bd5eSschwarzeThe 2276f64bd5eSschwarze.Fa n , 2286f64bd5eSschwarze.Fa e , 2296f64bd5eSschwarzeand 2306f64bd5eSschwarze.Fa d 2316f64bd5eSschwarzeparameter values can be set by calling 2326f64bd5eSschwarze.Fn RSA_set0_key . 2336f64bd5eSschwarzeThe values 2346f64bd5eSschwarze.Fa n 2356f64bd5eSschwarzeand 2366f64bd5eSschwarze.Fa e 2376f64bd5eSschwarzemust be 2386f64bd5eSschwarze.Pf non- Dv NULL 2396f64bd5eSschwarzethe first time this function is called on a given 2406f64bd5eSschwarze.Vt RSA 2416f64bd5eSschwarzeobject. 2426f64bd5eSschwarzeThe value 2436f64bd5eSschwarze.Fa d 2446f64bd5eSschwarzemay be 2456f64bd5eSschwarze.Dv NULL . 2466f64bd5eSschwarzeOn subsequent calls, any of these values may be 2476f64bd5eSschwarze.Dv NULL , 2486f64bd5eSschwarzewhich means that the corresponding field is left untouched. 2496f64bd5eSschwarzeCalling this function transfers the memory management of the values to 2506f64bd5eSschwarzethe RSA object. 2516f64bd5eSschwarzeTherefore, the values that have been passed in 2526f64bd5eSschwarzeshould not be freed by the caller. 2536f64bd5eSschwarze.Pp 254bbc89669SschwarzeIn a similar fashion, the 255bbc89669Sschwarze.Fa p 256bbc89669Sschwarzeand 257bbc89669Sschwarze.Fa q 258bbc89669Sschwarzeparameters can be obtained and set with 259bbc89669Sschwarze.Fn RSA_get0_factors 260bbc89669Sschwarzeand 261bbc89669Sschwarze.Fn RSA_set0_factors , 262bbc89669Sschwarzeand the 263bbc89669Sschwarze.Fa dmp1 , 264bbc89669Sschwarze.Fa dmq1 , 265bbc89669Sschwarzeand 266bbc89669Sschwarze.Fa iqmp 267bbc89669Sschwarzeparameters can be obtained and set with 268bbc89669Sschwarze.Fn RSA_get0_crt_params 269bbc89669Sschwarzeand 270bbc89669Sschwarze.Fn RSA_set0_crt_params . 271bbc89669Sschwarze.Pp 272bbc89669SschwarzeFor 273bbc89669Sschwarze.Fn RSA_get0_key , 274bbc89669Sschwarze.Fn RSA_get0_factors , 275bbc89669Sschwarzeand 276bbc89669Sschwarze.Fn RSA_get0_crt_params , 277bbc89669Sschwarze.Dv NULL 278bbc89669Sschwarzevalue 279bbc89669Sschwarze.Vt BIGNUM ** 280bbc89669Sschwarzeoutput arguments are permitted. 281bbc89669SschwarzeThe functions 282bbc89669Sschwarzeignore 283bbc89669Sschwarze.Dv NULL 284bbc89669Sschwarzearguments but return values for other, 285bbc89669Sschwarze.Pf non- Dv NULL , 286bbc89669Sschwarzearguments. 287bbc89669Sschwarze.Pp 2886f64bd5eSschwarzeValues retrieved with 289bbc89669Sschwarze.Fn RSA_get0_key , 290bbc89669Sschwarze.Fn RSA_get0_factors , 291bbc89669Sschwarzeand 292bbc89669Sschwarze.Fn RSA_get0_crt_params 2936f64bd5eSschwarzeare owned by the 2946f64bd5eSschwarze.Vt RSA 2956f64bd5eSschwarzeobject used in the call and may therefore 2966f64bd5eSschwarze.Em not 2976f64bd5eSschwarzebe passed to 298bbc89669Sschwarze.Fn RSA_set0_key , 299bbc89669Sschwarze.Fn RSA_set0_factors , 300bbc89669Sschwarzeor 301bbc89669Sschwarze.Fn RSA_set0_crt_params . 3026f64bd5eSschwarzeIf needed, duplicate the received value using 3036f64bd5eSschwarze.Xr BN_dup 3 3046f64bd5eSschwarzeand pass the duplicate. 30575854016Sschwarze.Pp 30645f6f80eStbAny of the values 30745f6f80eStb.Fa n , 30845f6f80eStb.Fa e , 30945f6f80eStb.Fa d , 31045f6f80eStb.Fa p , 31145f6f80eStb.Fa q , 31245f6f80eStb.Fa dmp1 , 31345f6f80eStb.Fa dmq1 , 31445f6f80eStband 31545f6f80eStb.Fa iqmp 31645f6f80eStbcan also be retrieved separately by the corresponding functions 31745f6f80eStb.Fn RSA_get0_n , 31845f6f80eStb.Fn RSA_get0_e , 31945f6f80eStb.Fn RSA_get0_d , 32045f6f80eStb.Fn RSA_get0_p , 32145f6f80eStb.Fn RSA_get0_q , 32245f6f80eStb.Fn RSA_get0_dmp1 , 32345f6f80eStb.Fn RSA_get0_dmq1 , 32445f6f80eStband 32545f6f80eStb.Fn RSA_get0_iqmp , 32645f6f80eStbrespectively. 32745f6f80eStbThe pointers are owned by the 32845f6f80eStb.Vt RSA 32945f6f80eStbobject. 33045f6f80eStb.Pp 33175854016Sschwarze.Fn RSA_clear_flags 33275854016Sschwarzeclears the specified 33375854016Sschwarze.Fa flags 33475854016Sschwarzein 33575854016Sschwarze.Fa r . 33675854016Sschwarze.Fn RSA_test_flags 33775854016Sschwarzetests the 33875854016Sschwarze.Fa flags 33975854016Sschwarzein 34075854016Sschwarze.Fa r . 34175854016Sschwarze.Fn RSA_set_flags 34275854016Sschwarzesets the 34375854016Sschwarze.Fa flags 34475854016Sschwarzein 34575854016Sschwarze.Fa r ; 34675854016Sschwarzeany flags already set remain set. 34775854016SschwarzeFor all three functions, multiple flags can be passed in one call, 34875854016SschwarzeOR'ed together bitwise. 349580f9ab4Sschwarze.Pp 350580f9ab4SschwarzeThe following flags are supported: 351580f9ab4Sschwarze.Bl -tag -width Ds 352580f9ab4Sschwarze.It Dv RSA_FLAG_CACHE_PRIVATE No and Dv RSA_FLAG_CACHE_PUBLIC 353580f9ab4SschwarzePrecompute information needed for Montgomery multiplication 354580f9ab4Sschwarzefrom the private and public key, respectively, and cache it in 355580f9ab4Sschwarze.Fa r 356580f9ab4Sschwarzefor repeated use. 357580f9ab4SschwarzeThese two flags are set by default for the default RSA implementation, 358580f9ab4Sschwarze.Xr RSA_PKCS1_SSLeay 3 . 359580f9ab4Sschwarze.It Dv RSA_FLAG_EXT_PKEY 360580f9ab4SschwarzeThe function set with 361580f9ab4Sschwarze.Xr RSA_meth_set_mod_exp 3 362580f9ab4Sschwarzeis used for private key operations even if 363580f9ab4Sschwarze.Fa p , 364580f9ab4Sschwarze.Fa q , 365580f9ab4Sschwarze.Fa dmp1 , 366580f9ab4Sschwarze.Fa dmq1 , 367580f9ab4Sschwarzeand 368580f9ab4Sschwarze.Fa iqmp 369580f9ab4Sschwarzeare all 370580f9ab4Sschwarze.Dv NULL . 371580f9ab4SschwarzeThis flag may be useful with RSA implementations that do not use the 372580f9ab4Sschwarzeprivate key components stored in the standard fields, for example 373580f9ab4Sschwarzebecause they store the private key in external hardware. 374580f9ab4SschwarzeIf this flag is unset, the function set with 375580f9ab4Sschwarze.Xr RSA_meth_set_bn_mod_exp 3 376580f9ab4Sschwarzeis used with 377580f9ab4Sschwarze.Fa n 378580f9ab4Sschwarzeand 379580f9ab4Sschwarze.Fa d 380580f9ab4Sschwarzeinstead. 381580f9ab4Sschwarze.It Dv RSA_FLAG_NO_BLINDING 382580f9ab4SschwarzeTurn off blinding during private key encryption and decryption. 383580f9ab4SschwarzeThis flag is set by 384580f9ab4Sschwarze.Xr RSA_blinding_off 3 . 385580f9ab4Sschwarze.It Dv RSA_FLAG_SIGN_VER 386*660113a2StbThis flag has no effect. 387*660113a2StbIt is provided only for backward compatibility with legacy applications. 388580f9ab4Sschwarze.El 389580f9ab4Sschwarze.Pp 390580f9ab4SschwarzeThe flags 391580f9ab4Sschwarze.Dv RSA_FLAG_BLINDING , 392580f9ab4Sschwarze.Dv RSA_FLAG_CHECKED , 393580f9ab4Sschwarze.Dv RSA_FLAG_FIPS_METHOD , 394580f9ab4Sschwarze.Dv RSA_FLAG_NON_FIPS_ALLOW , 395580f9ab4Sschwarzeand 396580f9ab4Sschwarze.Dv RSA_FLAG_THREAD_SAFE 397580f9ab4Sschwarzeare defined for compatibility with existing code but have no effect. 3986f64bd5eSschwarze.Sh RETURN VALUES 39945f6f80eStb.Fn RSA_get0_n , 40045f6f80eStb.Fn RSA_get0_e , 40145f6f80eStb.Fn RSA_get0_d , 40245f6f80eStb.Fn RSA_get0_p , 40345f6f80eStb.Fn RSA_get0_q , 40445f6f80eStb.Fn RSA_get0_dmp1 , 40545f6f80eStb.Fn RSA_get0_dmq1 , 40645f6f80eStband 40745f6f80eStb.Fn RSA_get0_iqmp 40845f6f80eStbreturn a pointer owned by the 40945f6f80eStb.Vt RSA 41045f6f80eStbobject if the corresponding value has been set, 41145f6f80eStbotherwise they return 41245f6f80eStb.Dv NULL . 41345f6f80eStb.Pp 414bbc89669Sschwarze.Fn RSA_set0_key , 415bbc89669Sschwarze.Fn RSA_set0_factors , 416bbc89669Sschwarzeand 417bbc89669Sschwarze.Fn RSA_set0_crt_params 418bbc89669Sschwarzereturn 1 on success or 0 on failure. 41975854016Sschwarze.Pp 42075854016Sschwarze.Fn RSA_test_flags 42175854016Sschwarzereturns those of the given 42275854016Sschwarze.Fa flags 42375854016Sschwarzecurrently set in 42475854016Sschwarze.Fa r 42575854016Sschwarzeor 0 if none of the given 42675854016Sschwarze.Fa flags 42775854016Sschwarzeare set. 4286f64bd5eSschwarze.Sh SEE ALSO 4296f64bd5eSschwarze.Xr RSA_check_key 3 , 4306f64bd5eSschwarze.Xr RSA_generate_key 3 , 4316f64bd5eSschwarze.Xr RSA_new 3 , 4326f64bd5eSschwarze.Xr RSA_print 3 , 4336f64bd5eSschwarze.Xr RSA_size 3 4346f64bd5eSschwarze.Sh HISTORY 43545f6f80eStb.Fn RSA_get0_key , 43645f6f80eStb.Fn RSA_set0_key , 43745f6f80eStb.Fn RSA_get0_factors , 43845f6f80eStb.Fn RSA_set0_factors , 43945f6f80eStb.Fn RSA_get0_crt_params , 44045f6f80eStb.Fn RSA_set0_crt_params , 44145f6f80eStb.Fn RSA_clear_flags , 44245f6f80eStb.Fn RSA_test_flags , 44345f6f80eStband 44445f6f80eStb.Fn RSA_set_flags 44545f6f80eStbfirst appeared in OpenSSL 1.1.0 4464b12da35Sschwarzeand have been available since 4474b12da35Sschwarze.Ox 6.3 . 44845f6f80eStb.Pp 44945f6f80eStb.Fn RSA_get0_n , 45045f6f80eStb.Fn RSA_get0_e , 45145f6f80eStb.Fn RSA_get0_d , 45245f6f80eStb.Fn RSA_get0_p , 45345f6f80eStb.Fn RSA_get0_q , 45445f6f80eStb.Fn RSA_get0_dmp1 , 45545f6f80eStb.Fn RSA_get0_dmq1 , 45645f6f80eStband 45745f6f80eStb.Fn RSA_get0_iqmp 45845f6f80eStbfirst appeared in OpenSSL 1.1.1 45945f6f80eStband have been available since 46045f6f80eStb.Ox 7.1 . 461