xref: /freebsd/crypto/openssl/doc/man3/PEM_read_CMS.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimDECLARE_PEM_rw,
6e71b7053SJung-uk KimPEM_read_CMS,
7e71b7053SJung-uk KimPEM_read_bio_CMS,
8e71b7053SJung-uk KimPEM_write_CMS,
9e71b7053SJung-uk KimPEM_write_bio_CMS,
10e71b7053SJung-uk KimPEM_write_DHxparams,
11e71b7053SJung-uk KimPEM_write_bio_DHxparams,
12e71b7053SJung-uk KimPEM_read_ECPKParameters,
13e71b7053SJung-uk KimPEM_read_bio_ECPKParameters,
14e71b7053SJung-uk KimPEM_write_ECPKParameters,
15e71b7053SJung-uk KimPEM_write_bio_ECPKParameters,
16e71b7053SJung-uk KimPEM_read_ECPrivateKey,
17e71b7053SJung-uk KimPEM_write_ECPrivateKey,
18e71b7053SJung-uk KimPEM_write_bio_ECPrivateKey,
19e71b7053SJung-uk KimPEM_read_EC_PUBKEY,
20e71b7053SJung-uk KimPEM_read_bio_EC_PUBKEY,
21e71b7053SJung-uk KimPEM_write_EC_PUBKEY,
22e71b7053SJung-uk KimPEM_write_bio_EC_PUBKEY,
23e71b7053SJung-uk KimPEM_read_NETSCAPE_CERT_SEQUENCE,
24e71b7053SJung-uk KimPEM_read_bio_NETSCAPE_CERT_SEQUENCE,
25e71b7053SJung-uk KimPEM_write_NETSCAPE_CERT_SEQUENCE,
26e71b7053SJung-uk KimPEM_write_bio_NETSCAPE_CERT_SEQUENCE,
27e71b7053SJung-uk KimPEM_read_PKCS8,
28e71b7053SJung-uk KimPEM_read_bio_PKCS8,
29e71b7053SJung-uk KimPEM_write_PKCS8,
30e71b7053SJung-uk KimPEM_write_bio_PKCS8,
31e71b7053SJung-uk KimPEM_write_PKCS8_PRIV_KEY_INFO,
32e71b7053SJung-uk KimPEM_read_bio_PKCS8_PRIV_KEY_INFO,
33e71b7053SJung-uk KimPEM_read_PKCS8_PRIV_KEY_INFO,
34e71b7053SJung-uk KimPEM_write_bio_PKCS8_PRIV_KEY_INFO,
35e71b7053SJung-uk KimPEM_read_SSL_SESSION,
36e71b7053SJung-uk KimPEM_read_bio_SSL_SESSION,
37e71b7053SJung-uk KimPEM_write_SSL_SESSION,
38*b077aed3SPierre ProncheryPEM_write_bio_SSL_SESSION,
39*b077aed3SPierre ProncheryPEM_read_X509_PUBKEY,
40*b077aed3SPierre ProncheryPEM_read_bio_X509_PUBKEY,
41*b077aed3SPierre ProncheryPEM_write_X509_PUBKEY,
42*b077aed3SPierre ProncheryPEM_write_bio_X509_PUBKEY
43e71b7053SJung-uk Kim- PEM object encoding routines
44e71b7053SJung-uk Kim
45e71b7053SJung-uk Kim=head1 SYNOPSIS
46e71b7053SJung-uk Kim
47*b077aed3SPierre Pronchery=for openssl generic
48e71b7053SJung-uk Kim
49e71b7053SJung-uk Kim #include <openssl/pem.h>
50e71b7053SJung-uk Kim
51e71b7053SJung-uk Kim DECLARE_PEM_rw(name, TYPE)
52e71b7053SJung-uk Kim
53e71b7053SJung-uk Kim TYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u);
54e71b7053SJung-uk Kim TYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u);
55e71b7053SJung-uk Kim int PEM_write_TYPE(FILE *fp, const TYPE *a);
56e71b7053SJung-uk Kim int PEM_write_bio_TYPE(BIO *bp, const TYPE *a);
57e71b7053SJung-uk Kim
58*b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be
59*b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
60*b077aed3SPierre Proncherysee L<openssl_user_macros(7)>:
61*b077aed3SPierre Pronchery
62*b077aed3SPierre Pronchery #include <openssl/pem.h>
63*b077aed3SPierre Pronchery
64*b077aed3SPierre Pronchery int PEM_write_DHxparams(FILE *out, const DH *dh);
65*b077aed3SPierre Pronchery int PEM_write_bio_DHxparams(BIO *out, const DH *dh);
66*b077aed3SPierre Pronchery EC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u);
67*b077aed3SPierre Pronchery EC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u);
68*b077aed3SPierre Pronchery int PEM_write_ECPKParameters(FILE *out, const EC_GROUP *x);
69*b077aed3SPierre Pronchery int PEM_write_bio_ECPKParameters(BIO *out, const EC_GROUP *x),
70*b077aed3SPierre Pronchery
71*b077aed3SPierre Pronchery EC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u);
72*b077aed3SPierre Pronchery EC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u);
73*b077aed3SPierre Pronchery int PEM_write_EC_PUBKEY(FILE *out, const EC_KEY *x);
74*b077aed3SPierre Pronchery int PEM_write_bio_EC_PUBKEY(BIO *out, const EC_KEY *x);
75*b077aed3SPierre Pronchery
76*b077aed3SPierre Pronchery EC_KEY *PEM_read_ECPrivateKey(FILE *out, EC_KEY **x, pem_password_cb *cb, void *u);
77*b077aed3SPierre Pronchery EC_KEY *PEM_read_bio_ECPrivateKey(BIO *out, EC_KEY **x, pem_password_cb *cb, void *u);
78*b077aed3SPierre Pronchery int PEM_write_ECPrivateKey(FILE *out, const EC_KEY *x, const EVP_CIPHER *enc,
79*b077aed3SPierre Pronchery                            const unsigned char *kstr, int klen,
80*b077aed3SPierre Pronchery                            pem_password_cb *cb, void *u);
81*b077aed3SPierre Pronchery int PEM_write_bio_ECPrivateKey(BIO *out, const EC_KEY *x, const EVP_CIPHER *enc,
82*b077aed3SPierre Pronchery                                const unsigned char *kstr, int klen,
83*b077aed3SPierre Pronchery                                pem_password_cb *cb, void *u);
84*b077aed3SPierre Pronchery
85e71b7053SJung-uk Kim=head1 DESCRIPTION
86e71b7053SJung-uk Kim
87*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated.
88*b077aed3SPierre ProncheryApplications should use OSSL_ENCODER_to_bio() and OSSL_DECODER_from_bio()
89*b077aed3SPierre Proncheryinstead.
90*b077aed3SPierre Pronchery
91*b077aed3SPierre ProncheryIn the description below, B<I<TYPE>> is used
92*b077aed3SPierre Proncheryas a placeholder for any of the OpenSSL datatypes, such as B<X509>.
93e71b7053SJung-uk KimThe macro B<DECLARE_PEM_rw> expands to the set of declarations shown in
94e71b7053SJung-uk Kimthe next four lines of the synopsis.
95e71b7053SJung-uk Kim
96e71b7053SJung-uk KimThese routines convert between local instances of ASN1 datatypes and
97e71b7053SJung-uk Kimthe PEM encoding.  For more information on the templates, see
98e71b7053SJung-uk KimL<ASN1_ITEM(3)>.  For more information on the lower-level routines used
99e71b7053SJung-uk Kimby the functions here, see L<PEM_read(3)>.
100e71b7053SJung-uk Kim
101*b077aed3SPierre ProncheryB<PEM_read_I<TYPE>>() reads a PEM-encoded object of B<I<TYPE>> from the file
102*b077aed3SPierre ProncheryI<fp> and returns it.  The I<cb> and I<u> parameters are as described in
103e71b7053SJung-uk KimL<pem_password_cb(3)>.
104e71b7053SJung-uk Kim
105*b077aed3SPierre ProncheryB<PEM_read_bio_I<TYPE>>() is similar to B<PEM_read_I<TYPE>>() but reads from
106*b077aed3SPierre Proncherythe BIO I<bp>.
107e71b7053SJung-uk Kim
108*b077aed3SPierre ProncheryB<PEM_write_I<TYPE>>() writes the PEM encoding of the object I<a> to the file
109*b077aed3SPierre ProncheryI<fp>.
110e71b7053SJung-uk Kim
111*b077aed3SPierre ProncheryB<PEM_write_bio_I<TYPE>>() similarly writes to the BIO I<bp>.
112e71b7053SJung-uk Kim
113e71b7053SJung-uk Kim=head1 NOTES
114e71b7053SJung-uk Kim
115e71b7053SJung-uk KimThese functions make no assumption regarding the pass phrase received from the
116e71b7053SJung-uk Kimpassword callback.
117e71b7053SJung-uk KimIt will simply be treated as a byte sequence.
118e71b7053SJung-uk Kim
119e71b7053SJung-uk Kim=head1 RETURN VALUES
120e71b7053SJung-uk Kim
121*b077aed3SPierre ProncheryB<PEM_read_I<TYPE>>() and B<PEM_read_bio_I<TYPE>>() return a pointer to an
122*b077aed3SPierre Proncheryallocated object, which should be released by calling B<I<TYPE>_free>(), or
123*b077aed3SPierre ProncheryNULL on error.
124e71b7053SJung-uk Kim
125*b077aed3SPierre ProncheryB<PEM_write_I<TYPE>>() and B<PEM_write_bio_I<TYPE>>() return 1 for success or 0 for failure.
126e71b7053SJung-uk Kim
127e71b7053SJung-uk Kim=head1 SEE ALSO
128e71b7053SJung-uk Kim
129e71b7053SJung-uk KimL<PEM_read(3)>,
130e71b7053SJung-uk KimL<passphrase-encoding(7)>
131e71b7053SJung-uk Kim
132*b077aed3SPierre Pronchery=head1 HISTORY
133*b077aed3SPierre Pronchery
134*b077aed3SPierre ProncheryThe functions PEM_write_DHxparams(), PEM_write_bio_DHxparams(),
135*b077aed3SPierre ProncheryPEM_read_ECPKParameters(), PEM_read_bio_ECPKParameters(),
136*b077aed3SPierre ProncheryPEM_write_ECPKParameters(), PEM_write_bio_ECPKParameters(),
137*b077aed3SPierre ProncheryPEM_read_EC_PUBKEY(), PEM_read_bio_EC_PUBKEY(),
138*b077aed3SPierre ProncheryPEM_write_EC_PUBKEY(), PEM_write_bio_EC_PUBKEY(),
139*b077aed3SPierre ProncheryPEM_read_ECPrivateKey(), PEM_read_bio_ECPrivateKey(),
140*b077aed3SPierre ProncheryPEM_write_ECPrivateKey() and PEM_write_bio_ECPrivateKey()
141*b077aed3SPierre Proncherywere deprecated in OpenSSL 3.0.
142*b077aed3SPierre Pronchery
143e71b7053SJung-uk Kim=head1 COPYRIGHT
144e71b7053SJung-uk Kim
145*b077aed3SPierre ProncheryCopyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved.
146e71b7053SJung-uk Kim
147*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
148e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
149e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
150e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
151e71b7053SJung-uk Kim
152e71b7053SJung-uk Kim=cut
153