OpenBSD manual page server

Manual Page Search Parameters

D2I_RSAPUBLICKEY(3) Library Functions Manual D2I_RSAPUBLICKEY(3)

d2i_RSAPublicKey, i2d_RSAPublicKey, d2i_RSAPrivateKey, i2d_RSAPrivateKey, d2i_Netscape_RSA, i2d_Netscape_RSA, d2i_RSA_PSS_PARAMS, i2d_RSA_PSS_PARAMS, d2i_RSAPublicKey_bio, d2i_RSAPublicKey_fp, i2d_RSAPublicKey_bio, i2d_RSAPublicKey_fp, d2i_RSAPrivateKey_bio, d2i_RSAPrivateKey_fp, i2d_RSAPrivateKey_bio, i2d_RSAPrivateKey_fp, d2i_RSA_PUBKEY, i2d_RSA_PUBKEY, d2i_RSA_PUBKEY_bio, d2i_RSA_PUBKEY_fp, i2d_RSA_PUBKEY_bio, i2d_RSA_PUBKEY_fpdecode and encode RSA keys and parameters

#include <openssl/rsa.h>

RSA *
d2i_RSAPublicKey(RSA **val_out, const unsigned char **der_in, long length);

int
i2d_RSAPublicKey(RSA *val_in, unsigned char **der_out);

RSA *
d2i_RSAPrivateKey(RSA **val_out, const unsigned char **der_in, long length);

int
i2d_RSAPrivateKey(RSA *val_in, unsigned char **der_out);

RSA *
d2i_Netscape_RSA(RSA **val_out, const unsigned char **der_in, long length, int (*cb)());

int
i2d_Netscape_RSA(RSA *val_in, unsigned char **der_out, int (*cb)());

RSA_PSS_PARAMS *
d2i_RSA_PSS_PARAMS(RSA_PSS_PARAMS **val_out, const unsigned char **der_in, long length);

int
i2d_RSA_PSS_PARAMS(RSA_PSS_PARAMS *val_in, unsigned char **der_out);

#include <openssl/x509.h>

RSA *
d2i_RSAPublicKey_bio(BIO *in_bio, RSA **val_out);

RSA *
d2i_RSAPublicKey_fp(FILE *in_fp, RSA **val_out);

int
i2d_RSAPublicKey_bio(BIO *out_bio, RSA *val_in);

int
i2d_RSAPublicKey_fp(FILE *out_fp, RSA *val_in);

RSA *
d2i_RSAPrivateKey_bio(BIO *in_bio, RSA **val_out);

RSA *
d2i_RSAPrivateKey_fp(FILE *in_fp, RSA **val_out);

int
i2d_RSAPrivateKey_bio(BIO *out_bio, RSA *val_in);

int
i2d_RSAPrivateKey_fp(FILE *out_fp, RSA *val_in);

RSA *
d2i_RSA_PUBKEY(RSA **val_out, const unsigned char **der_in, long length);

int
i2d_RSA_PUBKEY(RSA *val_in, unsigned char **der_out);

RSA *
d2i_RSA_PUBKEY_bio(BIO *in_bio, RSA **val_out);

RSA *
d2i_RSA_PUBKEY_fp(FILE *in_fp, RSA **val_out);

int
i2d_RSA_PUBKEY_bio(BIO *out_bio, RSA *val_in);

int
i2d_RSA_PUBKEY_fp(FILE *out_fp, RSA *val_in);

These functions decode and encode RSA private and public keys. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

() and () decode and encode a PKCS#1 RSAPublicKey structure defined in RFC 8017 appendix A.1.1. (), (), (), and () are similar except that they decode or encode using a BIO or FILE pointer.

() and () decode and encode a PKCS#1 RSAPrivateKey structure defined in RFC 8017 appendix A.1.2. The RSA structure passed to the private key encoding functions should have all the PKCS#1 private key components present. The data encoded by the private key functions is unencrypted and therefore offers no private key security. (), (), (), and () are similar except that they decode or encode using a BIO or FILE pointer.

() and () decode and encode an RSA private key in NET format. These functions are present to provide compatibility with certain very old software. The NET format has some severe security weaknesses and should be avoided if possible.

() and () decode and encode a PKCS#1 RSASSA-PSS-params structure defined in RFC 8017 appendix A.2.3 and documented in RSA_PSS_PARAMS_new(3).

() and () decode and encode an RSA public key using an ASN.1 SubjectPublicKeyInfo structure defined in RFC 5280 section 4.1 and documented in X509_PUBKEY_new(3). (), (), (), and () are similar except that they decode or encode using a BIO or FILE pointer.

d2i_RSAPublicKey(), d2i_RSAPublicKey_bio(), d2i_RSAPublicKey_fp(), d2i_RSAPrivateKey(), d2i_RSAPrivateKey_bio(), d2i_RSAPrivateKey_fp(), d2i_Netscape_RSA(), d2i_RSA_PUBKEY(), d2i_RSA_PUBKEY_bio(), and d2i_RSA_PUBKEY_fp() return a valid RSA object or NULL if an error occurs.

d2i_RSA_PSS_PARAMS() returns a valid RSA_PSS_PARAMS object or NULL if an error occurs.

i2d_RSAPublicKey(), i2d_RSAPrivateKey(), i2d_Netscape_RSA(), i2d_RSA_PSS_PARAMS(), and i2d_RSA_PUBKEY() return the number of bytes successfully encoded or a negative value if an error occurs.

i2d_RSAPublicKey_bio(), i2d_RSAPublicKey_fp(), i2d_RSAPrivateKey_bio(), i2d_RSAPrivateKey_fp(), i2d_RSA_PUBKEY_bio(), and i2d_RSA_PUBKEY_fp() return 1 for success or 0 if an error occurs.

ASN1_item_d2i(3), EVP_PKEY_set1_RSA(3), PEM_write_RSAPrivateKey(3), RSA_new(3), RSA_PSS_PARAMS_new(3), X509_PUBKEY_new(3)

RFC 8017: PKCS #1: RSA Cryptography Specifications

RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, section 4.1: Basic Certificate Fields

d2i_RSAPublicKey(), i2d_RSAPublicKey(), d2i_RSAPrivateKey(), i2d_RSAPrivateKey(), d2i_RSAPrivateKey_fp(), i2d_RSAPrivateKey_fp(), d2i_Netscape_RSA(), and i2d_Netscape_RSA() first appeared in SSLeay 0.5.1. d2i_RSAPrivateKey_bio() and i2d_RSAPrivateKey_bio() first appeared in SSLeay 0.6.0. d2i_RSAPublicKey_bio(), d2i_RSAPublicKey_fp(), i2d_RSAPublicKey_bio(), and i2d_RSAPublicKey_fp() first appeared in SSLeay 0.8.1. These functions have been available since OpenBSD 2.4.

d2i_RSA_PUBKEY(), i2d_RSA_PUBKEY(), d2i_RSA_PUBKEY_bio(), d2i_RSA_PUBKEY_fp(), i2d_RSA_PUBKEY_bio(), and i2d_RSA_PUBKEY_fp() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.

d2i_RSA_PSS_PARAMS() and i2d_RSA_PSS_PARAMS() first appeared in OpenSSL 1.0.1 and have been available since OpenBSD 5.3.

March 27, 2018 OpenBSD-7.3