PEM_get_EVP_CIPHER_INFO (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
PEM_write, PEM_write_bio, PEM_read, PEM_read_bio, PEM_do_header, PEM_get_EVP_CIPHER_INFO - PEM encoding routinesSYNOPSIS
#include <openssl/pem.h> int PEM_write(FILE *fp, const char *name, const char *header, const unsigned char *data, long len) int PEM_write_bio(BIO *bp, const char *name, const char *header, const unsigned char *data, long len) int PEM_read(FILE *fp, char **name, char **header, unsigned char **data, long *len); int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len); int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cinfo); int PEM_do_header(EVP_CIPHER_INFO *cinfo, unsigned char *data, long *len, pem_password_cb *cb, void *u);
DESCRIPTION
These functions read and write PEM-encoded objects, using the
-----BEGIN PRIVATE KEY----- MIICdg.... ... bhTQ== -----END PRIVATE KEY-----
Optional header line(s) may appear after the begin line, and their existence depends on the type of object being written or read.
PEM_write() writes to the file fp, while PEM_write_bio() writes to the
The final data buffer is typically an
PEM_read() reads from the file fp, while PEM_read_bio() reads from the
PEM_get_EVP_CIPHER_INFO() can be used to determine the data returned by PEM_read() or PEM_read_bio() is encrypted and to retrieve the associated cipher and
PEM_do_header() can then be used to decrypt the data if the header indicates encryption. The cinfo argument is a pointer to the structure initialized by the previous call to PEM_get_EVP_CIPHER_INFO(). The data and len arguments are those returned by the previous call to PEM_read() or PEM_read_bio(). The cb and u arguments make it possible to override the default password prompt function as described in PEM_read_PrivateKey(3). On successful completion the data is decrypted in place, and len is updated to indicate the plaintext length. This function is deprecated, see
If the data is a priori known to not be encrypted, then neither PEM_do_header() nor PEM_get_EVP_CIPHER_INFO() need be called.
RETURN VALUES
PEM_read() and PEM_read_bio() return 1 on success and 0 on failure, the latter includes the case when no morePEM_get_EVP_CIPHER_INFO() and PEM_do_header() return 1 on success, and 0 on failure. The data is likely meaningless if these functions fail.
NOTES
The PEM_get_EVP_CIPHER_INFO() and PEM_do_header() functions are deprecated. This is because the underlyingSEE ALSO
ERR_peek_last_error(3), (3), d2i_PKCS8PrivateKey_bio(3).COPYRIGHT
Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.Licensed under the OpenSSL license (the ``License''). You may not use this file except in compliance with the License. You can obtain a copy in the file