diff options
Diffstat (limited to 'src/lib/libcrypto/doc')
42 files changed, 2611 insertions, 127 deletions
diff --git a/src/lib/libcrypto/doc/EVP_DigestSignInit.pod b/src/lib/libcrypto/doc/EVP_DigestSignInit.pod new file mode 100644 index 0000000000..37d960e3b2 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_DigestSignInit.pod | |||
@@ -0,0 +1,87 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal - EVP signing functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
12 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
13 | int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
14 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP signature routines are a high level interface to digital signatures. | ||
19 | |||
20 | EVP_DigestSignInit() sets up signing context B<ctx> to use digest B<type> from | ||
21 | ENGINE B<impl> and private key B<pkey>. B<ctx> must be initialized with | ||
22 | EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the | ||
23 | EVP_PKEY_CTX of the signing operation will be written to B<*pctx>: this can | ||
24 | be used to set alternative signing options. | ||
25 | |||
26 | EVP_DigestSignUpdate() hashes B<cnt> bytes of data at B<d> into the | ||
27 | signature context B<ctx>. This function can be called several times on the | ||
28 | same B<ctx> to include additional data. This function is currently implemented | ||
29 | usig a macro. | ||
30 | |||
31 | EVP_DigestSignFinal() signs the data in B<ctx> places the signature in B<sig>. | ||
32 | If B<sig> is B<NULL> then the maximum size of the output buffer is written to | ||
33 | the B<siglen> parameter. If B<sig> is not B<NULL> then before the call the | ||
34 | B<siglen> parameter should contain the length of the B<sig> buffer, if the | ||
35 | call is successful the signature is written to B<sig> and the amount of data | ||
36 | written to B<siglen>. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | EVP_DigestSignInit() EVP_DigestSignUpdate() and EVP_DigestSignaFinal() return | ||
41 | 1 for success and 0 or a negative value for failure. In particular a return | ||
42 | value of -2 indicates the operation is not supported by the public key | ||
43 | algorithm. | ||
44 | |||
45 | The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
46 | |||
47 | =head1 NOTES | ||
48 | |||
49 | The B<EVP> interface to digital signatures should almost always be used in | ||
50 | preference to the low level interfaces. This is because the code then becomes | ||
51 | transparent to the algorithm used and much more flexible. | ||
52 | |||
53 | In previous versions of OpenSSL there was a link between message digest types | ||
54 | and public key algorithms. This meant that "clone" digests such as EVP_dss1() | ||
55 | needed to be used to sign using SHA1 and DSA. This is no longer necessary and | ||
56 | the use of clone digest is now discouraged. | ||
57 | |||
58 | For some key types and parameters the random number generator must be seeded | ||
59 | or the operation will fail. | ||
60 | |||
61 | The call to EVP_DigestSignFinal() internally finalizes a copy of the digest | ||
62 | context. This means that calls to EVP_DigestSignUpdate() and | ||
63 | EVP_DigestSignFinal() can be called later to digest and sign additional data. | ||
64 | |||
65 | Since only a copy of the digest context is ever finalized the context must | ||
66 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
67 | will occur. | ||
68 | |||
69 | The use of EVP_PKEY_size() with these functions is discouraged because some | ||
70 | signature operations may have a signature length which depends on the | ||
71 | parameters set. As a result EVP_PKEY_size() would have to return a value | ||
72 | which indicates the maximum possible signature for any set of parameters. | ||
73 | |||
74 | =head1 SEE ALSO | ||
75 | |||
76 | L<EVP_DigestVerifyInit(3)|EVP_DigestVerifyInit(3)>, | ||
77 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | ||
78 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | ||
79 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | ||
80 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | ||
81 | |||
82 | =head1 HISTORY | ||
83 | |||
84 | EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal() | ||
85 | were first added to OpenSSL 1.0.0. | ||
86 | |||
87 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_DigestVerifyInit.pod b/src/lib/libcrypto/doc/EVP_DigestVerifyInit.pod new file mode 100644 index 0000000000..f224488978 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_DigestVerifyInit.pod | |||
@@ -0,0 +1,82 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal - EVP signature verification functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
12 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
13 | int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
14 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP signature routines are a high level interface to digital signatures. | ||
19 | |||
20 | EVP_DigestVerifyInit() sets up verification context B<ctx> to use digest | ||
21 | B<type> from ENGINE B<impl> and public key B<pkey>. B<ctx> must be initialized | ||
22 | with EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the | ||
23 | EVP_PKEY_CTX of the verification operation will be written to B<*pctx>: this | ||
24 | can be used to set alternative verification options. | ||
25 | |||
26 | EVP_DigestVerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | ||
27 | verification context B<ctx>. This function can be called several times on the | ||
28 | same B<ctx> to include additional data. This function is currently implemented | ||
29 | using a macro. | ||
30 | |||
31 | EVP_DigestVerifyFinal() verifies the data in B<ctx> against the signature in | ||
32 | B<sig> of length B<siglen>. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success and 0 | ||
37 | or a negative value for failure. In particular a return value of -2 indicates | ||
38 | the operation is not supported by the public key algorithm. | ||
39 | |||
40 | Unlike other functions the return value 0 from EVP_DigestVerifyFinal() only | ||
41 | indicates that the signature did not not verify successfully (that is tbs did | ||
42 | not match the original data or the signature was of invalid form) it is not an | ||
43 | indication of a more serious error. | ||
44 | |||
45 | The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
46 | |||
47 | =head1 NOTES | ||
48 | |||
49 | The B<EVP> interface to digital signatures should almost always be used in | ||
50 | preference to the low level interfaces. This is because the code then becomes | ||
51 | transparent to the algorithm used and much more flexible. | ||
52 | |||
53 | In previous versions of OpenSSL there was a link between message digest types | ||
54 | and public key algorithms. This meant that "clone" digests such as EVP_dss1() | ||
55 | needed to be used to sign using SHA1 and DSA. This is no longer necessary and | ||
56 | the use of clone digest is now discouraged. | ||
57 | |||
58 | For some key types and parameters the random number generator must be seeded | ||
59 | or the operation will fail. | ||
60 | |||
61 | The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest | ||
62 | context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can | ||
63 | be called later to digest and verify additional data. | ||
64 | |||
65 | Since only a copy of the digest context is ever finalized the context must | ||
66 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
67 | will occur. | ||
68 | |||
69 | =head1 SEE ALSO | ||
70 | |||
71 | L<EVP_DigestSignInit(3)|EVP_DigestSignInit(3)>, | ||
72 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | ||
73 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | ||
74 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | ||
75 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | ||
76 | |||
77 | =head1 HISTORY | ||
78 | |||
79 | EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal() | ||
80 | were first added to OpenSSL 1.0.0. | ||
81 | |||
82 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_CTX_ctrl.pod b/src/lib/libcrypto/doc/EVP_PKEY_CTX_ctrl.pod new file mode 100644 index 0000000000..f2f455990f --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_CTX_ctrl.pod | |||
@@ -0,0 +1,128 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_ctrl, EVP_PKEY_ctrl_str - algorithm specific control operations | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | ||
12 | int cmd, int p1, void *p2); | ||
13 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, | ||
14 | const char *value); | ||
15 | |||
16 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | ||
17 | |||
18 | #include <openssl/rsa.h> | ||
19 | |||
20 | int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); | ||
21 | |||
22 | int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad); | ||
23 | int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len); | ||
24 | int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits); | ||
25 | int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp); | ||
26 | |||
27 | #include <openssl/dsa.h> | ||
28 | int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits); | ||
29 | |||
30 | #include <openssl/dh.h> | ||
31 | int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len); | ||
32 | int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen); | ||
33 | |||
34 | #include <openssl/ec.h> | ||
35 | int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid); | ||
36 | |||
37 | =head1 DESCRIPTION | ||
38 | |||
39 | The function EVP_PKEY_CTX_ctrl() sends a control operation to the context | ||
40 | B<ctx>. The key type used must match B<keytype> if it is not -1. The parameter | ||
41 | B<optype> is a mask indicating which operations the control can be applied to. | ||
42 | The control command is indicated in B<cmd> and any additional arguments in | ||
43 | B<p1> and B<p2>. | ||
44 | |||
45 | Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will | ||
46 | instead call one of the algorithm specific macros below. | ||
47 | |||
48 | The function EVP_PKEY_ctrl_str() allows an application to send an algorithm | ||
49 | specific control operation to a context B<ctx> in string form. This is | ||
50 | intended to be used for options specified on the command line or in text | ||
51 | files. The commands supported are documented in the openssl utility | ||
52 | command line pages for the option B<-pkeyopt> which is supported by the | ||
53 | B<pkeyutl>, B<genpkey> and B<req> commands. | ||
54 | |||
55 | All the remaining "functions" are implemented as macros. | ||
56 | |||
57 | The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type used | ||
58 | in a signature. It can be used with any public key algorithm supporting | ||
59 | signature operations. | ||
60 | |||
61 | The macro EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for B<ctx>. | ||
62 | The B<pad> parameter can take the value RSA_PKCS1_PADDING for PKCS#1 padding, | ||
63 | RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no padding, | ||
64 | RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only), | ||
65 | RSA_X931_PADDING for X9.31 padding (signature operations only) and | ||
66 | RSA_PKCS1_PSS_PADDING (sign and verify only). | ||
67 | |||
68 | Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md() | ||
69 | is used. If this macro is called for PKCS#1 padding the plaintext buffer is | ||
70 | an actual digest value and is encapsulated in a DigestInfo structure according | ||
71 | to PKCS#1 when signing and this structure is expected (and stripped off) when | ||
72 | verifying. If this control is not used with RSA and PKCS#1 padding then the | ||
73 | supplied data is used directly and not encapsulated. In the case of X9.31 | ||
74 | padding for RSA the algorithm identifier byte is added or checked and removed | ||
75 | if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte. | ||
76 | |||
77 | The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt length to | ||
78 | B<len> as its name implies it is only supported for PSS padding. Two special | ||
79 | values are supported: -1 sets the salt length to the digest length. When | ||
80 | signing -2 sets the salt length to the maximum permissible value. When | ||
81 | verifying -2 causes the salt length to be automatically determined based on the | ||
82 | B<PSS> block structure. If this macro is not called a salt length value of -2 | ||
83 | is used by default. | ||
84 | |||
85 | The EVP_PKEY_CTX_set_rsa_rsa_keygen_bits() macro sets the RSA key length for | ||
86 | RSA key genration to B<bits>. If not specified 1024 bits is used. | ||
87 | |||
88 | The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent value | ||
89 | for RSA key generation to B<pubexp> currently it should be an odd integer. The | ||
90 | B<pubexp> pointer is used internally by this function so it should not be | ||
91 | modified or free after the call. If this macro is not called then 65537 is used. | ||
92 | |||
93 | The macro EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used | ||
94 | for DSA parameter generation to B<bits>. If not specified 1024 is used. | ||
95 | |||
96 | The macro EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the DH | ||
97 | prime parameter B<p> for DH parameter generation. If this macro is not called | ||
98 | then 1024 is used. | ||
99 | |||
100 | The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to B<gen> | ||
101 | for DH parameter generation. If not specified 2 is used. | ||
102 | |||
103 | The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC parameter | ||
104 | generation to B<nid>. For EC parameter generation this macro must be called | ||
105 | or an error occurs because there is no default curve. | ||
106 | |||
107 | =head1 RETURN VALUES | ||
108 | |||
109 | EVP_PKEY_CTX_ctrl() and its macros return a positive value for success and 0 | ||
110 | or a negative value for failure. In particular a return value of -2 | ||
111 | indicates the operation is not supported by the public key algorithm. | ||
112 | |||
113 | =head1 SEE ALSO | ||
114 | |||
115 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
116 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
117 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
118 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
119 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
120 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
121 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
122 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
123 | |||
124 | =head1 HISTORY | ||
125 | |||
126 | These functions were first added to OpenSSL 1.0.0. | ||
127 | |||
128 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_CTX_new.pod b/src/lib/libcrypto/doc/EVP_PKEY_CTX_new.pod new file mode 100644 index 0000000000..a9af867580 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_CTX_new.pod | |||
@@ -0,0 +1,52 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free - public key algorithm context functions. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); | ||
12 | EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | ||
13 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); | ||
14 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_CTX_new() function allocates public key algorithm context using | ||
19 | the algorithm specified in B<pkey> and ENGINE B<e>. | ||
20 | |||
21 | The EVP_PKEY_CTX_new_id() function allocates public key algorithm context | ||
22 | using the algorithm specified by B<id> and ENGINE B<e>. It is normally used | ||
23 | when no B<EVP_PKEY> structure is associated with the operations, for example | ||
24 | during parameter generation of key genration for some algorithms. | ||
25 | |||
26 | EVP_PKEY_CTX_dup() duplicates the context B<ctx>. | ||
27 | |||
28 | EVP_PKEY_CTX_free() frees up the context B<ctx>. | ||
29 | |||
30 | =head1 NOTES | ||
31 | |||
32 | The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context used | ||
33 | by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared between | ||
34 | threads: that is it is not permissible to use the same context simultaneously | ||
35 | in two threads. | ||
36 | |||
37 | =head1 RETURN VALUES | ||
38 | |||
39 | EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns either | ||
40 | the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occurred. | ||
41 | |||
42 | EVP_PKEY_CTX_free() does not return a value. | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<EVP_PKEY_new(3)|EVP_PKEY_new(3)> | ||
47 | |||
48 | =head1 HISTORY | ||
49 | |||
50 | These functions were first added to OpenSSL 1.0.0. | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_cmp.pod b/src/lib/libcrypto/doc/EVP_PKEY_cmp.pod new file mode 100644 index 0000000000..4f8185e36c --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_cmp.pod | |||
@@ -0,0 +1,61 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_copy_parameters, EVP_PKEY_missing_parameters, EVP_PKEY_cmp_parameters, EVP_PKEY_cmp - public key parameter and comparison functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | ||
12 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); | ||
13 | |||
14 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | ||
15 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | The function EVP_PKEY_missing_parameters() returns 1 if the public key | ||
20 | parameters of B<pkey> are missing and 0 if they are present or the algorithm | ||
21 | doesn't use parameters. | ||
22 | |||
23 | The function EVP_PKEY_copy_parameters() copies the parameters from key | ||
24 | B<from> to key B<to>. | ||
25 | |||
26 | The funcion EVP_PKEY_cmp_parameters() compares the parameters of keys | ||
27 | B<a> and B<b>. | ||
28 | |||
29 | The funcion EVP_PKEY_cmp() compares the public key components and paramters | ||
30 | (if present) of keys B<a> and B<b>. | ||
31 | |||
32 | =head1 NOTES | ||
33 | |||
34 | The main purpose of the functions EVP_PKEY_missing_parameters() and | ||
35 | EVP_PKEY_copy_parameters() is to handle public keys in certificates where the | ||
36 | parameters are sometimes omitted from a public key if they are inherited from | ||
37 | the CA that signed it. | ||
38 | |||
39 | Since OpenSSL private keys contain public key components too the function | ||
40 | EVP_PKEY_cmp() can also be used to determine if a private key matches | ||
41 | a public key. | ||
42 | |||
43 | =head1 RETURN VALUES | ||
44 | |||
45 | The function EVP_PKEY_missing_parameters() returns 1 if the public key | ||
46 | parameters of B<pkey> are missing and 0 if they are present or the algorithm | ||
47 | doesn't use parameters. | ||
48 | |||
49 | These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for | ||
50 | failure. | ||
51 | |||
52 | The function EVP_PKEY_cmp_parameters() and EVP_PKEY_cmp() return 1 if the | ||
53 | keys match, 0 if they don't match, -1 if the key types are different and | ||
54 | -2 if the operation is not supported. | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
59 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
60 | |||
61 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_decrypt.pod b/src/lib/libcrypto/doc/EVP_PKEY_decrypt.pod new file mode 100644 index 0000000000..42b2a8c44e --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_decrypt.pod | |||
@@ -0,0 +1,93 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_decrypt_init, EVP_PKEY_decrypt - decrypt using a public key algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | ||
13 | unsigned char *out, size_t *outlen, | ||
14 | const unsigned char *in, size_t inlen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_decrypt_init() function initializes a public key algorithm | ||
19 | context using key B<pkey> for a decryption operation. | ||
20 | |||
21 | The EVP_PKEY_decrypt() function performs a public key decryption operation | ||
22 | using B<ctx>. The data to be decrypted is specified using the B<in> and | ||
23 | B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output | ||
24 | buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then | ||
25 | before the call the B<outlen> parameter should contain the length of the | ||
26 | B<out> buffer, if the call is successful the decrypted data is written to | ||
27 | B<out> and the amount of data written to B<outlen>. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | After the call to EVP_PKEY_decrypt_init() algorithm specific control | ||
32 | operations can be performed to set any appropriate parameters for the | ||
33 | operation. | ||
34 | |||
35 | The function EVP_PKEY_decrypt() can be called more than once on the same | ||
36 | context if several operations are performed using the same parameters. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | EVP_PKEY_decrypt_init() and EVP_PKEY_decrypt() return 1 for success and 0 | ||
41 | or a negative value for failure. In particular a return value of -2 | ||
42 | indicates the operation is not supported by the public key algorithm. | ||
43 | |||
44 | =head1 EXAMPLE | ||
45 | |||
46 | Decrypt data using OAEP (for RSA keys): | ||
47 | |||
48 | #include <openssl/evp.h> | ||
49 | #include <openssl/rsa.h> | ||
50 | |||
51 | EVP_PKEY_CTX *ctx; | ||
52 | unsigned char *out, *in; | ||
53 | size_t outlen, inlen; | ||
54 | EVP_PKEY *key; | ||
55 | /* NB: assumes key in, inlen are already set up | ||
56 | * and that key is an RSA private key | ||
57 | */ | ||
58 | ctx = EVP_PKEY_CTX_new(key); | ||
59 | if (!ctx) | ||
60 | /* Error occurred */ | ||
61 | if (EVP_PKEY_decrypt_init(ctx) <= 0) | ||
62 | /* Error */ | ||
63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0) | ||
64 | /* Error */ | ||
65 | |||
66 | /* Determine buffer length */ | ||
67 | if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0) | ||
68 | /* Error */ | ||
69 | |||
70 | out = OPENSSL_malloc(outlen); | ||
71 | |||
72 | if (!out) | ||
73 | /* malloc failure */ | ||
74 | |||
75 | if (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <= 0) | ||
76 | /* Error */ | ||
77 | |||
78 | /* Decrypted data is outlen bytes written to buffer out */ | ||
79 | |||
80 | =head1 SEE ALSO | ||
81 | |||
82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
83 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
84 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
85 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
86 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
87 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
88 | |||
89 | =head1 HISTORY | ||
90 | |||
91 | These functions were first added to OpenSSL 1.0.0. | ||
92 | |||
93 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_derive.pod b/src/lib/libcrypto/doc/EVP_PKEY_derive.pod new file mode 100644 index 0000000000..d9d6d76c72 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_derive.pod | |||
@@ -0,0 +1,93 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public key algorithm shared secret. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | ||
13 | int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | The EVP_PKEY_derive_init() function initializes a public key algorithm | ||
18 | context using key B<pkey> for shared secret derivation. | ||
19 | |||
20 | The EVP_PKEY_derive_set_peer() function sets the peer key: this will normally | ||
21 | be a public key. | ||
22 | |||
23 | The EVP_PKEY_derive() derives a shared secret using B<ctx>. | ||
24 | If B<key> is B<NULL> then the maximum size of the output buffer is written to | ||
25 | the B<keylen> parameter. If B<key> is not B<NULL> then before the call the | ||
26 | B<keylen> parameter should contain the length of the B<key> buffer, if the call | ||
27 | is successful the shared secret is written to B<key> and the amount of data | ||
28 | written to B<keylen>. | ||
29 | |||
30 | =head1 NOTES | ||
31 | |||
32 | After the call to EVP_PKEY_derive_init() algorithm specific control | ||
33 | operations can be performed to set any appropriate parameters for the | ||
34 | operation. | ||
35 | |||
36 | The function EVP_PKEY_derive() can be called more than once on the same | ||
37 | context if several operations are performed using the same parameters. | ||
38 | |||
39 | =head1 RETURN VALUES | ||
40 | |||
41 | EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0 | ||
42 | or a negative value for failure. In particular a return value of -2 | ||
43 | indicates the operation is not supported by the public key algorithm. | ||
44 | |||
45 | =head1 EXAMPLE | ||
46 | |||
47 | Derive shared secret (for example DH or EC keys): | ||
48 | |||
49 | #include <openssl/evp.h> | ||
50 | #include <openssl/rsa.h> | ||
51 | |||
52 | EVP_PKEY_CTX *ctx; | ||
53 | unsigned char *skey; | ||
54 | size_t skeylen; | ||
55 | EVP_PKEY *pkey, *peerkey; | ||
56 | /* NB: assumes pkey, peerkey have been already set up */ | ||
57 | |||
58 | ctx = EVP_PKEY_CTX_new(pkey); | ||
59 | if (!ctx) | ||
60 | /* Error occurred */ | ||
61 | if (EVP_PKEY_derive_init(ctx) <= 0) | ||
62 | /* Error */ | ||
63 | if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0) | ||
64 | /* Error */ | ||
65 | |||
66 | /* Determine buffer length */ | ||
67 | if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) | ||
68 | /* Error */ | ||
69 | |||
70 | skey = OPENSSL_malloc(skeylen); | ||
71 | |||
72 | if (!skey) | ||
73 | /* malloc failure */ | ||
74 | |||
75 | if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0) | ||
76 | /* Error */ | ||
77 | |||
78 | /* Shared secret is skey bytes written to buffer skey */ | ||
79 | |||
80 | =head1 SEE ALSO | ||
81 | |||
82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
83 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
84 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
85 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
86 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
87 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
88 | |||
89 | =head1 HISTORY | ||
90 | |||
91 | These functions were first added to OpenSSL 1.0.0. | ||
92 | |||
93 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_encrypt.pod b/src/lib/libcrypto/doc/EVP_PKEY_encrypt.pod new file mode 100644 index 0000000000..91c9c5d0a5 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_encrypt.pod | |||
@@ -0,0 +1,93 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | ||
13 | unsigned char *out, size_t *outlen, | ||
14 | const unsigned char *in, size_t inlen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_encrypt_init() function initializes a public key algorithm | ||
19 | context using key B<pkey> for an encryption operation. | ||
20 | |||
21 | The EVP_PKEY_encrypt() function performs a public key encryption operation | ||
22 | using B<ctx>. The data to be encrypted is specified using the B<in> and | ||
23 | B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output | ||
24 | buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then | ||
25 | before the call the B<outlen> parameter should contain the length of the | ||
26 | B<out> buffer, if the call is successful the encrypted data is written to | ||
27 | B<out> and the amount of data written to B<outlen>. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | After the call to EVP_PKEY_encrypt_init() algorithm specific control | ||
32 | operations can be performed to set any appropriate parameters for the | ||
33 | operation. | ||
34 | |||
35 | The function EVP_PKEY_encrypt() can be called more than once on the same | ||
36 | context if several operations are performed using the same parameters. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | EVP_PKEY_encrypt_init() and EVP_PKEY_encrypt() return 1 for success and 0 | ||
41 | or a negative value for failure. In particular a return value of -2 | ||
42 | indicates the operation is not supported by the public key algorithm. | ||
43 | |||
44 | =head1 EXAMPLE | ||
45 | |||
46 | Encrypt data using OAEP (for RSA keys): | ||
47 | |||
48 | #include <openssl/evp.h> | ||
49 | #include <openssl/rsa.h> | ||
50 | |||
51 | EVP_PKEY_CTX *ctx; | ||
52 | unsigned char *out, *in; | ||
53 | size_t outlen, inlen; | ||
54 | EVP_PKEY *key; | ||
55 | /* NB: assumes key in, inlen are already set up | ||
56 | * and that key is an RSA public key | ||
57 | */ | ||
58 | ctx = EVP_PKEY_CTX_new(key); | ||
59 | if (!ctx) | ||
60 | /* Error occurred */ | ||
61 | if (EVP_PKEY_encrypt_init(ctx) <= 0) | ||
62 | /* Error */ | ||
63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0) | ||
64 | /* Error */ | ||
65 | |||
66 | /* Determine buffer length */ | ||
67 | if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0) | ||
68 | /* Error */ | ||
69 | |||
70 | out = OPENSSL_malloc(outlen); | ||
71 | |||
72 | if (!out) | ||
73 | /* malloc failure */ | ||
74 | |||
75 | if (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <= 0) | ||
76 | /* Error */ | ||
77 | |||
78 | /* Encrypted data is outlen bytes written to buffer out */ | ||
79 | |||
80 | =head1 SEE ALSO | ||
81 | |||
82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
83 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
84 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
85 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
86 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
87 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
88 | |||
89 | =head1 HISTORY | ||
90 | |||
91 | These functions were first added to OpenSSL 1.0.0. | ||
92 | |||
93 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_get_default_digest.pod b/src/lib/libcrypto/doc/EVP_PKEY_get_default_digest.pod new file mode 100644 index 0000000000..1a9c7954c5 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_get_default_digest.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_get_default_digest_nid - get default signature digest | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | ||
11 | |||
12 | =head1 DESCRIPTION | ||
13 | |||
14 | The EVP_PKEY_get_default_digest_nid() function sets B<pnid> to the default | ||
15 | message digest NID for the public key signature operations associated with key | ||
16 | B<pkey>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | For all current standard OpenSSL public key algorithms SHA1 is returned. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | The EVP_PKEY_get_default_digest_nid() function returns 1 if the message digest | ||
25 | is advisory (that is other digests can be used) and 2 if it is mandatory (other | ||
26 | digests can not be used). It returns 0 or a negative value for failure. In | ||
27 | particular a return value of -2 indicates the operation is not supported by the | ||
28 | public key algorithm. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
33 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
34 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
35 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
36 | |||
37 | =head1 HISTORY | ||
38 | |||
39 | This function was first added to OpenSSL 1.0.0. | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_keygen.pod b/src/lib/libcrypto/doc/EVP_PKEY_keygen.pod new file mode 100644 index 0000000000..37c6fe9503 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_keygen.pod | |||
@@ -0,0 +1,161 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_keygen_init, EVP_PKEY_keygen, EVP_PKEY_paramgen_init, EVP_PKEY_paramgen, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_info, EVP_PKEVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data - key and parameter generation functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
13 | int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); | ||
14 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
15 | |||
16 | typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); | ||
17 | |||
18 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); | ||
19 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | ||
20 | |||
21 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); | ||
22 | |||
23 | void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); | ||
24 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | ||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | The EVP_PKEY_keygen_init() function initializes a public key algorithm | ||
29 | context using key B<pkey> for a key genration operation. | ||
30 | |||
31 | The EVP_PKEY_keygen() function performs a key generation operation, the | ||
32 | generated key is written to B<ppkey>. | ||
33 | |||
34 | The functions EVP_PKEY_paramgen_init() and EVP_PKEY_paramgen() are similar | ||
35 | except parameters are generated. | ||
36 | |||
37 | The function EVP_PKEY_set_cb() sets the key or parameter generation callback | ||
38 | to B<cb>. The function EVP_PKEY_CTX_get_cb() returns the key or parameter | ||
39 | generation callback. | ||
40 | |||
41 | The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated | ||
42 | with the generation operation. If B<idx> is -1 the total number of | ||
43 | parameters available is returned. Any non negative value returns the value of | ||
44 | that parameter. EVP_PKEY_CTX_gen_keygen_info() with a non-negative value for | ||
45 | B<idx> should only be called within the generation callback. | ||
46 | |||
47 | If the callback returns 0 then the key genration operation is aborted and an | ||
48 | error occurs. This might occur during a time consuming operation where | ||
49 | a user clicks on a "cancel" button. | ||
50 | |||
51 | The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() set | ||
52 | and retrieve an opaque pointer. This can be used to set some application | ||
53 | defined value which can be retrieved in the callback: for example a handle | ||
54 | which is used to update a "progress dialog". | ||
55 | |||
56 | =head1 NOTES | ||
57 | |||
58 | After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algorithm | ||
59 | specific control operations can be performed to set any appropriate parameters | ||
60 | for the operation. | ||
61 | |||
62 | The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more than | ||
63 | once on the same context if several operations are performed using the same | ||
64 | parameters. | ||
65 | |||
66 | The meaning of the parameters passed to the callback will depend on the | ||
67 | algorithm and the specifiic implementation of the algorithm. Some might not | ||
68 | give any useful information at all during key or parameter generation. Others | ||
69 | might not even call the callback. | ||
70 | |||
71 | The operation performed by key or parameter generation depends on the algorithm | ||
72 | used. In some cases (e.g. EC with a supplied named curve) the "generation" | ||
73 | option merely sets the appropriate fields in an EVP_PKEY structure. | ||
74 | |||
75 | In OpenSSL an EVP_PKEY structure containing a private key also contains the | ||
76 | public key components and parameters (if any). An OpenSSL private key is | ||
77 | equivalent to what some libraries call a "key pair". A private key can be used | ||
78 | in functions which require the use of a public key or parameters. | ||
79 | |||
80 | =head1 RETURN VALUES | ||
81 | |||
82 | EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and | ||
83 | EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for failure. | ||
84 | In particular a return value of -2 indicates the operation is not supported by | ||
85 | the public key algorithm. | ||
86 | |||
87 | =head1 EXAMPLES | ||
88 | |||
89 | Generate a 2048 bit RSA key: | ||
90 | |||
91 | #include <openssl/evp.h> | ||
92 | #include <openssl/rsa.h> | ||
93 | |||
94 | EVP_PKEY_CTX *ctx; | ||
95 | EVP_PKEY *pkey = NULL; | ||
96 | ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); | ||
97 | if (!ctx) | ||
98 | /* Error occurred */ | ||
99 | if (EVP_PKEY_keygen_init(ctx) <= 0) | ||
100 | /* Error */ | ||
101 | if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0) | ||
102 | /* Error */ | ||
103 | |||
104 | /* Generate key */ | ||
105 | if (EVP_PKEY_keygen(ctx, &pkey) <= 0) | ||
106 | /* Error */ | ||
107 | |||
108 | Generate a key from a set of parameters: | ||
109 | |||
110 | #include <openssl/evp.h> | ||
111 | #include <openssl/rsa.h> | ||
112 | |||
113 | EVP_PKEY_CTX *ctx; | ||
114 | EVP_PKEY *pkey = NULL, *param; | ||
115 | /* Assumed param is set up already */ | ||
116 | ctx = EVP_PKEY_CTX_new(param); | ||
117 | if (!ctx) | ||
118 | /* Error occurred */ | ||
119 | if (EVP_PKEY_keygen_init(ctx) <= 0) | ||
120 | /* Error */ | ||
121 | |||
122 | /* Generate key */ | ||
123 | if (EVP_PKEY_keygen(ctx, &pkey) <= 0) | ||
124 | /* Error */ | ||
125 | |||
126 | Example of generation callback for OpenSSL public key implementations: | ||
127 | |||
128 | /* Application data is a BIO to output status to */ | ||
129 | |||
130 | EVP_PKEY_CTX_set_app_data(ctx, status_bio); | ||
131 | |||
132 | static int genpkey_cb(EVP_PKEY_CTX *ctx) | ||
133 | { | ||
134 | char c='*'; | ||
135 | BIO *b = EVP_PKEY_CTX_get_app_data(ctx); | ||
136 | int p; | ||
137 | p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); | ||
138 | if (p == 0) c='.'; | ||
139 | if (p == 1) c='+'; | ||
140 | if (p == 2) c='*'; | ||
141 | if (p == 3) c='\n'; | ||
142 | BIO_write(b,&c,1); | ||
143 | (void)BIO_flush(b); | ||
144 | return 1; | ||
145 | } | ||
146 | |||
147 | =head1 SEE ALSO | ||
148 | |||
149 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
150 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
151 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
152 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
153 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
154 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
155 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
156 | |||
157 | =head1 HISTORY | ||
158 | |||
159 | These functions were first added to OpenSSL 1.0.0. | ||
160 | |||
161 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_print_private.pod b/src/lib/libcrypto/doc/EVP_PKEY_print_private.pod new file mode 100644 index 0000000000..ce9d70d7a7 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_print_private.pod | |||
@@ -0,0 +1,53 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params - public key algorithm printing routines. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | ||
12 | int indent, ASN1_PCTX *pctx); | ||
13 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | ||
14 | int indent, ASN1_PCTX *pctx); | ||
15 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | ||
16 | int indent, ASN1_PCTX *pctx); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and | ||
21 | EVP_PKEY_print_params() print out the public, private or parameter components | ||
22 | of key B<pkey> respectively. The key is sent to BIO B<out> in human readable | ||
23 | form. The parameter B<indent> indicated how far the printout should be indented. | ||
24 | |||
25 | The B<pctx> parameter allows the print output to be finely tuned by using | ||
26 | ASN1 printing options. If B<pctx> is set to NULL then default values will | ||
27 | be used. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | Currently no public key algorithms include any options in the B<pctx> parameter | ||
32 | parameter. | ||
33 | |||
34 | If the key does not include all the components indicated by the function then | ||
35 | only those contained in the key will be printed. For example passing a public | ||
36 | key to EVP_PKEY_print_private() will only print the public components. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | These functions all return 1 for success and 0 or a negative value for failure. | ||
41 | In particular a return value of -2 indicates the operation is not supported by | ||
42 | the public key algorithm. | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
47 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
48 | |||
49 | =head1 HISTORY | ||
50 | |||
51 | These functions were first added to OpenSSL 1.0.0. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_sign.pod b/src/lib/libcrypto/doc/EVP_PKEY_sign.pod new file mode 100644 index 0000000000..2fb52c3486 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_sign.pod | |||
@@ -0,0 +1,96 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_sign_init, EVP_PKEY_sign - sign using a public key algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | ||
13 | unsigned char *sig, size_t *siglen, | ||
14 | const unsigned char *tbs, size_t tbslen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_sign_init() function initializes a public key algorithm | ||
19 | context using key B<pkey> for a signing operation. | ||
20 | |||
21 | The EVP_PKEY_sign() function performs a public key signing operation | ||
22 | using B<ctx>. The data to be signed is specified using the B<tbs> and | ||
23 | B<tbslen> parameters. If B<sig> is B<NULL> then the maximum size of the output | ||
24 | buffer is written to the B<siglen> parameter. If B<sig> is not B<NULL> then | ||
25 | before the call the B<siglen> parameter should contain the length of the | ||
26 | B<sig> buffer, if the call is successful the signature is written to | ||
27 | B<sig> and the amount of data written to B<siglen>. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | After the call to EVP_PKEY_sign_init() algorithm specific control | ||
32 | operations can be performed to set any appropriate parameters for the | ||
33 | operation. | ||
34 | |||
35 | The function EVP_PKEY_sign() can be called more than once on the same | ||
36 | context if several operations are performed using the same parameters. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0 | ||
41 | or a negative value for failure. In particular a return value of -2 | ||
42 | indicates the operation is not supported by the public key algorithm. | ||
43 | |||
44 | =head1 EXAMPLE | ||
45 | |||
46 | Sign data using RSA with PKCS#1 padding and SHA256 digest: | ||
47 | |||
48 | #include <openssl/evp.h> | ||
49 | #include <openssl/rsa.h> | ||
50 | |||
51 | EVP_PKEY_CTX *ctx; | ||
52 | unsigned char *md, *sig; | ||
53 | size_t mdlen, siglen; | ||
54 | EVP_PKEY *signing_key; | ||
55 | /* NB: assumes signing_key, md and mdlen are already set up | ||
56 | * and that signing_key is an RSA private key | ||
57 | */ | ||
58 | ctx = EVP_PKEY_CTX_new(signing_key); | ||
59 | if (!ctx) | ||
60 | /* Error occurred */ | ||
61 | if (EVP_PKEY_sign_init(ctx) <= 0) | ||
62 | /* Error */ | ||
63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) | ||
64 | /* Error */ | ||
65 | if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) | ||
66 | /* Error */ | ||
67 | |||
68 | /* Determine buffer length */ | ||
69 | if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0) | ||
70 | /* Error */ | ||
71 | |||
72 | sig = OPENSSL_malloc(siglen); | ||
73 | |||
74 | if (!sig) | ||
75 | /* malloc failure */ | ||
76 | |||
77 | if (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <= 0) | ||
78 | /* Error */ | ||
79 | |||
80 | /* Signature is siglen bytes written to buffer sig */ | ||
81 | |||
82 | |||
83 | =head1 SEE ALSO | ||
84 | |||
85 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
86 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
87 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
88 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
89 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
90 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
91 | |||
92 | =head1 HISTORY | ||
93 | |||
94 | These functions were first added to OpenSSL 1.0.0. | ||
95 | |||
96 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_verify.pod b/src/lib/libcrypto/doc/EVP_PKEY_verify.pod new file mode 100644 index 0000000000..10633da3f2 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_PKEY_verify.pod | |||
@@ -0,0 +1,91 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_verify_init, EVP_PKEY_verify - signature verification using a public key algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); | ||
12 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | ||
13 | const unsigned char *sig, size_t siglen, | ||
14 | const unsigned char *tbs, size_t tbslen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_verify_init() function initializes a public key algorithm | ||
19 | context using key B<pkey> for a signature verification operation. | ||
20 | |||
21 | The EVP_PKEY_verify() function performs a public key verification operation | ||
22 | using B<ctx>. The signature is specified using the B<sig> and | ||
23 | B<siglen> parameters. The verified data (i.e. the data believed originally | ||
24 | signed) is specified using the B<tbs> and B<tbslen> parameters. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | After the call to EVP_PKEY_verify_init() algorithm specific control | ||
29 | operations can be performed to set any appropriate parameters for the | ||
30 | operation. | ||
31 | |||
32 | The function EVP_PKEY_verify() can be called more than once on the same | ||
33 | context if several operations are performed using the same parameters. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification was | ||
38 | successful and 0 if it failed. Unlike other functions the return value 0 from | ||
39 | EVP_PKEY_verify() only indicates that the signature did not not verify | ||
40 | successfully (that is tbs did not match the original data or the signature was | ||
41 | of invalid form) it is not an indication of a more serious error. | ||
42 | |||
43 | A negative value indicates an error other that signature verification failure. | ||
44 | In particular a return value of -2 indicates the operation is not supported by | ||
45 | the public key algorithm. | ||
46 | |||
47 | =head1 EXAMPLE | ||
48 | |||
49 | Verify signature using PKCS#1 and SHA256 digest: | ||
50 | |||
51 | #include <openssl/evp.h> | ||
52 | #include <openssl/rsa.h> | ||
53 | |||
54 | EVP_PKEY_CTX *ctx; | ||
55 | unsigned char *md, *sig; | ||
56 | size_t mdlen, siglen; | ||
57 | EVP_PKEY *verify_key; | ||
58 | /* NB: assumes verify_key, sig, siglen md and mdlen are already set up | ||
59 | * and that verify_key is an RSA public key | ||
60 | */ | ||
61 | ctx = EVP_PKEY_CTX_new(verify_key); | ||
62 | if (!ctx) | ||
63 | /* Error occurred */ | ||
64 | if (EVP_PKEY_verify_init(ctx) <= 0) | ||
65 | /* Error */ | ||
66 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) | ||
67 | /* Error */ | ||
68 | if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) | ||
69 | /* Error */ | ||
70 | |||
71 | /* Perform operation */ | ||
72 | ret = EVP_PKEY_verify(ctx, md, mdlen, sig, siglen); | ||
73 | |||
74 | /* ret == 1 indicates success, 0 verify failure and < 0 for some | ||
75 | * other error. | ||
76 | */ | ||
77 | |||
78 | =head1 SEE ALSO | ||
79 | |||
80 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
81 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
82 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
83 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
84 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
85 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
86 | |||
87 | =head1 HISTORY | ||
88 | |||
89 | These functions were first added to OpenSSL 1.0.0. | ||
90 | |||
91 | =cut | ||
diff --git a/src/lib/libcrypto/doc/OBJ_nid2obj.pod b/src/lib/libcrypto/doc/OBJ_nid2obj.pod index 7dcc07923f..1e45dd40f6 100644 --- a/src/lib/libcrypto/doc/OBJ_nid2obj.pod +++ b/src/lib/libcrypto/doc/OBJ_nid2obj.pod | |||
@@ -8,6 +8,8 @@ functions | |||
8 | 8 | ||
9 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
10 | 10 | ||
11 | #include <openssl/objects.h> | ||
12 | |||
11 | ASN1_OBJECT * OBJ_nid2obj(int n); | 13 | ASN1_OBJECT * OBJ_nid2obj(int n); |
12 | const char * OBJ_nid2ln(int n); | 14 | const char * OBJ_nid2ln(int n); |
13 | const char * OBJ_nid2sn(int n); | 15 | const char * OBJ_nid2sn(int n); |
diff --git a/src/lib/libcrypto/doc/PEM_write_bio_CMS_stream.pod b/src/lib/libcrypto/doc/PEM_write_bio_CMS_stream.pod new file mode 100644 index 0000000000..e070c45c2e --- /dev/null +++ b/src/lib/libcrypto/doc/PEM_write_bio_CMS_stream.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/cms.h> | ||
10 | #include <openssl/pem.h> | ||
11 | |||
12 | int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM format. | ||
17 | |||
18 | It is otherwise identical to the function SMIME_write_CMS(). | ||
19 | |||
20 | =head1 NOTES | ||
21 | |||
22 | This function is effectively a version of the PEM_write_bio_CMS() supporting | ||
23 | streaming. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure. | ||
28 | |||
29 | =head1 SEE ALSO | ||
30 | |||
31 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
32 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
33 | L<CMS_decrypt(3)|CMS_decrypt(3)>, | ||
34 | L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>, | ||
35 | L<i2d_CMS_bio_stream(3)|i2d_CMS_bio_stream(3)> | ||
36 | |||
37 | =head1 HISTORY | ||
38 | |||
39 | PEM_write_bio_CMS_stream() was added to OpenSSL 1.0.0 | ||
40 | |||
41 | =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 new file mode 100644 index 0000000000..16fc9b6845 --- /dev/null +++ b/src/lib/libcrypto/doc/PEM_write_bio_PKCS7_stream.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | PEM_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 | |||
16 | PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format. | ||
17 | |||
18 | It is otherwise identical to the function SMIME_write_PKCS7(). | ||
19 | |||
20 | =head1 NOTES | ||
21 | |||
22 | This function is effectively a version of the PEM_write_bio_PKCS7() supporting | ||
23 | streaming. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure. | ||
28 | |||
29 | =head1 SEE ALSO | ||
30 | |||
31 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
32 | L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> | ||
33 | L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>, | ||
34 | L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>, | ||
35 | L<i2d_PKCS7_bio_stream(3)|i2d_PKCS7_bio_stream(3)> | ||
36 | |||
37 | =head1 HISTORY | ||
38 | |||
39 | PEM_write_bio_PKCS7_stream() was added to OpenSSL 1.0.0 | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libcrypto/doc/PKCS12_parse.pod b/src/lib/libcrypto/doc/PKCS12_parse.pod index 51344f883a..c54cf2ad61 100644 --- a/src/lib/libcrypto/doc/PKCS12_parse.pod +++ b/src/lib/libcrypto/doc/PKCS12_parse.pod | |||
@@ -20,24 +20,31 @@ certificate to B<*cert> and any additional certificates to B<*ca>. | |||
20 | 20 | ||
21 | =head1 NOTES | 21 | =head1 NOTES |
22 | 22 | ||
23 | The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> | 23 | The parameters B<pkey> and B<cert> cannot be B<NULL>. B<ca> can be <NULL> in |
24 | in which case additional certificates will be discarded. B<*ca> can also | 24 | which case additional certificates will be discarded. B<*ca> can also be a |
25 | be a valid STACK in which case additional certificates are appended to | 25 | valid STACK in which case additional certificates are appended to B<*ca>. If |
26 | B<*ca>. If B<*ca> is B<NULL> a new STACK will be allocated. | 26 | B<*ca> is B<NULL> a new STACK will be allocated. |
27 | 27 | ||
28 | The B<friendlyName> and B<localKeyID> attributes (if present) on each certificate | 28 | The B<friendlyName> and B<localKeyID> attributes (if present) on each |
29 | will be stored in the B<alias> and B<keyid> attributes of the B<X509> structure. | 29 | certificate will be stored in the B<alias> and B<keyid> attributes of the |
30 | B<X509> structure. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | PKCS12_parse() returns 1 for success and zero if an error occurred. | ||
35 | |||
36 | The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> | ||
30 | 37 | ||
31 | =head1 BUGS | 38 | =head1 BUGS |
32 | 39 | ||
33 | Only a single private key and corresponding certificate is returned by this function. | 40 | Only a single private key and corresponding certificate is returned by this |
34 | More complex PKCS#12 files with multiple private keys will only return the first | 41 | function. More complex PKCS#12 files with multiple private keys will only |
35 | match. | 42 | return the first match. |
36 | 43 | ||
37 | Only B<friendlyName> and B<localKeyID> attributes are currently stored in certificates. | 44 | Only B<friendlyName> and B<localKeyID> attributes are currently stored in |
38 | Other attributes are discarded. | 45 | certificates. Other attributes are discarded. |
39 | 46 | ||
40 | Attributes currently cannot be store in the private key B<EVP_PKEY> structure. | 47 | Attributes currently cannot be stored in the private key B<EVP_PKEY> structure. |
41 | 48 | ||
42 | =head1 SEE ALSO | 49 | =head1 SEE ALSO |
43 | 50 | ||
diff --git a/src/lib/libcrypto/doc/PKCS7_decrypt.pod b/src/lib/libcrypto/doc/PKCS7_decrypt.pod index b0ca067b89..325699d0b6 100644 --- a/src/lib/libcrypto/doc/PKCS7_decrypt.pod +++ b/src/lib/libcrypto/doc/PKCS7_decrypt.pod | |||
@@ -6,7 +6,9 @@ PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); | 9 | #include <openssl/pkcs7.h> |
10 | |||
11 | int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); | ||
10 | 12 | ||
11 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
12 | 14 | ||
diff --git a/src/lib/libcrypto/doc/PKCS7_encrypt.pod b/src/lib/libcrypto/doc/PKCS7_encrypt.pod index 1a507b22a2..2cd925a7e0 100644 --- a/src/lib/libcrypto/doc/PKCS7_encrypt.pod +++ b/src/lib/libcrypto/doc/PKCS7_encrypt.pod | |||
@@ -6,7 +6,9 @@ PKCS7_encrypt - create a PKCS#7 envelopedData structure | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags); | 9 | #include <openssl/pkcs7.h> |
10 | |||
11 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags); | ||
10 | 12 | ||
11 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
12 | 14 | ||
@@ -16,43 +18,55 @@ B<cipher> is the symmetric cipher to use. B<flags> is an optional set of flags. | |||
16 | 18 | ||
17 | =head1 NOTES | 19 | =head1 NOTES |
18 | 20 | ||
19 | Only RSA keys are supported in PKCS#7 and envelopedData so the recipient certificates | 21 | Only RSA keys are supported in PKCS#7 and envelopedData so the recipient |
20 | supplied to this function must all contain RSA public keys, though they do not have to | 22 | certificates supplied to this function must all contain RSA public keys, though |
21 | be signed using the RSA algorithm. | 23 | they do not have to be signed using the RSA algorithm. |
22 | 24 | ||
23 | EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because | 25 | EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use |
24 | most clients will support it. | 26 | because most clients will support it. |
25 | 27 | ||
26 | Some old "export grade" clients may only support weak encryption using 40 or 64 bit | 28 | Some old "export grade" clients may only support weak encryption using 40 or 64 |
27 | RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() respectively. | 29 | bit RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() |
30 | respectively. | ||
28 | 31 | ||
29 | The algorithm passed in the B<cipher> parameter must support ASN1 encoding of its | 32 | The algorithm passed in the B<cipher> parameter must support ASN1 encoding of |
30 | parameters. | 33 | its parameters. |
31 | 34 | ||
32 | Many browsers implement a "sign and encrypt" option which is simply an S/MIME | 35 | Many browsers implement a "sign and encrypt" option which is simply an S/MIME |
33 | envelopedData containing an S/MIME signed message. This can be readily produced | 36 | envelopedData containing an S/MIME signed message. This can be readily produced |
34 | by storing the S/MIME signed message in a memory BIO and passing it to | 37 | by storing the S/MIME signed message in a memory BIO and passing it to |
35 | PKCS7_encrypt(). | 38 | PKCS7_encrypt(). |
36 | 39 | ||
37 | The following flags can be passed in the B<flags> parameter. | 40 | The following flags can be passed in the B<flags> parameter. |
38 | 41 | ||
39 | If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended | 42 | If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are |
40 | to the data. | 43 | prepended to the data. |
41 | 44 | ||
42 | Normally the supplied content is translated into MIME canonical format (as required | 45 | Normally the supplied content is translated into MIME canonical format (as |
43 | by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occurs. This | 46 | required by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation |
44 | option should be used if the supplied data is in binary format otherwise the translation | 47 | occurs. This option should be used if the supplied data is in binary format |
45 | will corrupt it. If B<PKCS7_BINARY> is set then B<PKCS7_TEXT> is ignored. | 48 | otherwise the translation will corrupt it. If B<PKCS7_BINARY> is set then |
49 | B<PKCS7_TEXT> is ignored. | ||
46 | 50 | ||
47 | =head1 RETURN VALUES | 51 | If the B<PKCS7_STREAM> flag is set a partial B<PKCS7> structure is output |
52 | suitable for streaming I/O: no data is read from the BIO B<in>. | ||
48 | 53 | ||
49 | PKCS7_encrypt() returns either a valid PKCS7 structure or NULL if an error occurred. | 54 | =head1 NOTES |
50 | The error can be obtained from ERR_get_error(3). | ||
51 | 55 | ||
52 | =head1 BUGS | 56 | If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<not> |
57 | complete and outputting its contents via a function that does not | ||
58 | properly finalize the B<PKCS7> structure will give unpredictable | ||
59 | results. | ||
53 | 60 | ||
54 | The lack of single pass processing and need to hold all data in memory as | 61 | Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), |
55 | mentioned in PKCS7_sign() also applies to PKCS7_verify(). | 62 | PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization |
63 | can be performed by obtaining the streaming ASN1 B<BIO> directly using | ||
64 | BIO_new_PKCS7(). | ||
65 | |||
66 | =head1 RETURN VALUES | ||
67 | |||
68 | PKCS7_encrypt() returns either a PKCS7 structure or NULL if an error occurred. | ||
69 | The error can be obtained from ERR_get_error(3). | ||
56 | 70 | ||
57 | =head1 SEE ALSO | 71 | =head1 SEE ALSO |
58 | 72 | ||
@@ -61,5 +75,6 @@ L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_decrypt(3)|PKCS7_decrypt(3)> | |||
61 | =head1 HISTORY | 75 | =head1 HISTORY |
62 | 76 | ||
63 | PKCS7_decrypt() was added to OpenSSL 0.9.5 | 77 | PKCS7_decrypt() was added to OpenSSL 0.9.5 |
78 | The B<PKCS7_STREAM> flag was first supported in OpenSSL 1.0.0. | ||
64 | 79 | ||
65 | =cut | 80 | =cut |
diff --git a/src/lib/libcrypto/doc/PKCS7_sign.pod b/src/lib/libcrypto/doc/PKCS7_sign.pod index ffd0c734b0..64a35144f8 100644 --- a/src/lib/libcrypto/doc/PKCS7_sign.pod +++ b/src/lib/libcrypto/doc/PKCS7_sign.pod | |||
@@ -6,14 +6,16 @@ PKCS7_sign - create a PKCS#7 signedData structure | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags); | 9 | #include <openssl/pkcs7.h> |
10 | |||
11 | PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags); | ||
10 | 12 | ||
11 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
12 | 14 | ||
13 | PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert> | 15 | PKCS7_sign() creates and returns a PKCS#7 signedData structure. B<signcert> is |
14 | is the certificate to sign with, B<pkey> is the corresponsding private key. | 16 | the certificate to sign with, B<pkey> is the corresponsding private key. |
15 | B<certs> is an optional additional set of certificates to include in the | 17 | B<certs> is an optional additional set of certificates to include in the PKCS#7 |
16 | PKCS#7 structure (for example any intermediate CAs in the chain). | 18 | structure (for example any intermediate CAs in the chain). |
17 | 19 | ||
18 | The data to be signed is read from BIO B<data>. | 20 | The data to be signed is read from BIO B<data>. |
19 | 21 | ||
@@ -21,72 +23,83 @@ B<flags> is an optional set of flags. | |||
21 | 23 | ||
22 | =head1 NOTES | 24 | =head1 NOTES |
23 | 25 | ||
24 | Any of the following flags (ored together) can be passed in the B<flags> parameter. | 26 | Any of the following flags (ored together) can be passed in the B<flags> |
27 | parameter. | ||
25 | 28 | ||
26 | Many S/MIME clients expect the signed content to include valid MIME headers. If | 29 | Many S/MIME clients expect the signed content to include valid MIME headers. If |
27 | the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended | 30 | the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended |
28 | to the data. | 31 | to the data. |
29 | 32 | ||
30 | If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the | 33 | If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the |
31 | PKCS7 structure, the signer's certificate must still be supplied in the B<signcert> | 34 | PKCS7 structure, the signer's certificate must still be supplied in the |
32 | parameter though. This can reduce the size of the signature if the signers certificate | 35 | B<signcert> parameter though. This can reduce the size of the signature if the |
33 | can be obtained by other means: for example a previously signed message. | 36 | signers certificate can be obtained by other means: for example a previously |
34 | 37 | signed message. | |
35 | The data being signed is included in the PKCS7 structure, unless B<PKCS7_DETACHED> | 38 | |
36 | is set in which case it is omitted. This is used for PKCS7 detached signatures | 39 | The data being signed is included in the PKCS7 structure, unless |
37 | which are used in S/MIME plaintext signed messages for example. | 40 | B<PKCS7_DETACHED> is set in which case it is omitted. This is used for PKCS7 |
41 | detached signatures which are used in S/MIME plaintext signed messages for | ||
42 | example. | ||
43 | |||
44 | Normally the supplied content is translated into MIME canonical format (as | ||
45 | required by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation | ||
46 | occurs. This option should be used if the supplied data is in binary format | ||
47 | otherwise the translation will corrupt it. | ||
48 | |||
49 | The signedData structure includes several PKCS#7 autenticatedAttributes | ||
50 | including the signing time, the PKCS#7 content type and the supported list of | ||
51 | ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no | ||
52 | authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just | ||
53 | the SMIMECapabilities are omitted. | ||
38 | 54 | ||
39 | Normally the supplied content is translated into MIME canonical format (as required | 55 | If present the SMIMECapabilities attribute indicates support for the following |
40 | by the S/MIME specifications) if B<PKCS7_BINARY> is set no translation occurs. This | 56 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of |
41 | option should be used if the supplied data is in binary format otherwise the translation | 57 | these algorithms is disabled then it will not be included. |
42 | will corrupt it. | ||
43 | 58 | ||
44 | The signedData structure includes several PKCS#7 autenticatedAttributes including | 59 | If the flags B<PKCS7_STREAM> is set then the returned B<PKCS7> structure is |
45 | the signing time, the PKCS#7 content type and the supported list of ciphers in | 60 | just initialized ready to perform the signing operation. The signing is however |
46 | an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no authenticatedAttributes | 61 | B<not> performed and the data to be signed is not read from the B<data> |
47 | will be used. If B<PKCS7_NOSMIMECAP> is set then just the SMIMECapabilities are | 62 | parameter. Signing is deferred until after the data has been written. In this |
48 | omitted. | 63 | way data can be signed in a single pass. |
49 | 64 | ||
50 | If present the SMIMECapabilities attribute indicates support for the following | 65 | If the B<PKCS7_PARTIAL> flag is set a partial B<PKCS7> structure is output to |
51 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any | 66 | which additional signers and capabilities can be added before finalization. |
52 | of these algorithms is disabled then it will not be included. | ||
53 | 67 | ||
54 | If the flags B<PKCS7_PARTSIGN> is set then the returned B<PKCS7> structure | ||
55 | is just initialized ready to perform the signing operation. The signing | ||
56 | is however B<not> performed and the data to be signed is not read from | ||
57 | the B<data> parameter. Signing is deferred until after the data has been | ||
58 | written. In this way data can be signed in a single pass. Currently the | ||
59 | flag B<PKCS7_DETACHED> B<must> also be set. | ||
60 | 68 | ||
61 | =head1 NOTES | 69 | =head1 NOTES |
62 | 70 | ||
63 | Currently the flag B<PKCS7_PARTSIGN> is only supported for detached | 71 | If the flag B<PKCS7_STREAM> is set the returned B<PKCS7> structure is B<not> |
64 | data. If this flag is set the returned B<PKCS7> structure is B<not> | 72 | complete and outputting its contents via a function that does not properly |
65 | complete and outputting its contents via a function that does not | 73 | finalize the B<PKCS7> structure will give unpredictable results. |
66 | properly finalize the B<PKCS7> structure will give unpredictable | ||
67 | results. | ||
68 | 74 | ||
69 | At present only the SMIME_write_PKCS7() function properly finalizes the | 75 | Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), |
70 | structure. | 76 | PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization |
77 | can be performed by obtaining the streaming ASN1 B<BIO> directly using | ||
78 | BIO_new_PKCS7(). | ||
71 | 79 | ||
72 | =head1 BUGS | 80 | If a signer is specified it will use the default digest for the signing |
81 | algorithm. This is B<SHA1> for both RSA and DSA keys. | ||
82 | |||
83 | In OpenSSL 1.0.0 the B<certs>, B<signcert> and B<pkey> parameters can all be | ||
84 | B<NULL> if the B<PKCS7_PARTIAL> flag is set. One or more signers can be added | ||
85 | using the function B<PKCS7_sign_add_signer()>. B<PKCS7_final()> must also be | ||
86 | called to finalize the structure if streaming is not enabled. Alternative | ||
87 | signing digests can also be specified using this method. | ||
73 | 88 | ||
74 | PKCS7_sign() is somewhat limited. It does not support multiple signers, some | 89 | In OpenSSL 1.0.0 if B<signcert> and B<pkey> are NULL then a certificates only |
75 | advanced attributes such as counter signatures are not supported. | 90 | PKCS#7 structure is output. |
76 | 91 | ||
77 | The SHA1 digest algorithm is currently always used. | 92 | In versions of OpenSSL before 1.0.0 the B<signcert> and B<pkey> parameters must |
93 | B<NOT> be NULL. | ||
78 | 94 | ||
79 | When the signed data is not detached it will be stored in memory within the | 95 | =head1 BUGS |
80 | B<PKCS7> structure. This effectively limits the size of messages which can be | ||
81 | signed due to memory restraints. There should be a way to sign data without | ||
82 | having to hold it all in memory, this would however require fairly major | ||
83 | revisions of the OpenSSL ASN1 code. | ||
84 | 96 | ||
97 | Some advanced attributes such as counter signatures are not supported. | ||
85 | 98 | ||
86 | =head1 RETURN VALUES | 99 | =head1 RETURN VALUES |
87 | 100 | ||
88 | PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error occurred. | 101 | PKCS7_sign() returns either a valid PKCS7 structure or NULL if an error |
89 | The error can be obtained from ERR_get_error(3). | 102 | occurred. The error can be obtained from ERR_get_error(3). |
90 | 103 | ||
91 | =head1 SEE ALSO | 104 | =head1 SEE ALSO |
92 | 105 | ||
@@ -96,6 +109,8 @@ L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_verify(3)|PKCS7_verify(3)> | |||
96 | 109 | ||
97 | PKCS7_sign() was added to OpenSSL 0.9.5 | 110 | PKCS7_sign() was added to OpenSSL 0.9.5 |
98 | 111 | ||
99 | The B<PKCS7_PARTSIGN> flag was added in OpenSSL 0.9.8 | 112 | The B<PKCS7_PARTIAL> flag was added in OpenSSL 1.0.0 |
113 | |||
114 | The B<PKCS7_STREAM> flag was added in OpenSSL 1.0.0 | ||
100 | 115 | ||
101 | =cut | 116 | =cut |
diff --git a/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod b/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod new file mode 100644 index 0000000000..ebec4d57de --- /dev/null +++ b/src/lib/libcrypto/doc/PKCS7_sign_add_signer.pod | |||
@@ -0,0 +1,87 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | PKCS7_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 | |||
16 | PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private | ||
17 | key B<pkey> using message digest B<md> to a PKCS7 signed data structure | ||
18 | B<p7>. | ||
19 | |||
20 | The PKCS7 structure should be obtained from an initial call to PKCS7_sign() | ||
21 | with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7 | ||
22 | signed data structure. | ||
23 | |||
24 | If the B<md> parameter is B<NULL> then the default digest for the public | ||
25 | key algorithm will be used. | ||
26 | |||
27 | Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure | ||
28 | is not complete and must be finalized either by streaming (if applicable) or | ||
29 | a call to PKCS7_final(). | ||
30 | |||
31 | |||
32 | =head1 NOTES | ||
33 | |||
34 | The main purpose of this function is to provide finer control over a PKCS#7 | ||
35 | signed data structure where the simpler PKCS7_sign() function defaults are | ||
36 | not appropriate. For example if multiple signers or non default digest | ||
37 | algorithms are needed. | ||
38 | |||
39 | Any of the following flags (ored together) can be passed in the B<flags> | ||
40 | parameter. | ||
41 | |||
42 | If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content | ||
43 | digest value from the PKCS7 struture: to add a signer to an existing structure. | ||
44 | An error occurs if a matching digest value cannot be found to copy. The | ||
45 | returned PKCS7 structure will be valid and finalized when this flag is set. | ||
46 | |||
47 | If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the | ||
48 | B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes | ||
49 | can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is | ||
50 | needed to finalize it. | ||
51 | |||
52 | If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the | ||
53 | PKCS7 structure, the signer's certificate must still be supplied in the | ||
54 | B<signcert> parameter though. This can reduce the size of the signature if the | ||
55 | signers certificate can be obtained by other means: for example a previously | ||
56 | signed message. | ||
57 | |||
58 | The signedData structure includes several PKCS#7 autenticatedAttributes | ||
59 | including the signing time, the PKCS#7 content type and the supported list of | ||
60 | ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no | ||
61 | authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just | ||
62 | the SMIMECapabilities are omitted. | ||
63 | |||
64 | If present the SMIMECapabilities attribute indicates support for the following | ||
65 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of | ||
66 | these algorithms is disabled then it will not be included. | ||
67 | |||
68 | |||
69 | PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO | ||
70 | structure just added, this can be used to set additional attributes | ||
71 | before it is finalized. | ||
72 | |||
73 | =head1 RETURN VALUES | ||
74 | |||
75 | PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO | ||
76 | structure just added or NULL if an error occurs. | ||
77 | |||
78 | =head1 SEE ALSO | ||
79 | |||
80 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
81 | L<PKCS7_final(3)|PKCS7_final(3)>, | ||
82 | |||
83 | =head1 HISTORY | ||
84 | |||
85 | PPKCS7_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 index 3490b5dc82..7c10a4cc3c 100644 --- a/src/lib/libcrypto/doc/PKCS7_verify.pod +++ b/src/lib/libcrypto/doc/PKCS7_verify.pod | |||
@@ -6,9 +6,11 @@ PKCS7_verify - verify a PKCS#7 signedData structure | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, int flags); | 9 | #include <openssl/pkcs7.h> |
10 | 10 | ||
11 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); | 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); | ||
12 | 14 | ||
13 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
14 | 16 | ||
diff --git a/src/lib/libcrypto/doc/SMIME_read_CMS.pod b/src/lib/libcrypto/doc/SMIME_read_CMS.pod new file mode 100644 index 0000000000..acc5524c14 --- /dev/null +++ b/src/lib/libcrypto/doc/SMIME_read_CMS.pod | |||
@@ -0,0 +1,70 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SMIME_read_CMS - parse S/MIME message. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/cms.h> | ||
10 | |||
11 | CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SMIME_read_CMS() parses a message in S/MIME format. | ||
16 | |||
17 | B<in> is a BIO to read the message from. | ||
18 | |||
19 | If cleartext signing is used then the content is saved in a memory bio which is | ||
20 | written to B<*bcont>, otherwise B<*bcont> is set to NULL. | ||
21 | |||
22 | The parsed CMS_ContentInfo structure is returned or NULL if an | ||
23 | error occurred. | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | If B<*bcont> is not NULL then the message is clear text signed. B<*bcont> can | ||
28 | then be passed to CMS_verify() with the B<CMS_DETACHED> flag set. | ||
29 | |||
30 | Otherwise the type of the returned structure can be determined | ||
31 | using CMS_get0_type(). | ||
32 | |||
33 | To support future functionality if B<bcont> is not NULL B<*bcont> should be | ||
34 | initialized to NULL. For example: | ||
35 | |||
36 | BIO *cont = NULL; | ||
37 | CMS_ContentInfo *cms; | ||
38 | |||
39 | cms = SMIME_read_CMS(in, &cont); | ||
40 | |||
41 | =head1 BUGS | ||
42 | |||
43 | The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will | ||
44 | handle most S/MIME messages more complex compound formats may not work. | ||
45 | |||
46 | The parser assumes that the CMS_ContentInfo structure is always base64 encoded | ||
47 | and will not handle the case where it is in binary format or uses quoted | ||
48 | printable format. | ||
49 | |||
50 | The use of a memory BIO to hold the signed content limits the size of message | ||
51 | which can be processed due to memory restraints: a streaming single pass option | ||
52 | should be available. | ||
53 | |||
54 | =head1 RETURN VALUES | ||
55 | |||
56 | SMIME_read_CMS() returns a valid B<CMS_ContentInfo> structure or B<NULL> | ||
57 | if an error occurred. The error can be obtained from ERR_get_error(3). | ||
58 | |||
59 | =head1 SEE ALSO | ||
60 | |||
61 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_type(3)|CMS_type(3)> | ||
62 | L<SMIME_read_CMS(3)|SMIME_read_CMS(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
63 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
64 | L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
65 | |||
66 | =head1 HISTORY | ||
67 | |||
68 | SMIME_read_CMS() was added to OpenSSL 0.9.8 | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod b/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod index ffafa37887..9d46715941 100644 --- a/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod +++ b/src/lib/libcrypto/doc/SMIME_read_PKCS7.pod | |||
@@ -6,7 +6,9 @@ SMIME_read_PKCS7 - parse S/MIME message. | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont); | 9 | #include <openssl/pkcs7.h> |
10 | |||
11 | PKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont); | ||
10 | 12 | ||
11 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
12 | 14 | ||
diff --git a/src/lib/libcrypto/doc/SMIME_write_CMS.pod b/src/lib/libcrypto/doc/SMIME_write_CMS.pod new file mode 100644 index 0000000000..04bedfb429 --- /dev/null +++ b/src/lib/libcrypto/doc/SMIME_write_CMS.pod | |||
@@ -0,0 +1,64 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SMIME_write_CMS - convert CMS structure to S/MIME format. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/cms.h> | ||
10 | |||
11 | int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SMIME_write_CMS() adds the appropriate MIME headers to a CMS | ||
16 | structure to produce an S/MIME message. | ||
17 | |||
18 | B<out> is the BIO to write the data to. B<cms> is the appropriate | ||
19 | B<CMS_ContentInfo> structure. If streaming is enabled then the content must be | ||
20 | supplied in the B<data> argument. B<flags> is an optional set of flags. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The following flags can be passed in the B<flags> parameter. | ||
25 | |||
26 | If B<CMS_DETACHED> is set then cleartext signing will be used, this option only | ||
27 | makes sense for SignedData where B<CMS_DETACHED> is also set when CMS_sign() is | ||
28 | called. | ||
29 | |||
30 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to | ||
31 | the content, this only makes sense if B<CMS_DETACHED> is also set. | ||
32 | |||
33 | If the B<CMS_STREAM> flag is set streaming is performed. This flag should only | ||
34 | be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo | ||
35 | creation function. | ||
36 | |||
37 | If cleartext signing is being used and B<CMS_STREAM> not set then the data must | ||
38 | be read twice: once to compute the signature in CMS_sign() and once to output | ||
39 | the S/MIME message. | ||
40 | |||
41 | If streaming is performed the content is output in BER format using indefinite | ||
42 | length constructed encoding except in the case of signed data with detached | ||
43 | content where the content is absent and DER format is used. | ||
44 | |||
45 | =head1 BUGS | ||
46 | |||
47 | SMIME_write_CMS() always base64 encodes CMS structures, there should be an | ||
48 | option to disable this. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | SMIME_write_CMS() returns 1 for success or 0 for failure. | ||
53 | |||
54 | =head1 SEE ALSO | ||
55 | |||
56 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
57 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
58 | L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
59 | |||
60 | =head1 HISTORY | ||
61 | |||
62 | SMIME_write_CMS() was added to OpenSSL 0.9.8 | ||
63 | |||
64 | =cut | ||
diff --git a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod b/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod index 61945b3887..ca6bd02763 100644 --- a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod +++ b/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod | |||
@@ -6,17 +6,18 @@ SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format. | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags); | 9 | #include <openssl/pkcs7.h> |
10 | |||
11 | int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags); | ||
10 | 12 | ||
11 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
12 | 14 | ||
13 | SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7 | 15 | SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7 |
14 | structure to produce an S/MIME message. | 16 | structure to produce an S/MIME message. |
15 | 17 | ||
16 | B<out> is the BIO to write the data to. B<p7> is the appropriate | 18 | B<out> is the BIO to write the data to. B<p7> is the appropriate B<PKCS7> |
17 | B<PKCS7> structure. If cleartext signing (B<multipart/signed>) is | 19 | structure. If streaming is enabled then the content must be supplied in the |
18 | being used then the signed data must be supplied in the B<data> | 20 | B<data> argument. B<flags> is an optional set of flags. |
19 | argument. B<flags> is an optional set of flags. | ||
20 | 21 | ||
21 | =head1 NOTES | 22 | =head1 NOTES |
22 | 23 | ||
@@ -30,15 +31,18 @@ If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> | |||
30 | are added to the content, this only makes sense if B<PKCS7_DETACHED> | 31 | are added to the content, this only makes sense if B<PKCS7_DETACHED> |
31 | is also set. | 32 | is also set. |
32 | 33 | ||
33 | If the B<PKCS7_PARTSIGN> flag is set the signed data is finalized | 34 | If the B<PKCS7_STREAM> flag is set streaming is performed. This flag should |
34 | and output along with the content. This flag should only be set | 35 | only be set if B<PKCS7_STREAM> was also set in the previous call to |
35 | if B<PKCS7_DETACHED> is also set and the previous call to PKCS7_sign() | 36 | PKCS7_sign() or B<PKCS7_encrypt()>. |
36 | also set these flags. | ||
37 | 37 | ||
38 | If cleartext signing is being used and B<PKCS7_PARTSIGN> not set then | 38 | If cleartext signing is being used and B<PKCS7_STREAM> not set then |
39 | the data must be read twice: once to compute the signature in PKCS7_sign() | 39 | the data must be read twice: once to compute the signature in PKCS7_sign() |
40 | and once to output the S/MIME message. | 40 | and once to output the S/MIME message. |
41 | 41 | ||
42 | If streaming is performed the content is output in BER format using indefinite | ||
43 | length constructuted encoding except in the case of signed data with detached | ||
44 | content where the content is absent and DER format is used. | ||
45 | |||
42 | =head1 BUGS | 46 | =head1 BUGS |
43 | 47 | ||
44 | SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there | 48 | SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there |
diff --git a/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod b/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod index 11b35f6fd3..41902c0d45 100644 --- a/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod +++ b/src/lib/libcrypto/doc/X509_NAME_ENTRY_get_object.pod | |||
@@ -9,15 +9,17 @@ X509_NAME_ENTRY_create_by_OBJ - X509_NAME_ENTRY utility functions | |||
9 | 9 | ||
10 | =head1 SYNOPSIS | 10 | =head1 SYNOPSIS |
11 | 11 | ||
12 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); | 12 | #include <openssl/x509.h> |
13 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); | ||
14 | 13 | ||
15 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj); | 14 | ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); |
16 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, const unsigned char *bytes, int len); | 15 | ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); |
17 | 16 | ||
18 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field, int type, const unsigned char *bytes, int len); | 17 | int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, ASN1_OBJECT *obj); |
19 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type,unsigned char *bytes, int len); | 18 | int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, const unsigned char *bytes, int len); |
20 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); | 19 | |
20 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field, int type, const unsigned char *bytes, int len); | ||
21 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type,unsigned char *bytes, int len); | ||
22 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, ASN1_OBJECT *obj, int type, const unsigned char *bytes, int len); | ||
21 | 23 | ||
22 | =head1 DESCRIPTION | 24 | =head1 DESCRIPTION |
23 | 25 | ||
diff --git a/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod b/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod index e2ab4b0d2b..1afd008cb3 100644 --- a/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod +++ b/src/lib/libcrypto/doc/X509_NAME_add_entry_by_txt.pod | |||
@@ -7,15 +7,17 @@ X509_NAME_add_entry, X509_NAME_delete_entry - X509_NAME modification functions | |||
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
10 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); | 10 | #include <openssl/x509.h> |
11 | 11 | ||
12 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); | 12 | int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, const unsigned char *bytes, int len, int loc, int set); |
13 | 13 | ||
14 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); | 14 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set); |
15 | 15 | ||
16 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, int loc, int set); | 16 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set); |
17 | 17 | ||
18 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | 18 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, int loc, int set); |
19 | |||
20 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | ||
19 | 21 | ||
20 | =head1 DESCRIPTION | 22 | =head1 DESCRIPTION |
21 | 23 | ||
diff --git a/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod b/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod index 333323d734..3b1f9ff43b 100644 --- a/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod +++ b/src/lib/libcrypto/doc/X509_NAME_get_index_by_NID.pod | |||
@@ -8,14 +8,16 @@ X509_NAME lookup and enumeration functions | |||
8 | 8 | ||
9 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
10 | 10 | ||
11 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); | 11 | #include <openssl/x509.h> |
12 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, int lastpos); | ||
13 | 12 | ||
14 | int X509_NAME_entry_count(X509_NAME *name); | 13 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); |
15 | X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); | 14 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, int lastpos); |
16 | 15 | ||
17 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf,int len); | 16 | int X509_NAME_entry_count(X509_NAME *name); |
18 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,int len); | 17 | X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); |
18 | |||
19 | int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf,int len); | ||
20 | int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, char *buf,int len); | ||
19 | 21 | ||
20 | =head1 DESCRIPTION | 22 | =head1 DESCRIPTION |
21 | 23 | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod new file mode 100644 index 0000000000..a883f6c097 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_STORE_CTX_get_error.pod | |||
@@ -0,0 +1,303 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_error_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set certificate verification status information | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | #include <openssl/x509_vfy.h> | ||
11 | |||
12 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | ||
13 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | ||
14 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | ||
15 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | ||
16 | |||
17 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); | ||
18 | |||
19 | const char *X509_verify_cert_error_string(long n); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | These functions are typically called after X509_verify_cert() has indicated | ||
24 | an error or in a verification callback to determine the nature of an error. | ||
25 | |||
26 | X509_STORE_CTX_get_error() returns the error code of B<ctx>, see | ||
27 | the B<ERROR CODES> section for a full description of all error codes. | ||
28 | |||
29 | X509_STORE_CTX_set_error() sets the error code of B<ctx> to B<s>. For example | ||
30 | it might be used in a verification callback to set an error based on additional | ||
31 | checks. | ||
32 | |||
33 | X509_STORE_CTX_get_error_depth() returns the B<depth> of the error. This is a | ||
34 | non-negative integer representing where in the certificate chain the error | ||
35 | occurred. If it is zero it occured in the end entity certificate, one if | ||
36 | it is the certificate which signed the end entity certificate and so on. | ||
37 | |||
38 | X509_STORE_CTX_get_current_cert() returns the certificate in B<ctx> which | ||
39 | caused the error or B<NULL> if no certificate is relevant. | ||
40 | |||
41 | X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous | ||
42 | call to X509_verify_cert() is successful. If the call to X509_verify_cert() | ||
43 | is B<not> successful the returned chain may be incomplete or invalid. The | ||
44 | returned chain persists after the B<ctx> structure is freed, when it is | ||
45 | no longer needed it should be free up using: | ||
46 | |||
47 | sk_X509_pop_free(chain, X509_free); | ||
48 | |||
49 | X509_verify_cert_error_string() returns a human readable error string for | ||
50 | verification error B<n>. | ||
51 | |||
52 | =head1 RETURN VALUES | ||
53 | |||
54 | X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code. | ||
55 | |||
56 | X509_STORE_CTX_get_error_depth() returns a non-negative error depth. | ||
57 | |||
58 | X509_STORE_CTX_get_current_cert() returns the cerificate which caused the | ||
59 | error or B<NULL> if no certificate is relevant to the error. | ||
60 | |||
61 | X509_verify_cert_error_string() returns a human readable error string for | ||
62 | verification error B<n>. | ||
63 | |||
64 | =head1 ERROR CODES | ||
65 | |||
66 | A list of error codes and messages is shown below. Some of the | ||
67 | error codes are defined but currently never returned: these are described as | ||
68 | "unused". | ||
69 | |||
70 | =over 4 | ||
71 | |||
72 | =item B<X509_V_OK: ok> | ||
73 | |||
74 | the operation was successful. | ||
75 | |||
76 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate> | ||
77 | |||
78 | the issuer certificate could not be found: this occurs if the issuer certificate | ||
79 | of an untrusted certificate cannot be found. | ||
80 | |||
81 | =item B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL> | ||
82 | |||
83 | the CRL of a certificate could not be found. | ||
84 | |||
85 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature> | ||
86 | |||
87 | the certificate signature could not be decrypted. This means that the actual | ||
88 | signature value could not be determined rather than it not matching the | ||
89 | expected value, this is only meaningful for RSA keys. | ||
90 | |||
91 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature> | ||
92 | |||
93 | the CRL signature could not be decrypted: this means that the actual signature | ||
94 | value could not be determined rather than it not matching the expected value. | ||
95 | Unused. | ||
96 | |||
97 | =item B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key> | ||
98 | |||
99 | the public key in the certificate SubjectPublicKeyInfo could not be read. | ||
100 | |||
101 | =item B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure> | ||
102 | |||
103 | the signature of the certificate is invalid. | ||
104 | |||
105 | =item B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure> | ||
106 | |||
107 | the signature of the certificate is invalid. | ||
108 | |||
109 | =item B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid> | ||
110 | |||
111 | the certificate is not yet valid: the notBefore date is after the current time. | ||
112 | |||
113 | =item B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired> | ||
114 | |||
115 | the certificate has expired: that is the notAfter date is before the current time. | ||
116 | |||
117 | =item B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> | ||
118 | |||
119 | the CRL is not yet valid. | ||
120 | |||
121 | =item B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> | ||
122 | |||
123 | the CRL has expired. | ||
124 | |||
125 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field> | ||
126 | |||
127 | the certificate notBefore field contains an invalid time. | ||
128 | |||
129 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field> | ||
130 | |||
131 | the certificate notAfter field contains an invalid time. | ||
132 | |||
133 | =item B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field> | ||
134 | |||
135 | the CRL lastUpdate field contains an invalid time. | ||
136 | |||
137 | =item B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field> | ||
138 | |||
139 | the CRL nextUpdate field contains an invalid time. | ||
140 | |||
141 | =item B<X509_V_ERR_OUT_OF_MEM: out of memory> | ||
142 | |||
143 | an error occurred trying to allocate memory. This should never happen. | ||
144 | |||
145 | =item B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate> | ||
146 | |||
147 | the passed certificate is self signed and the same certificate cannot be found | ||
148 | in the list of trusted certificates. | ||
149 | |||
150 | =item B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain> | ||
151 | |||
152 | the certificate chain could be built up using the untrusted certificates but | ||
153 | the root could not be found locally. | ||
154 | |||
155 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate> | ||
156 | |||
157 | the issuer certificate of a locally looked up certificate could not be found. | ||
158 | This normally means the list of trusted certificates is not complete. | ||
159 | |||
160 | =item B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate> | ||
161 | |||
162 | no signatures could be verified because the chain contains only one certificate | ||
163 | and it is not self signed. | ||
164 | |||
165 | =item B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long> | ||
166 | |||
167 | the certificate chain length is greater than the supplied maximum depth. Unused. | ||
168 | |||
169 | =item B<X509_V_ERR_CERT_REVOKED: certificate revoked> | ||
170 | |||
171 | the certificate has been revoked. | ||
172 | |||
173 | =item B<X509_V_ERR_INVALID_CA: invalid CA certificate> | ||
174 | |||
175 | a CA certificate is invalid. Either it is not a CA or its extensions are not | ||
176 | consistent with the supplied purpose. | ||
177 | |||
178 | =item B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded> | ||
179 | |||
180 | the basicConstraints pathlength parameter has been exceeded. | ||
181 | |||
182 | =item B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose> | ||
183 | |||
184 | the supplied certificate cannot be used for the specified purpose. | ||
185 | |||
186 | =item B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted> | ||
187 | |||
188 | the root CA is not marked as trusted for the specified purpose. | ||
189 | |||
190 | =item B<X509_V_ERR_CERT_REJECTED: certificate rejected> | ||
191 | |||
192 | the root CA is marked to reject the specified purpose. | ||
193 | |||
194 | =item B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch> | ||
195 | |||
196 | the current candidate issuer certificate was rejected because its subject name | ||
197 | did not match the issuer name of the current certificate. This is only set | ||
198 | if issuer check debugging is enabled it is used for status notification and | ||
199 | is B<not> in itself an error. | ||
200 | |||
201 | =item B<X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch> | ||
202 | |||
203 | the current candidate issuer certificate was rejected because its subject key | ||
204 | identifier was present and did not match the authority key identifier current | ||
205 | certificate. This is only set if issuer check debugging is enabled it is used | ||
206 | for status notification and is B<not> in itself an error. | ||
207 | |||
208 | =item B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch> | ||
209 | |||
210 | the current candidate issuer certificate was rejected because its issuer name | ||
211 | and serial number was present and did not match the authority key identifier of | ||
212 | the current certificate. This is only set if issuer check debugging is enabled | ||
213 | it is used for status notification and is B<not> in itself an error. | ||
214 | |||
215 | =item B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing> | ||
216 | |||
217 | the current candidate issuer certificate was rejected because its keyUsage | ||
218 | extension does not permit certificate signing. This is only set if issuer check | ||
219 | debugging is enabled it is used for status notification and is B<not> in itself | ||
220 | an error. | ||
221 | |||
222 | =item B<X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate extension> | ||
223 | |||
224 | A certificate extension had an invalid value (for example an incorrect | ||
225 | encoding) or some value inconsistent with other extensions. | ||
226 | |||
227 | |||
228 | =item B<X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certificate policy extension> | ||
229 | |||
230 | A certificate policies extension had an invalid value (for example an incorrect | ||
231 | encoding) or some value inconsistent with other extensions. This error only | ||
232 | occurs if policy processing is enabled. | ||
233 | |||
234 | =item B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy> | ||
235 | |||
236 | The verification flags were set to require and explicit policy but none was | ||
237 | present. | ||
238 | |||
239 | =item B<X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope> | ||
240 | |||
241 | The only CRLs that could be found did not match the scope of the certificate. | ||
242 | |||
243 | =item B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension feature> | ||
244 | |||
245 | Some feature of a certificate extension is not supported. Unused. | ||
246 | |||
247 | =item B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation> | ||
248 | |||
249 | A name constraint violation occured in the permitted subtrees. | ||
250 | |||
251 | =item B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation> | ||
252 | |||
253 | A name constraint violation occured in the excluded subtrees. | ||
254 | |||
255 | =item B<X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not supported> | ||
256 | |||
257 | A certificate name constraints extension included a minimum or maximum field: | ||
258 | this is not supported. | ||
259 | |||
260 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint type> | ||
261 | |||
262 | An unsupported name constraint type was encountered. OpenSSL currently only | ||
263 | supports directory name, DNS name, email and URI types. | ||
264 | |||
265 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name constraint syntax> | ||
266 | |||
267 | The format of the name constraint is not recognised: for example an email | ||
268 | address format of a form not mentioned in RFC3280. This could be caused by | ||
269 | a garbage extension or some new feature not currently supported. | ||
270 | |||
271 | =item B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error> | ||
272 | |||
273 | An error occured when attempting to verify the CRL path. This error can only | ||
274 | happen if extended CRL checking is enabled. | ||
275 | |||
276 | =item B<X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> | ||
277 | |||
278 | an application specific error. This will never be returned unless explicitly | ||
279 | set by an application. | ||
280 | |||
281 | =head1 NOTES | ||
282 | |||
283 | The above functions should be used instead of directly referencing the fields | ||
284 | in the B<X509_VERIFY_CTX> structure. | ||
285 | |||
286 | In versions of OpenSSL before 1.0 the current certificate returned by | ||
287 | X509_STORE_CTX_get_current_cert() was never B<NULL>. Applications should | ||
288 | check the return value before printing out any debugging information relating | ||
289 | to the current certificate. | ||
290 | |||
291 | If an unrecognised error code is passed to X509_verify_cert_error_string() the | ||
292 | numerical value of the unknown code is returned in a static buffer. This is not | ||
293 | thread safe but will never happen unless an invalid code is passed. | ||
294 | |||
295 | =head1 SEE ALSO | ||
296 | |||
297 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
298 | |||
299 | =head1 HISTORY | ||
300 | |||
301 | TBA | ||
302 | |||
303 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod new file mode 100644 index 0000000000..8d6b9dda47 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_STORE_CTX_get_ex_new_index.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data - add application specific data to X509_STORE_CTX structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, | ||
12 | CRYPTO_EX_new *new_func, | ||
13 | CRYPTO_EX_dup *dup_func, | ||
14 | CRYPTO_EX_free *free_func); | ||
15 | |||
16 | int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg); | ||
17 | |||
18 | char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | These functions handle application specific data in X509_STORE_CTX structures. | ||
23 | Their usage is identical to that of RSA_get_ex_new_index(), RSA_set_ex_data() | ||
24 | and RSA_get_ex_data() as described in L<RSA_get_ex_new_index(3)>. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | This mechanism is used internally by the B<ssl> library to store the B<SSL> | ||
29 | structure associated with a verification operation in an B<X509_STORE_CTX> | ||
30 | structure. | ||
31 | |||
32 | =head1 SEE ALSO | ||
33 | |||
34 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)> | ||
35 | |||
36 | =head1 HISTORY | ||
37 | |||
38 | X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data() and | ||
39 | X509_STORE_CTX_get_ex_data() are available since OpenSSL 0.9.5. | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod new file mode 100644 index 0000000000..b17888f149 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_STORE_CTX_new.pod | |||
@@ -0,0 +1,122 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX initialisation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | X509_STORE_CTX *X509_STORE_CTX_new(void); | ||
12 | void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); | ||
13 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx); | ||
14 | |||
15 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, | ||
16 | X509 *x509, STACK_OF(X509) *chain); | ||
17 | |||
18 | void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); | ||
19 | |||
20 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x); | ||
21 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk); | ||
22 | void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk); | ||
23 | |||
24 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); | ||
25 | void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); | ||
26 | int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | These functions initialise an B<X509_STORE_CTX> structure for subsequent use | ||
31 | by X509_verify_cert(). | ||
32 | |||
33 | X509_STORE_CTX_new() returns a newly initialised B<X509_STORE_CTX> structure. | ||
34 | |||
35 | X509_STORE_CTX_cleanup() internally cleans up an B<X509_STORE_CTX> structure. | ||
36 | The context can then be reused with an new call to X509_STORE_CTX_init(). | ||
37 | |||
38 | X509_STORE_CTX_free() completely frees up B<ctx>. After this call B<ctx> | ||
39 | is no longer valid. | ||
40 | |||
41 | X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operation. | ||
42 | The trusted certificate store is set to B<store>, the end entity certificate | ||
43 | to be verified is set to B<x509> and a set of additional certificates (which | ||
44 | will be untrusted but may be used to build the chain) in B<chain>. Any or | ||
45 | all of the B<store>, B<x509> and B<chain> parameters can be B<NULL>. | ||
46 | |||
47 | X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of B<ctx> | ||
48 | to B<sk>. This is an alternative way of specifying trusted certificates | ||
49 | instead of using an B<X509_STORE>. | ||
50 | |||
51 | X509_STORE_CTX_set_cert() sets the certificate to be vertified in B<ctx> to | ||
52 | B<x>. | ||
53 | |||
54 | X509_STORE_CTX_set_chain() sets the additional certificate chain used by B<ctx> | ||
55 | to B<sk>. | ||
56 | |||
57 | X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate | ||
58 | verification to B<sk>. These CRLs will only be used if CRL verification is | ||
59 | enabled in the associated B<X509_VERIFY_PARAM> structure. This might be | ||
60 | used where additional "useful" CRLs are supplied as part of a protocol, | ||
61 | for example in a PKCS#7 structure. | ||
62 | |||
63 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an intenal pointer | ||
64 | to the verification parameters associated with B<ctx>. | ||
65 | |||
66 | X509_STORE_CTX_set0_param() sets the intenal verification parameter pointer | ||
67 | to B<param>. After this call B<param> should not be used. | ||
68 | |||
69 | X509_STORE_CTX_set_default() looks up and sets the default verification | ||
70 | method to B<name>. This uses the function X509_VERIFY_PARAM_lookup() to | ||
71 | find an appropriate set of parameters from B<name>. | ||
72 | |||
73 | =head1 NOTES | ||
74 | |||
75 | The certificates and CRLs in a store are used internally and should B<not> | ||
76 | be freed up until after the associated B<X509_STORE_CTX> is freed. Legacy | ||
77 | applications might implicitly use an B<X509_STORE_CTX> like this: | ||
78 | |||
79 | X509_STORE_CTX ctx; | ||
80 | X509_STORE_CTX_init(&ctx, store, cert, chain); | ||
81 | |||
82 | this is B<not> recommended in new applications they should instead do: | ||
83 | |||
84 | X509_STORE_CTX *ctx; | ||
85 | ctx = X509_STORE_CTX_new(); | ||
86 | if (ctx == NULL) | ||
87 | /* Bad error */ | ||
88 | X509_STORE_CTX_init(ctx, store, cert, chain); | ||
89 | |||
90 | =head1 BUGS | ||
91 | |||
92 | The certificates and CRLs in a context are used internally and should B<not> | ||
93 | be freed up until after the associated B<X509_STORE_CTX> is freed. Copies | ||
94 | should be made or reference counts increased instead. | ||
95 | |||
96 | =head1 RETURN VALUES | ||
97 | |||
98 | X509_STORE_CTX_new() returns an newly allocates context or B<NULL> is an | ||
99 | error occurred. | ||
100 | |||
101 | X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred. | ||
102 | |||
103 | X509_STORE_CTX_get0_param() returns a pointer to an B<X509_VERIFY_PARAM> | ||
104 | structure or B<NULL> if an error occurred. | ||
105 | |||
106 | X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_trusted_stack(), | ||
107 | X509_STORE_CTX_set_cert(), X509_STORE_CTX_set_chain(), | ||
108 | X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return | ||
109 | values. | ||
110 | |||
111 | X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred. | ||
112 | |||
113 | =head1 SEE ALSO | ||
114 | |||
115 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
116 | L<X509_VERIFY_PARAM_set_flags(3)|X509_VERIFY_PARAM_set_flags(3)> | ||
117 | |||
118 | =head1 HISTORY | ||
119 | |||
120 | X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0 | ||
121 | |||
122 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod b/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod new file mode 100644 index 0000000000..b9787a6ca6 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_STORE_CTX_set_verify_cb.pod | |||
@@ -0,0 +1,161 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_CTX_set_verify_cb - set verification callback | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | ||
12 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | X509_STORE_CTX_set_verify_cb() sets the verification callback of B<ctx> to | ||
17 | B<verify_cb> overwriting any existing callback. | ||
18 | |||
19 | The verification callback can be used to customise the operation of certificate | ||
20 | verification, either by overriding error conditions or logging errors for | ||
21 | debugging purposes. | ||
22 | |||
23 | However a verification callback is B<not> essential and the default operation | ||
24 | is often sufficient. | ||
25 | |||
26 | The B<ok> parameter to the callback indicates the value the callback should | ||
27 | return to retain the default behaviour. If it is zero then and error condition | ||
28 | is indicated. If it is 1 then no error occurred. If the flag | ||
29 | B<X509_V_FLAG_NOTIFY_POLICY> is set then B<ok> is set to 2 to indicate the | ||
30 | policy checking is complete. | ||
31 | |||
32 | The B<ctx> parameter to the callback is the B<X509_STORE_CTX> structure that | ||
33 | is performing the verification operation. A callback can examine this | ||
34 | structure and receive additional information about the error, for example | ||
35 | by calling X509_STORE_CTX_get_current_cert(). Additional application data can | ||
36 | be passed to the callback via the B<ex_data> mechanism. | ||
37 | |||
38 | =head1 WARNING | ||
39 | |||
40 | In general a verification callback should B<NOT> unconditionally return 1 in | ||
41 | all circumstances because this will allow verification to succeed no matter | ||
42 | what the error. This effectively removes all security from the application | ||
43 | because B<any> certificate (including untrusted generated ones) will be | ||
44 | accepted. | ||
45 | |||
46 | =head1 NOTES | ||
47 | |||
48 | The verification callback can be set and inherited from the parent structure | ||
49 | performing the operation. In some cases (such as S/MIME verification) the | ||
50 | B<X509_STORE_CTX> structure is created and destroyed internally and the | ||
51 | only way to set a custom verification callback is by inheriting it from the | ||
52 | associated B<X509_STORE>. | ||
53 | |||
54 | =head1 RETURN VALUES | ||
55 | |||
56 | X509_STORE_CTX_set_verify_cb() does not return a value. | ||
57 | |||
58 | =head1 EXAMPLES | ||
59 | |||
60 | Default callback operation: | ||
61 | |||
62 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
63 | { | ||
64 | return ok; | ||
65 | } | ||
66 | |||
67 | Simple example, suppose a certificate in the chain is expired and we wish | ||
68 | to continue after this error: | ||
69 | |||
70 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
71 | { | ||
72 | /* Tolerate certificate expiration */ | ||
73 | if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) | ||
74 | return 1; | ||
75 | /* Otherwise don't override */ | ||
76 | return ok; | ||
77 | } | ||
78 | |||
79 | More complex example, we don't wish to continue after B<any> certificate has | ||
80 | expired just one specific case: | ||
81 | |||
82 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
83 | { | ||
84 | int err = X509_STORE_CTX_get_error(ctx); | ||
85 | X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
86 | if (err == X509_V_ERR_CERT_HAS_EXPIRED) | ||
87 | { | ||
88 | if (check_is_acceptable_expired_cert(err_cert) | ||
89 | return 1; | ||
90 | } | ||
91 | return ok; | ||
92 | } | ||
93 | |||
94 | Full featured logging callback. In this case the B<bio_err> is assumed to be | ||
95 | a global logging B<BIO>, an alternative would to store a BIO in B<ctx> using | ||
96 | B<ex_data>. | ||
97 | |||
98 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
99 | { | ||
100 | X509 *err_cert; | ||
101 | int err,depth; | ||
102 | |||
103 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
104 | err = X509_STORE_CTX_get_error(ctx); | ||
105 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
106 | |||
107 | BIO_printf(bio_err,"depth=%d ",depth); | ||
108 | if (err_cert) | ||
109 | { | ||
110 | X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert), | ||
111 | 0, XN_FLAG_ONELINE); | ||
112 | BIO_puts(bio_err, "\n"); | ||
113 | } | ||
114 | else | ||
115 | BIO_puts(bio_err, "<no cert>\n"); | ||
116 | if (!ok) | ||
117 | BIO_printf(bio_err,"verify error:num=%d:%s\n",err, | ||
118 | X509_verify_cert_error_string(err)); | ||
119 | switch (err) | ||
120 | { | ||
121 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
122 | BIO_puts(bio_err,"issuer= "); | ||
123 | X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), | ||
124 | 0, XN_FLAG_ONELINE); | ||
125 | BIO_puts(bio_err, "\n"); | ||
126 | break; | ||
127 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
128 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
129 | BIO_printf(bio_err,"notBefore="); | ||
130 | ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert)); | ||
131 | BIO_printf(bio_err,"\n"); | ||
132 | break; | ||
133 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
134 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
135 | BIO_printf(bio_err,"notAfter="); | ||
136 | ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert)); | ||
137 | BIO_printf(bio_err,"\n"); | ||
138 | break; | ||
139 | case X509_V_ERR_NO_EXPLICIT_POLICY: | ||
140 | policies_print(bio_err, ctx); | ||
141 | break; | ||
142 | } | ||
143 | if (err == X509_V_OK && ok == 2) | ||
144 | /* print out policies */ | ||
145 | |||
146 | BIO_printf(bio_err,"verify return:%d\n",ok); | ||
147 | return(ok); | ||
148 | } | ||
149 | |||
150 | =head1 SEE ALSO | ||
151 | |||
152 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
153 | L<X509_STORE_set_verify_cb_func(3)|X509_STORE_set_verify_cb_func(3)> | ||
154 | L<X509_STORE_CTX_get_ex_new_index(3)|X509_STORE_CTX_get_ex_new_index(3)> | ||
155 | |||
156 | =head1 HISTORY | ||
157 | |||
158 | X509_STORE_CTX_set_verify_cb() is available in all versions of SSLeay and | ||
159 | OpenSSL. | ||
160 | |||
161 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod b/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod new file mode 100644 index 0000000000..29e3bbe3bc --- /dev/null +++ b/src/lib/libcrypto/doc/X509_STORE_set_verify_cb_func.pod | |||
@@ -0,0 +1,54 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb - set verification callback | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | void X509_STORE_set_verify_cb(X509_STORE *st, | ||
12 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
13 | |||
14 | void X509_STORE_set_verify_cb_func(X509_STORE *st, | ||
15 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to | ||
20 | B<verify_cb> overwriting any existing callback. | ||
21 | |||
22 | X509_STORE_set_verify_cb_func() also sets the verification callback but it | ||
23 | is implemented as a macro. | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | The verification callback from an B<X509_STORE> is inherited by | ||
28 | the corresponding B<X509_STORE_CTX> structure when it is initialized. This can | ||
29 | be used to set the verification callback when the B<X509_STORE_CTX> is | ||
30 | otherwise inaccessible (for example during S/MIME verification). | ||
31 | |||
32 | =head1 BUGS | ||
33 | |||
34 | The macro version of this function was the only one available before | ||
35 | OpenSSL 1.0.0. | ||
36 | |||
37 | =head1 RETURN VALUES | ||
38 | |||
39 | X509_STORE_set_verify_cb() and X509_STORE_set_verify_cb_func() do not return | ||
40 | a value. | ||
41 | |||
42 | =head1 SEE ALSO | ||
43 | |||
44 | L<X509_STORE_CTX_set_verify_cb(3)|X509_STORE_CTX_set_verify_cb(3)> | ||
45 | L<CMS_verify(3)|CMS_verify(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | X509_STORE_set_verify_cb_func() is available in all versions of SSLeay and | ||
50 | OpenSSL. | ||
51 | |||
52 | X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0. | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod b/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod new file mode 100644 index 0000000000..b68eece033 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_VERIFY_PARAM_set_flags.pod | |||
@@ -0,0 +1,171 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies - X509 verification parameters | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509_vfy.h> | ||
10 | |||
11 | int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); | ||
12 | int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, | ||
13 | unsigned long flags); | ||
14 | unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); | ||
15 | |||
16 | int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); | ||
17 | int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); | ||
18 | |||
19 | void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); | ||
20 | |||
21 | int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, | ||
22 | ASN1_OBJECT *policy); | ||
23 | int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, | ||
24 | STACK_OF(ASN1_OBJECT) *policies); | ||
25 | |||
26 | void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); | ||
27 | int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | These functions manipulate the B<X509_VERIFY_PARAM> structure associated with | ||
32 | a certificate verification operation. | ||
33 | |||
34 | The X509_VERIFY_PARAM_set_flags() function sets the flags in B<param> by oring | ||
35 | it with B<flags>. See the B<VERIFICATION FLAGS> section for a complete | ||
36 | description of values the B<flags> parameter can take. | ||
37 | |||
38 | X509_VERIFY_PARAM_get_flags() returns the flags in B<param>. | ||
39 | |||
40 | X509_VERIFY_PARAM_clear_flags() clears the flags B<flags> in B<param>. | ||
41 | |||
42 | X509_VERIFY_PARAM_set_purpose() sets the verification purpose in B<param> | ||
43 | to B<purpose>. This determines the acceptable purpose of the certificate | ||
44 | chain, for example SSL client or SSL server. | ||
45 | |||
46 | X509_VERIFY_PARAM_set_trust() sets the trust setting in B<param> to | ||
47 | B<trust>. | ||
48 | |||
49 | X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to | ||
50 | B<t>. Normally the current time is used. | ||
51 | |||
52 | X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled | ||
53 | by default) and adds B<policy> to the acceptable policy set. | ||
54 | |||
55 | X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled | ||
56 | by default) and sets the acceptable policy set to B<policies>. Any existing | ||
57 | policy set is cleared. The B<policies> parameter can be B<NULL> to clear | ||
58 | an existing policy set. | ||
59 | |||
60 | X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to B<depth>. | ||
61 | That is the maximum number of untrusted CA certificates that can appear in a | ||
62 | chain. | ||
63 | |||
64 | =head1 RETURN VALUES | ||
65 | |||
66 | X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(), | ||
67 | X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(), | ||
68 | X509_VERIFY_PARAM_add0_policy() and X509_VERIFY_PARAM_set1_policies() return 1 | ||
69 | for success and 0 for failure. | ||
70 | |||
71 | X509_VERIFY_PARAM_get_flags() returns the current verification flags. | ||
72 | |||
73 | X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return | ||
74 | values. | ||
75 | |||
76 | X509_VERIFY_PARAM_get_depth() returns the current verification depth. | ||
77 | |||
78 | =head1 VERIFICATION FLAGS | ||
79 | |||
80 | The verification flags consists of zero or more of the following flags | ||
81 | ored together. | ||
82 | |||
83 | B<X509_V_FLAG_CRL_CHECK> enables CRL checking for the certificate chain leaf | ||
84 | certificate. An error occurs if a suitable CRL cannot be found. | ||
85 | |||
86 | B<X509_V_FLAG_CRL_CHECK_ALL> enables CRL checking for the entire certificate | ||
87 | chain. | ||
88 | |||
89 | B<X509_V_FLAG_IGNORE_CRITICAL> disabled critical extension checking. By default | ||
90 | any unhandled critical extensions in certificates or (if checked) CRLs results | ||
91 | in a fatal error. If this flag is set unhandled critical extensions are | ||
92 | ignored. B<WARNING> setting this option for anything other than debugging | ||
93 | purposes can be a security risk. Finer control over which extensions are | ||
94 | supported can be performed in the verification callback. | ||
95 | |||
96 | THe B<X509_V_FLAG_X509_STRICT> flag disables workarounds for some broken | ||
97 | certificates and makes the verification strictly apply B<X509> rules. | ||
98 | |||
99 | B<X509_V_FLAG_ALLOW_PROXY_CERTS> enables proxy certificate verification. | ||
100 | |||
101 | B<X509_V_FLAG_POLICY_CHECK> enables certificate policy checking, by default | ||
102 | no policy checking is peformed. Additional information is sent to the | ||
103 | verification callback relating to policy checking. | ||
104 | |||
105 | B<X509_V_FLAG_EXPLICIT_POLICY>, B<X509_V_FLAG_INHIBIT_ANY> and | ||
106 | B<X509_V_FLAG_INHIBIT_MAP> set the B<require explicit policy>, B<inhibit any | ||
107 | policy> and B<inhibit policy mapping> flags respectively as defined in | ||
108 | B<RFC3280>. Policy checking is automatically enabled if any of these flags | ||
109 | are set. | ||
110 | |||
111 | If B<X509_V_FLAG_NOTIFY_POLICY> is set and the policy checking is successful | ||
112 | a special status code is set to the verification callback. This permits it | ||
113 | to examine the valid policy tree and perform additional checks or simply | ||
114 | log it for debugging purposes. | ||
115 | |||
116 | By default some addtional features such as indirect CRLs and CRLs signed by | ||
117 | different keys are disabled. If B<X509_V_FLAG_EXTENDED_CRL_SUPPORT> is set | ||
118 | they are enabled. | ||
119 | |||
120 | If B<X509_V_FLAG_USE_DELTAS> ise set delta CRLs (if present) are used to | ||
121 | determine certificate status. If not set deltas are ignored. | ||
122 | |||
123 | B<X509_V_FLAG_CHECK_SS_SIGNATURE> enables checking of the root CA self signed | ||
124 | cerificate signature. By default this check is disabled because it doesn't | ||
125 | add any additional security but in some cases applications might want to | ||
126 | check the signature anyway. A side effect of not checking the root CA | ||
127 | signature is that disabled or unsupported message digests on the root CA | ||
128 | are not treated as fatal errors. | ||
129 | |||
130 | The B<X509_V_FLAG_CB_ISSUER_CHECK> flag enables debugging of certificate | ||
131 | issuer checks. It is B<not> needed unless you are logging certificate | ||
132 | verification. If this flag is set then additional status codes will be sent | ||
133 | to the verification callback and it B<must> be prepared to handle such cases | ||
134 | without assuming they are hard errors. | ||
135 | |||
136 | =head1 NOTES | ||
137 | |||
138 | The above functions should be used to manipulate verification parameters | ||
139 | instead of legacy functions which work in specific structures such as | ||
140 | X509_STORE_CTX_set_flags(). | ||
141 | |||
142 | =head1 BUGS | ||
143 | |||
144 | Delta CRL checking is currently primitive. Only a single delta can be used and | ||
145 | (partly due to limitations of B<X509_STORE>) constructed CRLs are not | ||
146 | maintained. | ||
147 | |||
148 | If CRLs checking is enable CRLs are expected to be available in the | ||
149 | corresponding B<X509_STORE> structure. No attempt is made to download | ||
150 | CRLs from the CRL distribution points extension. | ||
151 | |||
152 | =head1 EXAMPLE | ||
153 | |||
154 | Enable CRL checking when performing certificate verification during SSL | ||
155 | connections associated with an B<SSL_CTX> structure B<ctx>: | ||
156 | |||
157 | X509_VERIFY_PARAM *param; | ||
158 | param = X509_VERIFY_PARAM_new(); | ||
159 | X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); | ||
160 | SSL_CTX_set1_param(ctx, param); | ||
161 | X509_VERIFY_PARAM_free(param); | ||
162 | |||
163 | =head1 SEE ALSO | ||
164 | |||
165 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
166 | |||
167 | =head1 HISTORY | ||
168 | |||
169 | TBA | ||
170 | |||
171 | =cut | ||
diff --git a/src/lib/libcrypto/doc/X509_new.pod b/src/lib/libcrypto/doc/X509_new.pod index fd5fc65ce1..d38872335f 100644 --- a/src/lib/libcrypto/doc/X509_new.pod +++ b/src/lib/libcrypto/doc/X509_new.pod | |||
@@ -6,6 +6,8 @@ X509_new, X509_free - X509 certificate ASN1 allocation functions | |||
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/x509.h> | ||
10 | |||
9 | X509 *X509_new(void); | 11 | X509 *X509_new(void); |
10 | void X509_free(X509 *a); | 12 | void X509_free(X509 *a); |
11 | 13 | ||
diff --git a/src/lib/libcrypto/doc/X509_verify_cert.pod b/src/lib/libcrypto/doc/X509_verify_cert.pod new file mode 100644 index 0000000000..5253bdcd70 --- /dev/null +++ b/src/lib/libcrypto/doc/X509_verify_cert.pod | |||
@@ -0,0 +1,53 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | X509_verify_cert - discover and verify X509 certificte chain | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/x509.h> | ||
10 | |||
11 | int X509_verify_cert(X509_STORE_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | The X509_verify_cert() function attempts to discover and validate a | ||
16 | certificate chain based on parameters in B<ctx>. A complete description of | ||
17 | the process is contained in the L<verify(1)|verify(1)> manual page. | ||
18 | |||
19 | =head1 RETURN VALUES | ||
20 | |||
21 | If a complete chain can be built and validated this function returns 1, | ||
22 | otherwise it return zero, in exceptional circumstances it can also | ||
23 | return a negative code. | ||
24 | |||
25 | If the function fails additional error information can be obtained by | ||
26 | examining B<ctx> using, for example X509_STORE_CTX_get_error(). | ||
27 | |||
28 | =head1 NOTES | ||
29 | |||
30 | Applications rarely call this function directly but it is used by | ||
31 | OpenSSL internally for certificate validation, in both the S/MIME and | ||
32 | SSL/TLS code. | ||
33 | |||
34 | The negative return value from X509_verify_cert() can only occur if no | ||
35 | certificate is set in B<ctx> (due to a programming error) or if a retry | ||
36 | operation is requested during internal lookups (which never happens with | ||
37 | standard lookup methods). It is however recommended that application check | ||
38 | for <= 0 return value on error. | ||
39 | |||
40 | =head1 BUGS | ||
41 | |||
42 | This function uses the header B<x509.h> as opposed to most chain verification | ||
43 | functiosn which use B<x509_vfy.h>. | ||
44 | |||
45 | =head1 SEE ALSO | ||
46 | |||
47 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
48 | |||
49 | =head1 HISTORY | ||
50 | |||
51 | X509_verify_cert() is available in all versions of SSLeay and OpenSSL. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509.pod b/src/lib/libcrypto/doc/d2i_X509.pod index 5bfa18afbb..298ec54a4c 100644 --- a/src/lib/libcrypto/doc/d2i_X509.pod +++ b/src/lib/libcrypto/doc/d2i_X509.pod | |||
@@ -15,8 +15,8 @@ i2d_X509_fp - X509 encode and decode functions | |||
15 | X509 *d2i_X509_bio(BIO *bp, X509 **x); | 15 | X509 *d2i_X509_bio(BIO *bp, X509 **x); |
16 | X509 *d2i_X509_fp(FILE *fp, X509 **x); | 16 | X509 *d2i_X509_fp(FILE *fp, X509 **x); |
17 | 17 | ||
18 | int i2d_X509_bio(X509 *x, BIO *bp); | 18 | int i2d_X509_bio(BIO *bp, X509 *x); |
19 | int i2d_X509_fp(X509 *x, FILE *fp); | 19 | int i2d_X509_fp(FILE *fp, X509 *x); |
20 | 20 | ||
21 | =head1 DESCRIPTION | 21 | =head1 DESCRIPTION |
22 | 22 | ||
@@ -212,11 +212,11 @@ d2i_X509(), d2i_X509_bio() and d2i_X509_fp() return a valid B<X509> structure | |||
212 | or B<NULL> if an error occurs. The error code that can be obtained by | 212 | or B<NULL> if an error occurs. The error code that can be obtained by |
213 | L<ERR_get_error(3)|ERR_get_error(3)>. | 213 | L<ERR_get_error(3)|ERR_get_error(3)>. |
214 | 214 | ||
215 | i2d_X509(), i2d_X509_bio() and i2d_X509_fp() return a the number of bytes | 215 | i2d_X509() returns the number of bytes successfully encoded or a negative |
216 | successfully encoded or a negative value if an error occurs. The error code | 216 | value if an error occurs. The error code can be obtained by |
217 | can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | 217 | L<ERR_get_error(3)|ERR_get_error(3)>. |
218 | 218 | ||
219 | i2d_X509_bio() and i2d_X509_fp() returns 1 for success and 0 if an error | 219 | i2d_X509_bio() and i2d_X509_fp() return 1 for success and 0 if an error |
220 | occurs The error code can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | 220 | occurs The error code can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. |
221 | 221 | ||
222 | =head1 SEE ALSO | 222 | =head1 SEE ALSO |
diff --git a/src/lib/libcrypto/doc/d2i_X509_CRL.pod b/src/lib/libcrypto/doc/d2i_X509_CRL.pod index e7295a5d61..224f9e082b 100644 --- a/src/lib/libcrypto/doc/d2i_X509_CRL.pod +++ b/src/lib/libcrypto/doc/d2i_X509_CRL.pod | |||
@@ -15,8 +15,8 @@ i2d_X509_CRL_bio, i2d_X509_CRL_fp - PKCS#10 certificate request functions. | |||
15 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); | 15 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); |
16 | X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **x); | 16 | X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **x); |
17 | 17 | ||
18 | int i2d_X509_CRL_bio(X509_CRL *x, BIO *bp); | 18 | int i2d_X509_CRL_bio(BIO *bp, X509_CRL *x); |
19 | int i2d_X509_CRL_fp(X509_CRL *x, FILE *fp); | 19 | int i2d_X509_CRL_fp(FILE *fp, X509_CRL *x); |
20 | 20 | ||
21 | =head1 DESCRIPTION | 21 | =head1 DESCRIPTION |
22 | 22 | ||
diff --git a/src/lib/libcrypto/doc/d2i_X509_REQ.pod b/src/lib/libcrypto/doc/d2i_X509_REQ.pod index ae32a3891d..91c0c1974b 100644 --- a/src/lib/libcrypto/doc/d2i_X509_REQ.pod +++ b/src/lib/libcrypto/doc/d2i_X509_REQ.pod | |||
@@ -15,8 +15,8 @@ i2d_X509_REQ_bio, i2d_X509_REQ_fp - PKCS#10 certificate request functions. | |||
15 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); | 15 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); |
16 | X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **x); | 16 | X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **x); |
17 | 17 | ||
18 | int i2d_X509_REQ_bio(X509_REQ *x, BIO *bp); | 18 | int i2d_X509_REQ_bio(BIO *bp, X509_REQ *x); |
19 | int i2d_X509_REQ_fp(X509_REQ *x, FILE *fp); | 19 | int i2d_X509_REQ_fp(FILE *fp, X509_REQ *x); |
20 | 20 | ||
21 | =head1 DESCRIPTION | 21 | =head1 DESCRIPTION |
22 | 22 | ||
diff --git a/src/lib/libcrypto/doc/i2d_CMS_bio_stream.pod b/src/lib/libcrypto/doc/i2d_CMS_bio_stream.pod new file mode 100644 index 0000000000..558bdd0812 --- /dev/null +++ b/src/lib/libcrypto/doc/i2d_CMS_bio_stream.pod | |||
@@ -0,0 +1,44 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/cms.h> | ||
10 | |||
11 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format. | ||
16 | |||
17 | It is otherwise identical to the function SMIME_write_CMS(). | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | This function is effectively a version of the i2d_CMS_bio() supporting | ||
22 | streaming. | ||
23 | |||
24 | =head1 BUGS | ||
25 | |||
26 | The prefix "i2d" is arguably wrong because the function outputs BER format. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | i2d_CMS_bio_stream() returns 1 for success or 0 for failure. | ||
31 | |||
32 | =head1 SEE ALSO | ||
33 | |||
34 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
35 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
36 | L<CMS_decrypt(3)|CMS_decrypt(3)>, | ||
37 | L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>, | ||
38 | L<PEM_write_bio_CMS_stream(3)|PEM_write_bio_CMS_stream(3)> | ||
39 | |||
40 | =head1 HISTORY | ||
41 | |||
42 | i2d_CMS_bio_stream() was added to OpenSSL 1.0.0 | ||
43 | |||
44 | =cut | ||
diff --git a/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod b/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod new file mode 100644 index 0000000000..dc4d884c59 --- /dev/null +++ b/src/lib/libcrypto/doc/i2d_PKCS7_bio_stream.pod | |||
@@ -0,0 +1,44 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | i2d_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 | |||
15 | i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format. | ||
16 | |||
17 | It is otherwise identical to the function SMIME_write_PKCS7(). | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | This function is effectively a version of the d2i_PKCS7_bio() supporting | ||
22 | streaming. | ||
23 | |||
24 | =head1 BUGS | ||
25 | |||
26 | The prefix "d2i" is arguably wrong because the function outputs BER format. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure. | ||
31 | |||
32 | =head1 SEE ALSO | ||
33 | |||
34 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
35 | L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> | ||
36 | L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>, | ||
37 | L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>, | ||
38 | L<PEM_write_bio_PKCS7_stream(3)|PEM_write_bio_PKCS7_stream(3)> | ||
39 | |||
40 | =head1 HISTORY | ||
41 | |||
42 | i2d_PKCS7_bio_stream() was added to OpenSSL 1.0.0 | ||
43 | |||
44 | =cut | ||