summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc
diff options
context:
space:
mode:
authorschwarze <>2016-11-03 15:20:36 +0000
committerschwarze <>2016-11-03 15:20:36 +0000
commit60d59582dc15b87539a8dc135d2baf8a181ff37b (patch)
tree1ce08c06c8b7c83fa9592d241cddc0d7b95ce2ce /src/lib/libcrypto/doc
parent05002f727738ee445b4a9367f51474995302c6a6 (diff)
downloadopenbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.tar.gz
openbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.tar.bz2
openbsd-60d59582dc15b87539a8dc135d2baf8a181ff37b.zip
convert PEM and PKCS manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/doc')
-rw-r--r--src/lib/libcrypto/doc/PEM_read_bio_PrivateKey.pod498
-rw-r--r--src/lib/libcrypto/doc/PEM_write_bio_PKCS7_stream.pod41
-rw-r--r--src/lib/libcrypto/doc/PKCS12_create.pod73
-rw-r--r--src/lib/libcrypto/doc/PKCS12_parse.pod57
-rw-r--r--src/lib/libcrypto/doc/PKCS5_PBKDF2_HMAC.pod64
-rw-r--r--src/lib/libcrypto/doc/PKCS7_decrypt.pod57
-rw-r--r--src/lib/libcrypto/doc/PKCS7_encrypt.pod73
-rw-r--r--src/lib/libcrypto/doc/PKCS7_sign.pod116
-rw-r--r--src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod87
-rw-r--r--src/lib/libcrypto/doc/PKCS7_verify.pod118
-rw-r--r--src/lib/libcrypto/doc/SMIME_read_PKCS7.pod73
-rw-r--r--src/lib/libcrypto/doc/SMIME_write_PKCS7.pod65
-rw-r--r--src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod44
13 files changed, 0 insertions, 1366 deletions
diff --git a/src/lib/libcrypto/doc/PEM_read_bio_PrivateKey.pod b/src/lib/libcrypto/doc/PEM_read_bio_PrivateKey.pod
deleted file mode 100644
index 6d87079a84..0000000000
--- a/src/lib/libcrypto/doc/PEM_read_bio_PrivateKey.pod
+++ /dev/null
@@ -1,498 +0,0 @@
1=pod
2
3=head1 NAME
4
5PEM, PEM_read_bio_PrivateKey, PEM_read_PrivateKey, PEM_write_bio_PrivateKey,
6PEM_write_PrivateKey, PEM_write_bio_PKCS8PrivateKey, PEM_write_PKCS8PrivateKey,
7PEM_write_bio_PKCS8PrivateKey_nid, PEM_write_PKCS8PrivateKey_nid,
8PEM_read_bio_PUBKEY, PEM_read_PUBKEY, PEM_write_bio_PUBKEY, PEM_write_PUBKEY,
9PEM_read_bio_RSAPrivateKey, PEM_read_RSAPrivateKey,
10PEM_write_bio_RSAPrivateKey, PEM_write_RSAPrivateKey,
11PEM_read_bio_RSAPublicKey, PEM_read_RSAPublicKey, PEM_write_bio_RSAPublicKey,
12PEM_write_RSAPublicKey, PEM_read_bio_RSA_PUBKEY, PEM_read_RSA_PUBKEY,
13PEM_write_bio_RSA_PUBKEY, PEM_write_RSA_PUBKEY, PEM_read_bio_DSAPrivateKey,
14PEM_read_DSAPrivateKey, PEM_write_bio_DSAPrivateKey, PEM_write_DSAPrivateKey,
15PEM_read_bio_DSA_PUBKEY, PEM_read_DSA_PUBKEY, PEM_write_bio_DSA_PUBKEY,
16PEM_write_DSA_PUBKEY, PEM_read_bio_DSAparams, PEM_read_DSAparams,
17PEM_write_bio_DSAparams, PEM_write_DSAparams, PEM_read_bio_DHparams,
18PEM_read_DHparams, PEM_write_bio_DHparams, PEM_write_DHparams,
19PEM_read_bio_X509, PEM_read_X509, PEM_write_bio_X509, PEM_write_X509,
20PEM_read_bio_X509_AUX, PEM_read_X509_AUX, PEM_write_bio_X509_AUX,
21PEM_write_X509_AUX, PEM_read_bio_X509_REQ, PEM_read_X509_REQ,
22PEM_write_bio_X509_REQ, PEM_write_X509_REQ, PEM_write_bio_X509_REQ_NEW,
23PEM_write_X509_REQ_NEW, PEM_read_bio_X509_CRL, PEM_read_X509_CRL,
24PEM_write_bio_X509_CRL, PEM_write_X509_CRL, PEM_read_bio_PKCS7, PEM_read_PKCS7,
25PEM_write_bio_PKCS7, PEM_write_PKCS7, PEM_read_bio_NETSCAPE_CERT_SEQUENCE,
26PEM_read_NETSCAPE_CERT_SEQUENCE, PEM_write_bio_NETSCAPE_CERT_SEQUENCE,
27PEM_write_NETSCAPE_CERT_SEQUENCE - PEM routines
28
29=head1 SYNOPSIS
30
31 #include <openssl/pem.h>
32
33 EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x,
34 pem_password_cb *cb, void *u);
35
36 EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x,
37 pem_password_cb *cb, void *u);
38
39 int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
40 unsigned char *kstr, int klen,
41 pem_password_cb *cb, void *u);
42
43 int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
44 unsigned char *kstr, int klen,
45 pem_password_cb *cb, void *u);
46
47 int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
48 char *kstr, int klen,
49 pem_password_cb *cb, void *u);
50
51 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
52 char *kstr, int klen,
53 pem_password_cb *cb, void *u);
54
55 int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
56 char *kstr, int klen,
57 pem_password_cb *cb, void *u);
58
59 int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
60 char *kstr, int klen,
61 pem_password_cb *cb, void *u);
62
63 EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x,
64 pem_password_cb *cb, void *u);
65
66 EVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x,
67 pem_password_cb *cb, void *u);
68
69 int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x);
70 int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x);
71
72 RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x,
73 pem_password_cb *cb, void *u);
74
75 RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x,
76 pem_password_cb *cb, void *u);
77
78 int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
79 unsigned char *kstr, int klen,
80 pem_password_cb *cb, void *u);
81
82 int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc,
83 unsigned char *kstr, int klen,
84 pem_password_cb *cb, void *u);
85
86 RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x,
87 pem_password_cb *cb, void *u);
88
89 RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x,
90 pem_password_cb *cb, void *u);
91
92 int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x);
93
94 int PEM_write_RSAPublicKey(FILE *fp, RSA *x);
95
96 RSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x,
97 pem_password_cb *cb, void *u);
98
99 RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x,
100 pem_password_cb *cb, void *u);
101
102 int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x);
103
104 int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x);
105
106 DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x,
107 pem_password_cb *cb, void *u);
108
109 DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x,
110 pem_password_cb *cb, void *u);
111
112 int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc,
113 unsigned char *kstr, int klen,
114 pem_password_cb *cb, void *u);
115
116 int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,
117 unsigned char *kstr, int klen,
118 pem_password_cb *cb, void *u);
119
120 DSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x,
121 pem_password_cb *cb, void *u);
122
123 DSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x,
124 pem_password_cb *cb, void *u);
125
126 int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x);
127
128 int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x);
129
130 DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u);
131
132 DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u);
133
134 int PEM_write_bio_DSAparams(BIO *bp, DSA *x);
135
136 int PEM_write_DSAparams(FILE *fp, DSA *x);
137
138 DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u);
139
140 DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u);
141
142 int PEM_write_bio_DHparams(BIO *bp, DH *x);
143
144 int PEM_write_DHparams(FILE *fp, DH *x);
145
146 X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u);
147
148 X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u);
149
150 int PEM_write_bio_X509(BIO *bp, X509 *x);
151
152 int PEM_write_X509(FILE *fp, X509 *x);
153
154 X509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u);
155
156 X509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u);
157
158 int PEM_write_bio_X509_AUX(BIO *bp, X509 *x);
159
160 int PEM_write_X509_AUX(FILE *fp, X509 *x);
161
162 X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x,
163 pem_password_cb *cb, void *u);
164
165 X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x,
166 pem_password_cb *cb, void *u);
167
168 int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x);
169
170 int PEM_write_X509_REQ(FILE *fp, X509_REQ *x);
171
172 int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x);
173
174 int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x);
175
176 X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x,
177 pem_password_cb *cb, void *u);
178 X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x,
179 pem_password_cb *cb, void *u);
180 int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x);
181 int PEM_write_X509_CRL(FILE *fp, X509_CRL *x);
182
183 PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u);
184
185 PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u);
186
187 int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x);
188
189 int PEM_write_PKCS7(FILE *fp, PKCS7 *x);
190
191 NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp,
192 NETSCAPE_CERT_SEQUENCE **x,
193 pem_password_cb *cb, void *u);
194
195 NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp,
196 NETSCAPE_CERT_SEQUENCE **x,
197 pem_password_cb *cb, void *u);
198
199 int PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x);
200
201 int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x);
202
203=head1 DESCRIPTION
204
205The PEM functions read or write structures in PEM format. In
206this sense PEM format is simply base64 encoded data surrounded
207by header lines.
208
209For more details about the meaning of arguments see the
210B<PEM FUNCTION ARGUMENTS> section.
211
212Each operation has four functions associated with it. For
213clarity the term "B<foobar> functions" will be used to collectively
214refer to the PEM_read_bio_foobar(), PEM_read_foobar(),
215PEM_write_bio_foobar() and PEM_write_foobar() functions.
216
217The B<PrivateKey> functions read or write a private key in
218PEM format using an EVP_PKEY structure. The write routines use
219"traditional" private key format and can handle both RSA and DSA
220private keys. The read functions can additionally transparently
221handle PKCS#8 format encrypted and unencrypted keys too.
222
223PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey()
224write a private key in an EVP_PKEY structure in PKCS#8
225EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption
226algorithms. The B<cipher> argument specifies the encryption algorithm to
227use: unlike all other PEM routines the encryption is applied at the
228PKCS#8 level and not in the PEM headers. If B<cipher> is NULL then no
229encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead.
230
231PEM_write_bio_PKCS8PrivateKey_nid() and PEM_write_PKCS8PrivateKey_nid()
232also write out a private key as a PKCS#8 EncryptedPrivateKeyInfo however
233it uses PKCS#5 v1.5 or PKCS#12 encryption algorithms instead. The algorithm
234to use is specified in the B<nid> parameter and should be the NID of the
235corresponding OBJECT IDENTIFIER (see NOTES section).
236
237The B<PUBKEY> functions process a public key using an EVP_PKEY
238structure. The public key is encoded as a SubjectPublicKeyInfo
239structure.
240
241The B<RSAPrivateKey> functions process an RSA private key using an
242RSA structure. It handles the same formats as the B<PrivateKey>
243functions but an error occurs if the private key is not RSA.
244
245The B<RSAPublicKey> functions process an RSA public key using an
246RSA structure. The public key is encoded using a PKCS#1 RSAPublicKey
247structure.
248
249The B<RSA_PUBKEY> functions also process an RSA public key using
250an RSA structure. However the public key is encoded using a
251SubjectPublicKeyInfo structure and an error occurs if the public
252key is not RSA.
253
254The B<DSAPrivateKey> functions process a DSA private key using a
255DSA structure. It handles the same formats as the B<PrivateKey>
256functions but an error occurs if the private key is not DSA.
257
258The B<DSA_PUBKEY> functions process a DSA public key using
259a DSA structure. The public key is encoded using a
260SubjectPublicKeyInfo structure and an error occurs if the public
261key is not DSA.
262
263The B<DSAparams> functions process DSA parameters using a DSA
264structure. The parameters are encoded using a foobar structure.
265
266The B<DHparams> functions process DH parameters using a DH
267structure. The parameters are encoded using a PKCS#3 DHparameter
268structure.
269
270The B<X509> functions process an X509 certificate using an X509
271structure. They will also process a trusted X509 certificate but
272any trust settings are discarded.
273
274The B<X509_AUX> functions process a trusted X509 certificate using
275an X509 structure.
276
277The B<X509_REQ> and B<X509_REQ_NEW> functions process a PKCS#10
278certificate request using an X509_REQ structure. The B<X509_REQ>
279write functions use B<CERTIFICATE REQUEST> in the header whereas
280the B<X509_REQ_NEW> functions use B<NEW CERTIFICATE REQUEST>
281(as required by some CAs). The B<X509_REQ> read functions will
282handle either form so there are no B<X509_REQ_NEW> read functions.
283
284The B<X509_CRL> functions process an X509 CRL using an X509_CRL
285structure.
286
287The B<PKCS7> functions process a PKCS#7 ContentInfo using a PKCS7
288structure.
289
290The B<NETSCAPE_CERT_SEQUENCE> functions process a Netscape Certificate
291Sequence using a NETSCAPE_CERT_SEQUENCE structure.
292
293=head1 PEM FUNCTION ARGUMENTS
294
295The PEM functions have many common arguments.
296
297The B<bp> BIO parameter (if present) specifies the BIO to read from
298or write to.
299
300The B<fp> FILE parameter (if present) specifies the FILE pointer to
301read from or write to.
302
303The PEM read functions all take an argument B<TYPE **x> and return
304a B<TYPE *> pointer. Where B<TYPE> is whatever structure the function
305uses. If B<x> is NULL then the parameter is ignored. If B<x> is not
306NULL but B<*x> is NULL then the structure returned will be written
307to B<*x>. If neither B<x> nor B<*x> is NULL then an attempt is made
308to reuse the structure at B<*x> (but see BUGS and EXAMPLES sections).
309Irrespective of the value of B<x> a pointer to the structure is always
310returned (or NULL if an error occurred).
311
312The PEM functions which write private keys take an B<enc> parameter
313which specifies the encryption algorithm to use, encryption is done
314at the PEM level. If this parameter is set to NULL then the private
315key is written in unencrypted form.
316
317The B<cb> argument is the callback to use when querying for the pass
318phrase used for encrypted PEM structures (normally only private keys).
319
320For the PEM write routines if the B<kstr> parameter is not NULL then
321B<klen> bytes at B<kstr> are used as the passphrase and B<cb> is
322ignored.
323
324If the B<cb> parameters is set to NULL and the B<u> parameter is not
325NULL then the B<u> parameter is interpreted as a null terminated string
326to use as the passphrase. If both B<cb> and B<u> are NULL then the
327default callback routine is used which will typically prompt for the
328passphrase on the current terminal with echoing turned off.
329
330The default passphrase callback is sometimes inappropriate (for example
331in a GUI application) so an alternative can be supplied. The callback
332routine has the following form:
333
334 int cb(char *buf, int size, int rwflag, void *u);
335
336B<buf> is the buffer to write the passphrase to. B<size> is the maximum
337length of the passphrase (i.e. the size of buf). B<rwflag> is a flag
338which is set to 0 when reading and 1 when writing. A typical routine
339will ask the user to verify the passphrase (for example by prompting
340for it twice) if B<rwflag> is 1. The B<u> parameter has the same
341value as the B<u> parameter passed to the PEM routine. It allows
342arbitrary data to be passed to the callback by the application
343(for example a window handle in a GUI application). The callback
344B<must> return the number of characters in the passphrase or 0 if
345an error occurred.
346
347=head1 EXAMPLES
348
349Although the PEM routines take several arguments in almost all applications
350most of them are set to 0 or NULL.
351
352Read a certificate in PEM format from a BIO:
353
354 X509 *x;
355 x = PEM_read_bio_X509(bp, NULL, 0, NULL);
356 if (x == NULL) {
357 /* Error */
358 }
359
360Alternative method:
361
362 X509 *x = NULL;
363 if (!PEM_read_bio_X509(bp, &x, 0, NULL)) {
364 /* Error */
365 }
366
367Write a certificate to a BIO:
368
369 if (!PEM_write_bio_X509(bp, x)) {
370 /* Error */
371 }
372
373Write an unencrypted private key to a FILE pointer:
374
375 if (!PEM_write_PrivateKey(fp, key, NULL, NULL, 0, 0, NULL)) {
376 /* Error */
377 }
378
379Write a private key (using traditional format) to a BIO using
380triple DES encryption, the pass phrase is prompted for:
381
382 if (!PEM_write_bio_PrivateKey(bp, key, EVP_des_ede3_cbc(),
383 NULL, 0, 0, NULL)) {
384 /* Error */
385 }
386
387Write a private key (using PKCS#8 format) to a BIO using triple
388DES encryption, using the pass phrase "hello":
389
390 if (!PEM_write_bio_PKCS8PrivateKey(bp, key, EVP_des_ede3_cbc(),
391 NULL, 0, 0, "hello")) {
392 /* Error */
393 }
394
395Read a private key from a BIO using the pass phrase "hello":
396
397 key = PEM_read_bio_PrivateKey(bp, NULL, 0, "hello");
398 if (key == NULL) {
399 /* Error */
400 }
401
402Read a private key from a BIO using a pass phrase callback:
403
404 key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, "My Private Key");
405 if (key == NULL) {
406 /* Error */
407 }
408
409Skeleton pass phrase callback:
410
411 int
412 pass_cb(char *buf, int size, int rwflag, void *u)
413 {
414 int len;
415 char *tmp;
416
417 /* We'd probably do something else if 'rwflag' is 1 */
418 printf("Enter pass phrase for \"%s\"\n", u);
419
420 /* get pass phrase, length 'len' into 'tmp' */
421 tmp = "hello";
422 len = strlen(tmp);
423
424 if (len == 0)
425 return 0;
426 /* if too long, truncate */
427 if (len > size)
428 len = size;
429 memcpy(buf, tmp, len);
430 return len;
431 }
432
433=head1 NOTES
434
435The old B<PrivateKey> write routines are retained for compatibility.
436New applications should write private keys using the
437PEM_write_bio_PKCS8PrivateKey() or PEM_write_PKCS8PrivateKey() routines
438because they are more secure (they use an iteration count of 2048 whereas
439the traditional routines use a count of 1) unless compatibility with older
440versions of OpenSSL is important.
441
442The B<PrivateKey> read routines can be used in all applications because
443they handle all formats transparently.
444
445A frequent cause of problems is attempting to use the PEM routines like
446this:
447
448 X509 *x;
449 PEM_read_bio_X509(bp, &x, 0, NULL);
450
451this is a bug because an attempt will be made to reuse the data at B<x>
452which is an uninitialised pointer.
453
454=head1 PEM ENCRYPTION FORMAT
455
456This old B<PrivateKey> routines use a non standard technique for encryption.
457
458The private key (or other data) takes the following form:
459
460 -----BEGIN RSA PRIVATE KEY-----
461 Proc-Type: 4,ENCRYPTED
462 DEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89
463
464 ...base64 encoded data...
465 -----END RSA PRIVATE KEY-----
466
467The line beginning DEK-Info contains two comma separated pieces of information:
468the encryption algorithm name as used by EVP_get_cipherbyname() and an 8
469byte B<salt> encoded as a set of hexadecimal digits.
470
471After this is the base64 encoded encrypted data.
472
473The encryption key is determined using EVP_bytestokey(), using B<salt> and an
474iteration count of 1. The IV used is the value of B<salt> and *not* the IV
475returned by EVP_bytestokey().
476
477=head1 BUGS
478
479The PEM read routines in some versions of OpenSSL will not correctly reuse
480an existing structure. Therefore the following:
481
482 PEM_read_bio_X509(bp, &x, 0, NULL);
483
484where B<x> already contains a valid certificate, may not work, whereas:
485
486 X509_free(x);
487 x = PEM_read_bio_X509(bp, NULL, 0, NULL);
488
489is guaranteed to work.
490
491=head1 RETURN CODES
492
493The read routines return either a pointer to the structure read or NULL
494if an error occurred.
495
496The write routines return 1 for success or 0 for failure.
497
498=cut
diff --git a/src/lib/libcrypto/doc/PEM_write_bio_PKCS7_stream.pod b/src/lib/libcrypto/doc/PEM_write_bio_PKCS7_stream.pod
deleted file mode 100644
index 16fc9b6845..0000000000
--- a/src/lib/libcrypto/doc/PEM_write_bio_PKCS7_stream.pod
+++ /dev/null
@@ -1,41 +0,0 @@
1=pod
2
3=head1 NAME
4
5PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10 #include <openssl/pem.h>
11
12 int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
13
14=head1 DESCRIPTION
15
16PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format.
17
18It is otherwise identical to the function SMIME_write_PKCS7().
19
20=head1 NOTES
21
22This function is effectively a version of the PEM_write_bio_PKCS7() supporting
23streaming.
24
25=head1 RETURN VALUES
26
27PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure.
28
29=head1 SEE ALSO
30
31L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
32L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
33L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
34L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
35L<i2d_PKCS7_bio_stream(3)|i2d_PKCS7_bio_stream(3)>
36
37=head1 HISTORY
38
39PEM_write_bio_PKCS7_stream() was added to OpenSSL 1.0.0
40
41=cut
diff --git a/src/lib/libcrypto/doc/PKCS12_create.pod b/src/lib/libcrypto/doc/PKCS12_create.pod
deleted file mode 100644
index 3b27c11a10..0000000000
--- a/src/lib/libcrypto/doc/PKCS12_create.pod
+++ /dev/null
@@ -1,73 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS12_create - create a PKCS#12 structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs12.h>
10
11 PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey,
12 X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,
13 int iter, int mac_iter, int keytype);
14
15=head1 DESCRIPTION
16
17PKCS12_create() creates a PKCS#12 structure.
18
19B<pass> is the passphrase to use. B<name> is the B<friendlyName> to use for
20the supplied certificate and key. B<pkey> is the private key to include in
21the structure and B<cert> its corresponding certificates. B<ca> is an optional
22set of certificates to also include in the structure.
23Either B<pkey>, B<cert> or both can be B<NULL> to indicate that no key or
24certificate is required.
25
26B<nid_key> and B<nid_cert> are the encryption algorithms that should be used
27for the key and certificate respectively. If either B<nid_key> or B<nid_cert>
28is set to -1, no encryption will be used.
29
30B<iter> is the encryption algorithm iteration count to use and B<mac_iter> is
31the MAC iteration count to use. If B<mac_iter> is set to -1, the MAC will be
32omitted entirely.
33
34B<keytype> is the type of key.
35
36=head1 NOTES
37
38The parameters B<nid_key>, B<nid_cert>, B<iter>, B<mac_iter> and B<keytype>
39can all be set to zero and sensible defaults will be used.
40
41These defaults are: 40 bit RC2 encryption for certificates, triple DES
42encryption for private keys, a key iteration count of PKCS12_DEFAULT_ITER
43(currently 2048) and a MAC iteration count of 1.
44
45The default MAC iteration count is 1 in order to retain compatibility with
46old software which did not interpret MAC iteration counts. If such compatibility
47is not required then B<mac_iter> should be set to PKCS12_DEFAULT_ITER.
48
49B<keytype> adds a flag to the store private key. This is a non standard
50extension that is only currently interpreted by MSIE. If set to zero the flag
51is omitted, if set to B<KEY_SIG> the key can be used for signing only, if set
52to B<KEY_EX> it can be used for signing and encryption. This option was useful
53for old export grade software which could use signing only keys of arbitrary
54size but had restrictions on the permissible sizes of keys which could be used
55for encryption.
56
57If a certificate contains an B<alias> or B<keyid> then this will be
58used for the corresponding B<friendlyName> or B<localKeyID> in the
59PKCS12 structure.
60
61=head1 SEE ALSO
62
63L<d2i_PKCS12(3)|d2i_PKCS12(3)>
64
65=head1 HISTORY
66
67PKCS12_create was added in OpenSSL 0.9.3.
68
69Before OpenSSL 0.9.8, neither B<pkey> nor B<cert> were allowed to be B<NULL>,
70and a value of B<-1> was not allowed for B<nid_key>, B<nid_cert> and
71B<mac_iter>.
72
73=cut
diff --git a/src/lib/libcrypto/doc/PKCS12_parse.pod b/src/lib/libcrypto/doc/PKCS12_parse.pod
deleted file mode 100644
index c54cf2ad61..0000000000
--- a/src/lib/libcrypto/doc/PKCS12_parse.pod
+++ /dev/null
@@ -1,57 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS12_parse - parse a PKCS#12 structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs12.h>
10
11int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca);
12
13=head1 DESCRIPTION
14
15PKCS12_parse() parses a PKCS12 structure.
16
17B<p12> is the B<PKCS12> structure to parse. B<pass> is the passphrase to use.
18If successful the private key will be written to B<*pkey>, the corresponding
19certificate to B<*cert> and any additional certificates to B<*ca>.
20
21=head1 NOTES
22
23The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in
24which case additional certificates will be discarded. B<*ca> can also be a
25valid STACK in which case additional certificates are appended to B<*ca>. If
26B<*ca> is B<NULL> a new STACK will be allocated.
27
28The B<friendlyName> and B<localKeyID> attributes (if present) on each
29certificate will be stored in the B<alias> and B<keyid> attributes of the
30B<X509> structure.
31
32=head1 RETURN VALUES
33
34PKCS12_parse() returns 1 for success and zero if an error occurred.
35
36The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
37
38=head1 BUGS
39
40Only a single private key and corresponding certificate is returned by this
41function. More complex PKCS#12 files with multiple private keys will only
42return the first match.
43
44Only B<friendlyName> and B<localKeyID> attributes are currently stored in
45certificates. Other attributes are discarded.
46
47Attributes currently cannot be stored in the private key B<EVP_PKEY> structure.
48
49=head1 SEE ALSO
50
51L<d2i_PKCS12(3)|d2i_PKCS12(3)>
52
53=head1 HISTORY
54
55PKCS12_parse was added in OpenSSL 0.9.3
56
57=cut
diff --git a/src/lib/libcrypto/doc/PKCS5_PBKDF2_HMAC.pod b/src/lib/libcrypto/doc/PKCS5_PBKDF2_HMAC.pod
deleted file mode 100644
index 0c164a0ed6..0000000000
--- a/src/lib/libcrypto/doc/PKCS5_PBKDF2_HMAC.pod
+++ /dev/null
@@ -1,64 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS5_PBKDF2_HMAC, PKCS5_PBKDF2_HMAC_SHA1 - password based derivation routines with salt and iteration count
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
12 const unsigned char *salt, int saltlen, int iter,
13 const EVP_MD *digest,
14 int keylen, unsigned char *out);
15
16int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
17 const unsigned char *salt, int saltlen, int iter,
18 int keylen, unsigned char *out);
19
20=head1 DESCRIPTION
21
22PKCS5_PBKDF2_HMAC() derives a key from a password using a salt and iteration count
23as specified in RFC 2898.
24
25B<pass> is the password used in the derivation of length B<passlen>. B<pass>
26is an optional parameter and can be NULL. If B<passlen> is -1, then the
27function will calculate the length of B<pass> using strlen().
28
29B<salt> is the salt used in the derivation of length B<saltlen>. If the
30B<salt> is NULL, then B<saltlen> must be 0. The function will not
31attempt to calculate the length of the B<salt> because it is not assumed to
32be NULL terminated.
33
34B<iter> is the iteration count and its value should be greater than or
35equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any
36B<iter> less than 1 is treated as a single iteration.
37
38B<digest> is the message digest function used in the derivation. Values include
39any of the EVP_* message digests. PKCS5_PBKDF2_HMAC_SHA1() calls
40PKCS5_PBKDF2_HMAC() with EVP_sha1().
41
42The derived key will be written to B<out>. The size of the B<out> buffer
43is specified via B<keylen>.
44
45=head1 NOTES
46
47A typical application of this function is to derive keying material for an
48encryption algorithm from a password in the B<pass>, a salt in B<salt>,
49and an iteration count.
50
51Increasing the B<iter> parameter slows down the algorithm which makes it
52harder for an attacker to perform a brute force attack using a large number
53of candidate passwords.
54
55=head1 RETURN VALUES
56
57PKCS5_PBKDF2_HMAC() and PBKCS5_PBKDF2_HMAC_SHA1() return 1 on success or 0 on error.
58
59=head1 SEE ALSO
60
61L<evp(3)|evp(3)>, L<rand(3)|rand(3)>,
62L<EVP_BytesToKey(3)|EVP_BytesToKey(3)>
63
64=cut
diff --git a/src/lib/libcrypto/doc/PKCS7_decrypt.pod b/src/lib/libcrypto/doc/PKCS7_decrypt.pod
deleted file mode 100644
index 78919998ce..0000000000
--- a/src/lib/libcrypto/doc/PKCS7_decrypt.pod
+++ /dev/null
@@ -1,57 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15PKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData
16structure. B<pkey> is the private key of the recipient, B<cert> is the
17recipients certificate, B<data> is a BIO to write the content to and
18B<flags> is an optional set of flags.
19
20=head1 NOTES
21
22OpenSSL_add_all_algorithms() (or equivalent) should be called before using this
23function or errors about unknown algorithms will occur.
24
25Although the recipients certificate is not needed to decrypt the data it is
26needed to locate the appropriate (of possible several) recipients in the PKCS#7
27structure.
28
29The following flags can be passed in the B<flags> parameter.
30
31If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted
32from the content. If the content is not of type B<text/plain> then an error is
33returned.
34
35=head1 RETURN VALUES
36
37PKCS7_decrypt() returns either 1 for success or 0 for failure.
38The error can be obtained from ERR_get_error(3)
39
40=head1 BUGS
41
42PKCS7_decrypt() must be passed the correct recipient key and certificate. It
43would be better if it could look up the correct key and certificate from a
44database.
45
46The lack of single pass processing and need to hold all data in memory as
47mentioned in PKCS7_sign() also applies to PKCS7_verify().
48
49=head1 SEE ALSO
50
51L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
52
53=head1 HISTORY
54
55PKCS7_decrypt() was added to OpenSSL 0.9.5
56
57=cut
diff --git a/src/lib/libcrypto/doc/PKCS7_encrypt.pod b/src/lib/libcrypto/doc/PKCS7_encrypt.pod
deleted file mode 100644
index 8bc77407b9..0000000000
--- a/src/lib/libcrypto/doc/PKCS7_encrypt.pod
+++ /dev/null
@@ -1,73 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS7_encrypt - create a PKCS#7 envelopedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags);
12
13=head1 DESCRIPTION
14
15PKCS7_encrypt() creates and returns a PKCS#7 envelopedData structure. B<certs>
16is a list of recipient certificates. B<in> is the content to be encrypted.
17B<cipher> is the symmetric cipher to use. B<flags> is an optional set of flags.
18
19=head1 NOTES
20
21Only RSA keys are supported in PKCS#7 and envelopedData so the recipient
22certificates supplied to this function must all contain RSA public keys, though
23they do not have to be signed using the RSA algorithm.
24
25The algorithm passed in the B<cipher> parameter must support ASN1 encoding of
26its parameters.
27
28Many browsers implement a "sign and encrypt" option which is simply an S/MIME
29envelopedData containing an S/MIME signed message. This can be readily produced
30by storing the S/MIME signed message in a memory BIO and passing it to
31PKCS7_encrypt().
32
33The following flags can be passed in the B<flags> parameter.
34
35If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are
36prepended to the data.
37
38Normally the supplied content is translated into MIME canonical format (as
39required by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation
40occurs. This option should be used if the supplied data is in binary format
41otherwise the translation will corrupt it. If B<PKCS7_BINARY> is set then
42B<PKCS7_TEXT> is ignored.
43
44If the B<PKCS7_STREAM> flag is set a partial B<PKCS7> structure is output
45suitable for streaming I/O: no data is read from the BIO B<in>.
46
47=head1 NOTES
48
49If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<not>
50complete and outputting its contents via a function that does not
51properly finalize the B<PKCS7> structure will give unpredictable
52results.
53
54Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(),
55PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization
56can be performed by obtaining the streaming ASN1 B<BIO> directly using
57BIO_new_PKCS7().
58
59=head1 RETURN VALUES
60
61PKCS7_encrypt() returns either a PKCS7 structure or NULL if an error occurred.
62The error can be obtained from ERR_get_error(3).
63
64=head1 SEE ALSO
65
66L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>
67
68=head1 HISTORY
69
70PKCS7_decrypt() was added to OpenSSL 0.9.5
71The B<PKCS7_STREAM> flag was first supported in OpenSSL 1.0.0.
72
73=cut
diff --git a/src/lib/libcrypto/doc/PKCS7_sign.pod b/src/lib/libcrypto/doc/PKCS7_sign.pod
deleted file mode 100644
index 64a3036c0a..0000000000
--- a/src/lib/libcrypto/doc/PKCS7_sign.pod
+++ /dev/null
@@ -1,116 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS7_sign - create a PKCS#7 signedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert> is
16the certificate to sign with, B<pkey> is the corresponding private key.
17B<certs> is an optional additional set of certificates to include in the PKCS#7
18structure (for example any intermediate CAs in the chain).
19
20The data to be signed is read from BIO B<data>.
21
22B<flags> is an optional set of flags.
23
24=head1 NOTES
25
26Any of the following flags (ored together) can be passed in the B<flags>
27parameter.
28
29Many S/MIME clients expect the signed content to include valid MIME headers. If
30the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended
31to the data.
32
33If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the
34PKCS7 structure, the signer's certificate must still be supplied in the
35B<signcert> parameter though. This can reduce the size of the signature if the
36signers certificate can be obtained by other means: for example a previously
37signed message.
38
39The data being signed is included in the PKCS7 structure, unless
40B<PKCS7_DETACHED> is set in which case it is omitted. This is used for PKCS7
41detached signatures which are used in S/MIME plaintext signed messages for
42example.
43
44Normally the supplied content is translated into MIME canonical format (as
45required by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation
46occurs. This option should be used if the supplied data is in binary format
47otherwise the translation will corrupt it.
48
49The signedData structure includes several PKCS#7 authenticatedAttributes
50including the signing time, the PKCS#7 content type and the supported list of
51ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no
52authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just
53the SMIMECapabilities are omitted.
54
55If present the SMIMECapabilities attribute indicates support for the following
56algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of
57these algorithms is disabled then it will not be included.
58
59If the flags B<PKCS7_STREAM> is set then the returned B<PKCS7> structure is
60just initialized ready to perform the signing operation. The signing is however
61B<not> performed and the data to be signed is not read from the B<data>
62parameter. Signing is deferred until after the data has been written. In this
63way data can be signed in a single pass.
64
65If the B<PKCS7_PARTIAL> flag is set a partial B<PKCS7> structure is output to
66which additional signers and capabilities can be added before finalization.
67
68
69=head1 NOTES
70
71If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<not>
72complete and outputting its contents via a function that does not properly
73finalize the B<PKCS7> structure will give unpredictable results.
74
75Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(),
76PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization
77can be performed by obtaining the streaming ASN1 B<BIO> directly using
78BIO_new_PKCS7().
79
80If a signer is specified it will use the default digest for the signing
81algorithm. This is B<SHA1> for both RSA and DSA keys.
82
83In OpenSSL 1.0.0 the B<certs>, B<signcert> and B<pkey> parameters can all be
84B<NULL> if the B<PKCS7_PARTIAL> flag is set. One or more signers can be added
85using the function B<PKCS7_sign_add_signer()>. B<PKCS7_final()> must also be
86called to finalize the structure if streaming is not enabled. Alternative
87signing digests can also be specified using this method.
88
89In OpenSSL 1.0.0 if B<signcert> and B<pkey> are NULL then a certificates only
90PKCS#7 structure is output.
91
92In versions of OpenSSL before 1.0.0 the B<signcert> and B<pkey> parameters must
93B<NOT> be NULL.
94
95=head1 BUGS
96
97Some advanced attributes such as counter signatures are not supported.
98
99=head1 RETURN VALUES
100
101PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error
102occurred. The error can be obtained from ERR_get_error(3).
103
104=head1 SEE ALSO
105
106L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_verify(3)|PKCS7_verify(3)>
107
108=head1 HISTORY
109
110PKCS7_sign() was added to OpenSSL 0.9.5
111
112The B<PKCS7_PARTIAL> flag was added in OpenSSL 1.0.0
113
114The B<PKCS7_STREAM> flag was added in OpenSSL 1.0.0
115
116=cut
diff --git a/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod b/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod
deleted file mode 100644
index 280455d476..0000000000
--- a/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod
+++ /dev/null
@@ -1,87 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS7_sign_add_signer - add a signer PKCS7 signed data structure.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags);
12
13
14=head1 DESCRIPTION
15
16PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private
17key B<pkey> using message digest B<md> to a PKCS7 signed data structure
18B<p7>.
19
20The PKCS7 structure should be obtained from an initial call to PKCS7_sign()
21with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7
22signed data structure.
23
24If the B<md> parameter is B<NULL> then the default digest for the public
25key algorithm will be used.
26
27Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure
28is not complete and must be finalized either by streaming (if applicable) or
29a call to PKCS7_final().
30
31
32=head1 NOTES
33
34The main purpose of this function is to provide finer control over a PKCS#7
35signed data structure where the simpler PKCS7_sign() function defaults are
36not appropriate. For example if multiple signers or non default digest
37algorithms are needed.
38
39Any of the following flags (ored together) can be passed in the B<flags>
40parameter.
41
42If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content
43digest value from the PKCS7 structure: to add a signer to an existing structure.
44An error occurs if a matching digest value cannot be found to copy. The
45returned PKCS7 structure will be valid and finalized when this flag is set.
46
47If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the
48B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes
49can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is
50needed to finalize it.
51
52If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the
53PKCS7 structure, the signer's certificate must still be supplied in the
54B<signcert> parameter though. This can reduce the size of the signature if the
55signers certificate can be obtained by other means: for example a previously
56signed message.
57
58The signedData structure includes several PKCS#7 authenticatedAttributes
59including the signing time, the PKCS#7 content type and the supported list of
60ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no
61authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just
62the SMIMECapabilities are omitted.
63
64If present the SMIMECapabilities attribute indicates support for the following
65algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of
66these algorithms is disabled then it will not be included.
67
68
69PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
70structure just added, this can be used to set additional attributes
71before it is finalized.
72
73=head1 RETURN VALUES
74
75PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
76structure just added or NULL if an error occurs.
77
78=head1 SEE ALSO
79
80L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
81L<PKCS7_final(3)|PKCS7_final(3)>,
82
83=head1 HISTORY
84
85PPKCS7_sign_add_signer() was added to OpenSSL 1.0.0
86
87=cut
diff --git a/src/lib/libcrypto/doc/PKCS7_verify.pod b/src/lib/libcrypto/doc/PKCS7_verify.pod
deleted file mode 100644
index 059fbff8e9..0000000000
--- a/src/lib/libcrypto/doc/PKCS7_verify.pod
+++ /dev/null
@@ -1,118 +0,0 @@
1=pod
2
3=head1 NAME
4
5PKCS7_verify, PKCS7_get0_signers - verify a PKCS#7 signedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags);
12
13 STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
14
15=head1 DESCRIPTION
16
17PKCS7_verify() verifies a PKCS#7 signedData structure. B<p7> is the PKCS7
18structure to verify. B<certs> is a set of certificates in which to search for
19the signer's certificate. B<store> is a trusted certificate store (used for
20chain verification). B<indata> is the signed data if the content is not
21present in B<p7> (that is it is detached). The content is written to B<out>
22if it is not NULL.
23
24B<flags> is an optional set of flags, which can be used to modify the verify
25operation.
26
27PKCS7_get0_signers() retrieves the signer's certificates from B<p7>, it does
28B<not> check their validity or whether any signatures are valid. The B<certs>
29and B<flags> parameters have the same meanings as in PKCS7_verify().
30
31=head1 VERIFY PROCESS
32
33Normally the verify process proceeds as follows.
34
35Initially some sanity checks are performed on B<p7>. The type of B<p7> must
36be signedData. There must be at least one signature on the data and if
37the content is detached B<indata> cannot be B<NULL>.
38
39An attempt is made to locate all the signer's certificates, first looking in
40the B<certs> parameter (if it is not B<NULL>) and then looking in any
41certificates contained in the B<p7> structure itself. If any signer's
42certificates cannot be located the operation fails.
43
44Each signer's certificate is chain verified using the B<smimesign> purpose and
45the supplied trusted certificate store. Any internal certificates in the message
46are used as untrusted CAs. If any chain verify fails an error code is returned.
47
48Finally the signed content is read (and written to B<out> is it is not NULL) and
49the signature's checked.
50
51If all signature's verify correctly then the function is successful.
52
53Any of the following flags (ored together) can be passed in the B<flags>
54parameter to change the default verify behaviour. Only the flag
55B<PKCS7_NOINTERN> is meaningful to PKCS7_get0_signers().
56
57If B<PKCS7_NOINTERN> is set the certificates in the message itself are not
58searched when locating the signer's certificate. This means that all the signers
59certificates must be in the B<certs> parameter.
60
61If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted
62from the content. If the content is not of type B<text/plain> then an error is
63returned.
64
65If B<PKCS7_NOVERIFY> is set the signer's certificates are not chain verified.
66
67If B<PKCS7_NOCHAIN> is set then the certificates contained in the message are
68not used as untrusted CAs. This means that the whole verify chain (apart from
69the signer's certificate) must be contained in the trusted store.
70
71If B<PKCS7_NOSIGS> is set then the signatures on the data are not checked.
72
73=head1 NOTES
74
75One application of B<PKCS7_NOINTERN> is to only accept messages signed by
76a small number of certificates. The acceptable certificates would be passed
77in the B<certs> parameter. In this case if the signer is not one of the
78certificates supplied in B<certs> then the verify will fail because the
79signer cannot be found.
80
81Care should be taken when modifying the default verify behaviour, for example
82setting B<PKCS7_NOVERIFY|PKCS7_NOSIGS> will totally disable all verification
83and any signed message will be considered valid. This combination is however
84useful if one merely wishes to write the content to B<out> and its validity
85is not considered important.
86
87Chain verification should arguably be performed using the signing time rather
88than the current time. However since the signing time is supplied by the
89signer it cannot be trusted without additional evidence (such as a trusted
90timestamp).
91
92=head1 RETURN VALUES
93
94PKCS7_verify() returns 1 for a successful verification and zero or a negative
95value if an error occurs.
96
97PKCS7_get0_signers() returns all signers or B<NULL> if an error occurred.
98
99The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
100
101=head1 BUGS
102
103The trusted certificate store is not searched for the signers certificate,
104this is primarily due to the inadequacies of the current B<X509_STORE>
105functionality.
106
107The lack of single pass processing and need to hold all data in memory as
108mentioned in PKCS7_sign() also applies to PKCS7_verify().
109
110=head1 SEE ALSO
111
112L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>
113
114=head1 HISTORY
115
116PKCS7_verify() was added to OpenSSL 0.9.5
117
118=cut
diff --git a/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod b/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod
deleted file mode 100644
index 9d46715941..0000000000
--- a/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod
+++ /dev/null
@@ -1,73 +0,0 @@
1=pod
2
3=head1 NAME
4
5SMIME_read_PKCS7 - parse S/MIME message.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont);
12
13=head1 DESCRIPTION
14
15SMIME_read_PKCS7() parses a message in S/MIME format.
16
17B<in> is a BIO to read the message from.
18
19If cleartext signing is used then the content is saved in
20a memory bio which is written to B<*bcont>, otherwise
21B<*bcont> is set to B<NULL>.
22
23The parsed PKCS#7 structure is returned or B<NULL> if an
24error occurred.
25
26=head1 NOTES
27
28If B<*bcont> is not B<NULL> then the message is clear text
29signed. B<*bcont> can then be passed to PKCS7_verify() with
30the B<PKCS7_DETACHED> flag set.
31
32Otherwise the type of the returned structure can be determined
33using PKCS7_type().
34
35To support future functionality if B<bcont> is not B<NULL>
36B<*bcont> should be initialized to B<NULL>. For example:
37
38 BIO *cont = NULL;
39 PKCS7 *p7;
40
41 p7 = SMIME_read_PKCS7(in, &cont);
42
43=head1 BUGS
44
45The MIME parser used by SMIME_read_PKCS7() is somewhat primitive.
46While it will handle most S/MIME messages more complex compound
47formats may not work.
48
49The parser assumes that the PKCS7 structure is always base64
50encoded and will not handle the case where it is in binary format
51or uses quoted printable format.
52
53The use of a memory BIO to hold the signed content limits the size
54of message which can be processed due to memory restraints: a
55streaming single pass option should be available.
56
57=head1 RETURN VALUES
58
59SMIME_read_PKCS7() returns a valid B<PKCS7> structure or B<NULL>
60is an error occurred. The error can be obtained from ERR_get_error(3).
61
62=head1 SEE ALSO
63
64L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_type(3)|PKCS7_type(3)>
65L<SMIME_read_PKCS7(3)|SMIME_read_PKCS7(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
66L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
67L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>
68
69=head1 HISTORY
70
71SMIME_read_PKCS7() was added to OpenSSL 0.9.5
72
73=cut
diff --git a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod b/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod
deleted file mode 100644
index 4a7cd08c42..0000000000
--- a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod
+++ /dev/null
@@ -1,65 +0,0 @@
1=pod
2
3=head1 NAME
4
5SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7
16structure to produce an S/MIME message.
17
18B<out> is the BIO to write the data to. B<p7> is the appropriate B<PKCS7>
19structure. If streaming is enabled then the content must be supplied in the
20B<data> argument. B<flags> is an optional set of flags.
21
22=head1 NOTES
23
24The following flags can be passed in the B<flags> parameter.
25
26If B<PKCS7_DETACHED> is set then cleartext signing will be used,
27this option only makes sense for signedData where B<PKCS7_DETACHED>
28is also set when PKCS7_sign() is also called.
29
30If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain>
31are added to the content, this only makes sense if B<PKCS7_DETACHED>
32is also set.
33
34If the B<PKCS7_STREAM> flag is set streaming is performed. This flag should
35only be set if B<PKCS7_STREAM> was also set in the previous call to
36PKCS7_sign() or B<PKCS7_encrypt()>.
37
38If cleartext signing is being used and B<PKCS7_STREAM> not set then
39the data must be read twice: once to compute the signature in PKCS7_sign()
40and once to output the S/MIME message.
41
42If streaming is performed the content is output in BER format using indefinite
43length constructed encoding except in the case of signed data with detached
44content where the content is absent and DER format is used.
45
46=head1 BUGS
47
48SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there
49should be an option to disable this.
50
51=head1 RETURN VALUES
52
53SMIME_write_PKCS7() returns 1 for success or 0 for failure.
54
55=head1 SEE ALSO
56
57L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
58L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
59L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>
60
61=head1 HISTORY
62
63SMIME_write_PKCS7() was added to OpenSSL 0.9.5
64
65=cut
diff --git a/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod b/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod
deleted file mode 100644
index a37231e267..0000000000
--- a/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod
+++ /dev/null
@@ -1,44 +0,0 @@
1=pod
2
3=head1 NAME
4
5i2d_PKCS7_bio_stream - output PKCS7 structure in BER format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.
16
17It is otherwise identical to the function SMIME_write_PKCS7().
18
19=head1 NOTES
20
21This function is effectively a version of the d2i_PKCS7_bio() supporting
22streaming.
23
24=head1 BUGS
25
26The prefix "i2d" is arguably wrong because the function outputs BER format.
27
28=head1 RETURN VALUES
29
30i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.
31
32=head1 SEE ALSO
33
34L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
35L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
36L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
37L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
38L<PEM_write_bio_PKCS7_stream(3)|PEM_write_bio_PKCS7_stream(3)>
39
40=head1 HISTORY
41
42i2d_PKCS7_bio_stream() was added to OpenSSL 1.0.0
43
44=cut