| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "PEM_READ_CMS 3SSL" |
| 58 |
.TH PEM_READ_CMS 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
DECLARE_PEM_rw, |
| 65 |
PEM_read_CMS, |
| 66 |
PEM_read_bio_CMS, |
| 67 |
PEM_write_CMS, |
| 68 |
PEM_write_bio_CMS, |
| 69 |
PEM_write_DHxparams, |
| 70 |
PEM_write_bio_DHxparams, |
| 71 |
PEM_read_ECPKParameters, |
| 72 |
PEM_read_bio_ECPKParameters, |
| 73 |
PEM_write_ECPKParameters, |
| 74 |
PEM_write_bio_ECPKParameters, |
| 75 |
PEM_read_ECPrivateKey, |
| 76 |
PEM_write_ECPrivateKey, |
| 77 |
PEM_write_bio_ECPrivateKey, |
| 78 |
PEM_read_EC_PUBKEY, |
| 79 |
PEM_read_bio_EC_PUBKEY, |
| 80 |
PEM_write_EC_PUBKEY, |
| 81 |
PEM_write_bio_EC_PUBKEY, |
| 82 |
PEM_read_NETSCAPE_CERT_SEQUENCE, |
| 83 |
PEM_read_bio_NETSCAPE_CERT_SEQUENCE, |
| 84 |
PEM_write_NETSCAPE_CERT_SEQUENCE, |
| 85 |
PEM_write_bio_NETSCAPE_CERT_SEQUENCE, |
| 86 |
PEM_read_PKCS8, |
| 87 |
PEM_read_bio_PKCS8, |
| 88 |
PEM_write_PKCS8, |
| 89 |
PEM_write_bio_PKCS8, |
| 90 |
PEM_write_PKCS8_PRIV_KEY_INFO, |
| 91 |
PEM_read_bio_PKCS8_PRIV_KEY_INFO, |
| 92 |
PEM_read_PKCS8_PRIV_KEY_INFO, |
| 93 |
PEM_write_bio_PKCS8_PRIV_KEY_INFO, |
| 94 |
PEM_read_SSL_SESSION, |
| 95 |
PEM_read_bio_SSL_SESSION, |
| 96 |
PEM_write_SSL_SESSION, |
| 97 |
PEM_write_bio_SSL_SESSION, |
| 98 |
PEM_read_X509_PUBKEY, |
| 99 |
PEM_read_bio_X509_PUBKEY, |
| 100 |
PEM_write_X509_PUBKEY, |
| 101 |
PEM_write_bio_X509_PUBKEY |
| 102 |
\&\- PEM object encoding routines |
| 103 |
.SH SYNOPSIS |
| 104 |
.IX Header "SYNOPSIS" |
| 105 |
.Vb 1 |
| 106 |
\& #include <openssl/pem.h> |
| 107 |
\& |
| 108 |
\& DECLARE_PEM_rw(name, TYPE) |
| 109 |
\& |
| 110 |
\& TYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u); |
| 111 |
\& TYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u); |
| 112 |
\& int PEM_write_TYPE(FILE *fp, const TYPE *a); |
| 113 |
\& int PEM_write_bio_TYPE(BIO *bp, const TYPE *a); |
| 114 |
.Ve |
| 115 |
.PP |
| 116 |
The following functions have been deprecated since OpenSSL 3.0, and can be |
| 117 |
hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value, |
| 118 |
see \fBopenssl_user_macros\fR\|(7): |
| 119 |
.PP |
| 120 |
.Vb 1 |
| 121 |
\& #include <openssl/pem.h> |
| 122 |
\& |
| 123 |
\& int PEM_write_DHxparams(FILE *out, const DH *dh); |
| 124 |
\& int PEM_write_bio_DHxparams(BIO *out, const DH *dh); |
| 125 |
\& EC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u); |
| 126 |
\& EC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u); |
| 127 |
\& int PEM_write_ECPKParameters(FILE *out, const EC_GROUP *x); |
| 128 |
\& int PEM_write_bio_ECPKParameters(BIO *out, const EC_GROUP *x), |
| 129 |
\& |
| 130 |
\& EC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u); |
| 131 |
\& EC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u); |
| 132 |
\& int PEM_write_EC_PUBKEY(FILE *out, const EC_KEY *x); |
| 133 |
\& int PEM_write_bio_EC_PUBKEY(BIO *out, const EC_KEY *x); |
| 134 |
\& |
| 135 |
\& EC_KEY *PEM_read_ECPrivateKey(FILE *out, EC_KEY **x, pem_password_cb *cb, void *u); |
| 136 |
\& EC_KEY *PEM_read_bio_ECPrivateKey(BIO *out, EC_KEY **x, pem_password_cb *cb, void *u); |
| 137 |
\& int PEM_write_ECPrivateKey(FILE *out, const EC_KEY *x, const EVP_CIPHER *enc, |
| 138 |
\& const unsigned char *kstr, int klen, |
| 139 |
\& pem_password_cb *cb, void *u); |
| 140 |
\& int PEM_write_bio_ECPrivateKey(BIO *out, const EC_KEY *x, const EVP_CIPHER *enc, |
| 141 |
\& const unsigned char *kstr, int klen, |
| 142 |
\& pem_password_cb *cb, void *u); |
| 143 |
.Ve |
| 144 |
.SH DESCRIPTION |
| 145 |
.IX Header "DESCRIPTION" |
| 146 |
To replace the deprecated functions listed above, applications should use the |
| 147 |
\&\fBEVP_PKEY\fR type and \fBOSSL_DECODER_from_bio()\fR and \fBOSSL_ENCODER_to_bio()\fR to |
| 148 |
read and write PEM data containing key parameters or private and public keys. |
| 149 |
.PP |
| 150 |
In the description below, \fR\f(BITYPE\fR\fB\fR is used |
| 151 |
as a placeholder for any of the OpenSSL datatypes, such as \fBX509\fR. |
| 152 |
The macro \fBDECLARE_PEM_rw\fR expands to the set of declarations shown in |
| 153 |
the next four lines of the synopsis. |
| 154 |
.PP |
| 155 |
These routines convert between local instances of ASN1 datatypes and |
| 156 |
the PEM encoding. For more information on the templates, see |
| 157 |
\&\fBASN1_ITEM\fR\|(3). For more information on the lower-level routines used |
| 158 |
by the functions here, see \fBPEM_read\fR\|(3). |
| 159 |
.PP |
| 160 |
\&\fBPEM_read_\fR\f(BITYPE\fR() reads a PEM-encoded object of \fB\fR\f(BITYPE\fR\fB\fR from the file |
| 161 |
\&\fIfp\fR and returns it. The \fIcb\fR and \fIu\fR parameters are as described in |
| 162 |
\&\fBpem_password_cb\fR\|(3). |
| 163 |
.PP |
| 164 |
\&\fBPEM_read_bio_\fR\f(BITYPE\fR() is similar to \fBPEM_read_\fR\f(BITYPE\fR\fB\fR() but reads from |
| 165 |
the BIO \fIbp\fR. |
| 166 |
.PP |
| 167 |
\&\fBPEM_write_\fR\f(BITYPE\fR() writes the PEM encoding of the object \fIa\fR to the file |
| 168 |
\&\fIfp\fR. |
| 169 |
.PP |
| 170 |
\&\fBPEM_write_bio_\fR\f(BITYPE\fR() similarly writes to the BIO \fIbp\fR. |
| 171 |
.SH NOTES |
| 172 |
.IX Header "NOTES" |
| 173 |
These functions make no assumption regarding the pass phrase received from the |
| 174 |
password callback. |
| 175 |
It will simply be treated as a byte sequence. |
| 176 |
.SH "RETURN VALUES" |
| 177 |
.IX Header "RETURN VALUES" |
| 178 |
\&\fBPEM_read_\fR\f(BITYPE\fR() and \fBPEM_read_bio_\fR\f(BITYPE\fR\fB\fR() return a pointer to an |
| 179 |
allocated object, which should be released by calling \fB\fR\f(BITYPE\fR\fB_free\fR(), or |
| 180 |
NULL on error. |
| 181 |
.PP |
| 182 |
\&\fBPEM_write_\fR\f(BITYPE\fR() and \fBPEM_write_bio_\fR\f(BITYPE\fR\fB\fR() return 1 for success or 0 for failure. |
| 183 |
.SH "SEE ALSO" |
| 184 |
.IX Header "SEE ALSO" |
| 185 |
\&\fBPEM_read\fR\|(3), |
| 186 |
\&\fBpassphrase\-encoding\fR\|(7) |
| 187 |
.SH HISTORY |
| 188 |
.IX Header "HISTORY" |
| 189 |
The functions \fBPEM_write_DHxparams()\fR, \fBPEM_write_bio_DHxparams()\fR, |
| 190 |
\&\fBPEM_read_ECPKParameters()\fR, \fBPEM_read_bio_ECPKParameters()\fR, |
| 191 |
\&\fBPEM_write_ECPKParameters()\fR, \fBPEM_write_bio_ECPKParameters()\fR, |
| 192 |
\&\fBPEM_read_EC_PUBKEY()\fR, \fBPEM_read_bio_EC_PUBKEY()\fR, |
| 193 |
\&\fBPEM_write_EC_PUBKEY()\fR, \fBPEM_write_bio_EC_PUBKEY()\fR, |
| 194 |
\&\fBPEM_read_ECPrivateKey()\fR, \fBPEM_read_bio_ECPrivateKey()\fR, |
| 195 |
\&\fBPEM_write_ECPrivateKey()\fR and \fBPEM_write_bio_ECPrivateKey()\fR |
| 196 |
were deprecated in OpenSSL 3.0. |
| 197 |
.SH COPYRIGHT |
| 198 |
.IX Header "COPYRIGHT" |
| 199 |
Copyright 1998\-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 200 |
.PP |
| 201 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 202 |
this file except in compliance with the License. You can obtain a copy |
| 203 |
in the file LICENSE in the source distribution or at |
| 204 |
<https://www.openssl.org/source/license.html>. |