PEM_read_CMS.3ssl - Man Page

PEM object encoding routines


 #include <openssl/pem.h>


 TYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u);
 TYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u);
 int PEM_write_TYPE(FILE *fp, const TYPE *a);
 int PEM_write_bio_TYPE(BIO *bp, const TYPE *a);


In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509. The macro DECLARE_PEM_rw expands to the set of declarations shown in the next four lines of the synopsis.

These routines convert between local instances of ASN1 datatypes and the PEM encoding.  For more information on the templates, see ASN1_ITEM(3).  For more information on the lower-level routines used by the functions here, see PEM_read(3).

PEM_read_TYPE() reads a PEM-encoded object of TYPE from the file fp and returns it.  The cb and u parameters are as described in pem_password_cb(3).

PEM_read_bio_TYPE() is similar to PEM_read_TYPE() but reads from the BIO bp.

PEM_write_TYPE() writes the PEM encoding of the object a to the file fp.

PEM_write_bio_TYPE() similarly writes to the BIO bp.


These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

Return Values

PEM_read_TYPE() and PEM_read_bio_TYPE() return a pointer to an allocated object, which should be released by calling TYPE_free(), or NULL on error.

PEM_write_TYPE() and PEM_write_bio_TYPE() return the number of bytes written or zero on error.

See Also

PEM_read(3), passphrase-encoding(7)

Referenced By

The man pages DECLARE_PEM_rw.3ssl(3), PEM_read_bio_CMS.3ssl(3), PEM_read_bio_ECPKParameters.3ssl(3), PEM_read_bio_EC_PUBKEY.3ssl(3), PEM_read_bio_NETSCAPE_CERT_SEQUENCE.3ssl(3), PEM_read_bio_PKCS8.3ssl(3), PEM_read_bio_PKCS8_PRIV_KEY_INFO.3ssl(3), PEM_read_bio_SSL_SESSION.3ssl(3), PEM_read_ECPKParameters.3ssl(3), PEM_read_ECPrivateKey.3ssl(3), PEM_read_EC_PUBKEY.3ssl(3), PEM_read_NETSCAPE_CERT_SEQUENCE.3ssl(3), PEM_read_PKCS8.3ssl(3), PEM_read_PKCS8_PRIV_KEY_INFO.3ssl(3), PEM_read_SSL_SESSION.3ssl(3), PEM_write_bio_CMS.3ssl(3), PEM_write_bio_DHxparams.3ssl(3), PEM_write_bio_ECPKParameters.3ssl(3), PEM_write_bio_ECPrivateKey.3ssl(3), PEM_write_bio_EC_PUBKEY.3ssl(3), PEM_write_bio_NETSCAPE_CERT_SEQUENCE.3ssl(3), PEM_write_bio_PKCS8.3ssl(3), PEM_write_bio_PKCS8_PRIV_KEY_INFO.3ssl(3), PEM_write_bio_SSL_SESSION.3ssl(3), PEM_write_CMS.3ssl(3), PEM_write_DHxparams.3ssl(3), PEM_write_ECPKParameters.3ssl(3), PEM_write_ECPrivateKey.3ssl(3), PEM_write_EC_PUBKEY.3ssl(3), PEM_write_NETSCAPE_CERT_SEQUENCE.3ssl(3), PEM_write_PKCS8.3ssl(3), PEM_write_PKCS8_PRIV_KEY_INFO.3ssl(3) and PEM_write_SSL_SESSION.3ssl(3) are aliases of PEM_read_CMS.3ssl(3).

2021-09-20 1.1.1l OpenSSL