1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos DECLARE_PEM_rw, 6 1.1 christos PEM_read_CMS, 7 1.1 christos PEM_read_bio_CMS, 8 1.1 christos PEM_write_CMS, 9 1.1 christos PEM_write_bio_CMS, 10 1.1 christos PEM_write_DHxparams, 11 1.1 christos PEM_write_bio_DHxparams, 12 1.1 christos PEM_read_ECPKParameters, 13 1.1 christos PEM_read_bio_ECPKParameters, 14 1.1 christos PEM_write_ECPKParameters, 15 1.1 christos PEM_write_bio_ECPKParameters, 16 1.1 christos PEM_read_ECPrivateKey, 17 1.1 christos PEM_write_ECPrivateKey, 18 1.1 christos PEM_write_bio_ECPrivateKey, 19 1.1 christos PEM_read_EC_PUBKEY, 20 1.1 christos PEM_read_bio_EC_PUBKEY, 21 1.1 christos PEM_write_EC_PUBKEY, 22 1.1 christos PEM_write_bio_EC_PUBKEY, 23 1.1 christos PEM_read_NETSCAPE_CERT_SEQUENCE, 24 1.1 christos PEM_read_bio_NETSCAPE_CERT_SEQUENCE, 25 1.1 christos PEM_write_NETSCAPE_CERT_SEQUENCE, 26 1.1 christos PEM_write_bio_NETSCAPE_CERT_SEQUENCE, 27 1.1 christos PEM_read_PKCS8, 28 1.1 christos PEM_read_bio_PKCS8, 29 1.1 christos PEM_write_PKCS8, 30 1.1 christos PEM_write_bio_PKCS8, 31 1.1 christos PEM_write_PKCS8_PRIV_KEY_INFO, 32 1.1 christos PEM_read_bio_PKCS8_PRIV_KEY_INFO, 33 1.1 christos PEM_read_PKCS8_PRIV_KEY_INFO, 34 1.1 christos PEM_write_bio_PKCS8_PRIV_KEY_INFO, 35 1.1 christos PEM_read_SSL_SESSION, 36 1.1 christos PEM_read_bio_SSL_SESSION, 37 1.1 christos PEM_write_SSL_SESSION, 38 1.1.1.2 christos PEM_write_bio_SSL_SESSION, 39 1.1.1.2 christos PEM_read_X509_PUBKEY, 40 1.1.1.2 christos PEM_read_bio_X509_PUBKEY, 41 1.1.1.2 christos PEM_write_X509_PUBKEY, 42 1.1.1.2 christos PEM_write_bio_X509_PUBKEY 43 1.1 christos - PEM object encoding routines 44 1.1 christos 45 1.1 christos =head1 SYNOPSIS 46 1.1 christos 47 1.1.1.2 christos =for openssl generic 48 1.1 christos 49 1.1 christos #include <openssl/pem.h> 50 1.1 christos 51 1.1 christos DECLARE_PEM_rw(name, TYPE) 52 1.1 christos 53 1.1 christos TYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u); 54 1.1 christos TYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u); 55 1.1 christos int PEM_write_TYPE(FILE *fp, const TYPE *a); 56 1.1 christos int PEM_write_bio_TYPE(BIO *bp, const TYPE *a); 57 1.1 christos 58 1.1.1.2 christos The following functions have been deprecated since OpenSSL 3.0, and can be 59 1.1.1.2 christos hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 60 1.1.1.2 christos see L<openssl_user_macros(7)>: 61 1.1.1.2 christos 62 1.1.1.2 christos #include <openssl/pem.h> 63 1.1.1.2 christos 64 1.1.1.2 christos int PEM_write_DHxparams(FILE *out, const DH *dh); 65 1.1.1.2 christos int PEM_write_bio_DHxparams(BIO *out, const DH *dh); 66 1.1.1.2 christos EC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u); 67 1.1.1.2 christos EC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u); 68 1.1.1.2 christos int PEM_write_ECPKParameters(FILE *out, const EC_GROUP *x); 69 1.1.1.2 christos int PEM_write_bio_ECPKParameters(BIO *out, const EC_GROUP *x), 70 1.1.1.2 christos 71 1.1.1.2 christos EC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u); 72 1.1.1.2 christos EC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u); 73 1.1.1.2 christos int PEM_write_EC_PUBKEY(FILE *out, const EC_KEY *x); 74 1.1.1.2 christos int PEM_write_bio_EC_PUBKEY(BIO *out, const EC_KEY *x); 75 1.1.1.2 christos 76 1.1.1.2 christos EC_KEY *PEM_read_ECPrivateKey(FILE *out, EC_KEY **x, pem_password_cb *cb, void *u); 77 1.1.1.2 christos EC_KEY *PEM_read_bio_ECPrivateKey(BIO *out, EC_KEY **x, pem_password_cb *cb, void *u); 78 1.1.1.2 christos int PEM_write_ECPrivateKey(FILE *out, const EC_KEY *x, const EVP_CIPHER *enc, 79 1.1.1.2 christos const unsigned char *kstr, int klen, 80 1.1.1.2 christos pem_password_cb *cb, void *u); 81 1.1.1.2 christos int PEM_write_bio_ECPrivateKey(BIO *out, const EC_KEY *x, const EVP_CIPHER *enc, 82 1.1.1.2 christos const unsigned char *kstr, int klen, 83 1.1.1.2 christos pem_password_cb *cb, void *u); 84 1.1.1.2 christos 85 1.1 christos =head1 DESCRIPTION 86 1.1 christos 87 1.1.1.2 christos All of the functions described on this page are deprecated. 88 1.1.1.2 christos Applications should use OSSL_ENCODER_to_bio() and OSSL_DECODER_from_bio() 89 1.1.1.2 christos instead. 90 1.1.1.2 christos 91 1.1.1.2 christos In the description below, B<I<TYPE>> is used 92 1.1.1.2 christos as a placeholder for any of the OpenSSL datatypes, such as B<X509>. 93 1.1 christos The macro B<DECLARE_PEM_rw> expands to the set of declarations shown in 94 1.1 christos the next four lines of the synopsis. 95 1.1 christos 96 1.1 christos These routines convert between local instances of ASN1 datatypes and 97 1.1 christos the PEM encoding. For more information on the templates, see 98 1.1 christos L<ASN1_ITEM(3)>. For more information on the lower-level routines used 99 1.1 christos by the functions here, see L<PEM_read(3)>. 100 1.1 christos 101 1.1.1.2 christos B<PEM_read_I<TYPE>>() reads a PEM-encoded object of B<I<TYPE>> from the file 102 1.1.1.2 christos I<fp> and returns it. The I<cb> and I<u> parameters are as described in 103 1.1 christos L<pem_password_cb(3)>. 104 1.1 christos 105 1.1.1.2 christos B<PEM_read_bio_I<TYPE>>() is similar to B<PEM_read_I<TYPE>>() but reads from 106 1.1.1.2 christos the BIO I<bp>. 107 1.1 christos 108 1.1.1.2 christos B<PEM_write_I<TYPE>>() writes the PEM encoding of the object I<a> to the file 109 1.1.1.2 christos I<fp>. 110 1.1 christos 111 1.1.1.2 christos B<PEM_write_bio_I<TYPE>>() similarly writes to the BIO I<bp>. 112 1.1 christos 113 1.1 christos =head1 NOTES 114 1.1 christos 115 1.1 christos These functions make no assumption regarding the pass phrase received from the 116 1.1 christos password callback. 117 1.1 christos It will simply be treated as a byte sequence. 118 1.1 christos 119 1.1 christos =head1 RETURN VALUES 120 1.1 christos 121 1.1.1.2 christos B<PEM_read_I<TYPE>>() and B<PEM_read_bio_I<TYPE>>() return a pointer to an 122 1.1.1.2 christos allocated object, which should be released by calling B<I<TYPE>_free>(), or 123 1.1.1.2 christos NULL on error. 124 1.1 christos 125 1.1.1.3 christos B<PEM_write_I<TYPE>>() and B<PEM_write_bio_I<TYPE>>() return 1 for success or 0 for failure. 126 1.1 christos 127 1.1 christos =head1 SEE ALSO 128 1.1 christos 129 1.1 christos L<PEM_read(3)>, 130 1.1 christos L<passphrase-encoding(7)> 131 1.1 christos 132 1.1.1.2 christos =head1 HISTORY 133 1.1.1.2 christos 134 1.1.1.2 christos The functions PEM_write_DHxparams(), PEM_write_bio_DHxparams(), 135 1.1.1.2 christos PEM_read_ECPKParameters(), PEM_read_bio_ECPKParameters(), 136 1.1.1.2 christos PEM_write_ECPKParameters(), PEM_write_bio_ECPKParameters(), 137 1.1.1.2 christos PEM_read_EC_PUBKEY(), PEM_read_bio_EC_PUBKEY(), 138 1.1.1.2 christos PEM_write_EC_PUBKEY(), PEM_write_bio_EC_PUBKEY(), 139 1.1.1.2 christos PEM_read_ECPrivateKey(), PEM_read_bio_ECPrivateKey(), 140 1.1.1.2 christos PEM_write_ECPrivateKey() and PEM_write_bio_ECPrivateKey() 141 1.1.1.2 christos were deprecated in OpenSSL 3.0. 142 1.1.1.2 christos 143 1.1 christos =head1 COPYRIGHT 144 1.1 christos 145 1.1.1.3 christos Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved. 146 1.1 christos 147 1.1.1.2 christos Licensed under the Apache License 2.0 (the "License"). You may not use 148 1.1 christos this file except in compliance with the License. You can obtain a copy 149 1.1 christos in the file LICENSE in the source distribution or at 150 1.1 christos L<https://www.openssl.org/source/license.html>. 151 1.1 christos 152 1.1 christos =cut 153