diff options
Diffstat (limited to 'secure/lib/libcrypto/man/pem.3')
-rw-r--r-- | secure/lib/libcrypto/man/pem.3 | 118 |
1 files changed, 93 insertions, 25 deletions
diff --git a/secure/lib/libcrypto/man/pem.3 b/secure/lib/libcrypto/man/pem.3 index 056c02e87b13..dfd85be30f59 100644 --- a/secure/lib/libcrypto/man/pem.3 +++ b/secure/lib/libcrypto/man/pem.3 @@ -1,8 +1,7 @@ -.\" Automatically generated by Pod::Man version 1.15 -.\" Wed Mar 17 09:38:44 2004 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: -.\" ====================================================================== +.\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp @@ -15,12 +14,6 @@ .if t .sp .5v .if n .sp .. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. .de Vb \" Begin verbatim text .ft CW .nf @@ -28,15 +21,14 @@ .. .de Ve \" End verbatim text .ft R - .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ @@ -56,10 +48,10 @@ . ds R" '' 'br\} .\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" @@ -68,14 +60,13 @@ . rr F .\} .\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 @@ -135,214 +126,267 @@ . ds Ae AE .\} .rm #[ #] #H #V #F C -.\" ====================================================================== +.\" ======================================================================== .\" .IX Title "pem 3" -.TH pem 3 "0.9.7d" "2004-03-17" "OpenSSL" -.UC +.TH pem 3 "2005-02-24" "0.9.7d" "OpenSSL" .SH "NAME" -\&\s-1PEM\s0 \- \s-1PEM\s0 routines +PEM \- PEM routines .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/pem.h> .Ve +.PP .Vb 2 \& EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, \& char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, \& char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, \& char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, \& char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& EVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x); \& int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x); .Ve +.PP .Vb 2 \& RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x); .Ve +.PP .Vb 1 \& int PEM_write_RSAPublicKey(FILE *fp, RSA *x); .Ve +.PP .Vb 2 \& RSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x); .Ve +.PP .Vb 1 \& int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x); .Ve +.PP .Vb 2 \& DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, \& unsigned char *kstr, int klen, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& DSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& DSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x); .Ve +.PP .Vb 1 \& int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x); .Ve +.PP .Vb 1 \& DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_DSAparams(BIO *bp, DSA *x); .Ve +.PP .Vb 1 \& int PEM_write_DSAparams(FILE *fp, DSA *x); .Ve +.PP .Vb 1 \& DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_DHparams(BIO *bp, DH *x); .Ve +.PP .Vb 1 \& int PEM_write_DHparams(FILE *fp, DH *x); .Ve +.PP .Vb 1 \& X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_X509(BIO *bp, X509 *x); .Ve +.PP .Vb 1 \& int PEM_write_X509(FILE *fp, X509 *x); .Ve +.PP .Vb 1 \& X509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& X509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_X509_AUX(BIO *bp, X509 *x); .Ve +.PP .Vb 1 \& int PEM_write_X509_AUX(FILE *fp, X509 *x); .Ve +.PP .Vb 2 \& X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 2 \& X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x); .Ve +.PP .Vb 1 \& int PEM_write_X509_REQ(FILE *fp, X509_REQ *x); .Ve +.PP .Vb 1 \& int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x); .Ve +.PP .Vb 1 \& int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x); .Ve +.PP .Vb 6 \& X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, \& pem_password_cb *cb, void *u); @@ -351,31 +395,39 @@ \& int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x); \& int PEM_write_X509_CRL(FILE *fp, X509_CRL *x); .Ve +.PP .Vb 1 \& PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x); .Ve +.PP .Vb 1 \& int PEM_write_PKCS7(FILE *fp, PKCS7 *x); .Ve +.PP .Vb 3 \& NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, \& NETSCAPE_CERT_SEQUENCE **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 3 \& NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, \& NETSCAPE_CERT_SEQUENCE **x, \& pem_password_cb *cb, void *u); .Ve +.PP .Vb 1 \& int PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x); .Ve +.PP .Vb 1 \& int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x); .Ve @@ -512,6 +564,7 @@ routine has the following form: .Vb 1 \& int cb(char *buf, int size, int rwflag, void *u); .Ve +.PP \&\fBbuf\fR is the buffer to write the passphrase to. \fBsize\fR is the maximum length of the passphrase (i.e. the size of buf). \fBrwflag\fR is a flag which is set to 0 when reading and 1 when writing. A typical routine @@ -537,6 +590,7 @@ Read a certificate in \s-1PEM\s0 format from a \s-1BIO:\s0 \& /* Error */ \& } .Ve +.PP Alternative method: .PP .Vb 5 @@ -546,6 +600,7 @@ Alternative method: \& /* Error */ \& } .Ve +.PP Write a certificate to a \s-1BIO:\s0 .PP .Vb 4 @@ -554,6 +609,7 @@ Write a certificate to a \s-1BIO:\s0 \& /* Error */ \& } .Ve +.PP Write an unencrypted private key to a \s-1FILE\s0 pointer: .PP .Vb 4 @@ -562,6 +618,7 @@ Write an unencrypted private key to a \s-1FILE\s0 pointer: \& /* Error */ \& } .Ve +.PP Write a private key (using traditional format) to a \s-1BIO\s0 using triple \s-1DES\s0 encryption, the pass phrase is prompted for: .PP @@ -571,6 +628,7 @@ triple \s-1DES\s0 encryption, the pass phrase is prompted for: \& /* Error */ \& } .Ve +.PP Write a private key (using PKCS#8 format) to a \s-1BIO\s0 using triple \&\s-1DES\s0 encryption, using the pass phrase \*(L"hello\*(R": .PP @@ -580,6 +638,7 @@ Write a private key (using PKCS#8 format) to a \s-1BIO\s0 using triple \& /* Error */ \& } .Ve +.PP Read a private key from a \s-1BIO\s0 using the pass phrase \*(L"hello\*(R": .PP .Vb 5 @@ -589,6 +648,7 @@ Read a private key from a \s-1BIO\s0 using the pass phrase \*(L"hello\*(R": \& /* Error */ \& } .Ve +.PP Read a private key from a \s-1BIO\s0 using a pass phrase callback: .PP .Vb 5 @@ -598,6 +658,7 @@ Read a private key from a \s-1BIO\s0 using a pass phrase callback: \& /* Error */ \& } .Ve +.PP Skeleton pass phrase callback: .PP .Vb 6 @@ -608,11 +669,13 @@ Skeleton pass phrase callback: \& /* We'd probably do something else if 'rwflag' is 1 */ \& printf("Enter pass phrase for \e"%s\e"\en", u); .Ve +.PP .Vb 3 \& /* get pass phrase, length 'len' into 'tmp' */ \& tmp = "hello"; \& len = strlen(tmp); .Ve +.PP .Vb 6 \& if (len <= 0) return 0; \& /* if too long, truncate */ @@ -640,6 +703,7 @@ this: \& X509 *x; \& PEM_read_bio_X509(bp, &x, 0, NULL); .Ve +.PP this is a bug because an attempt will be made to reuse the data at \fBx\fR which is an uninitialised pointer. .SH "PEM ENCRYPTION FORMAT" @@ -653,10 +717,12 @@ The private key (or other data) takes the following form: \& Proc-Type: 4,ENCRYPTED \& DEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89 .Ve +.PP .Vb 2 \& ...base64 encoded data... \& -----END RSA PRIVATE KEY----- .Ve +.PP The line beginning DEK-Info contains two comma separated pieces of information: the encryption algorithm name as used by \fIEVP_get_cipherbyname()\fR and an 8 byte \fBsalt\fR encoded as a set of hexadecimal digits. @@ -674,16 +740,18 @@ an existing structure. Therefore the following: .Vb 1 \& PEM_read_bio_X509(bp, &x, 0, NULL); .Ve +.PP where \fBx\fR already contains a valid certificate, may not work, whereas: .PP .Vb 2 \& X509_free(x); \& x = PEM_read_bio_X509(bp, NULL, 0, NULL); .Ve +.PP is guaranteed to work. .SH "RETURN CODES" .IX Header "RETURN CODES" The read routines return either a pointer to the structure read or \s-1NULL\s0 -is an error occurred. +if an error occurred. .PP The write routines return 1 for success or 0 for failure. |