diff options
author | schwarze <> | 2016-12-05 18:24:08 +0000 |
---|---|---|
committer | schwarze <> | 2016-12-05 18:24:08 +0000 |
commit | 5e667a70479419d08aa5042c692cf8c3ff282916 (patch) | |
tree | b8ddcc29259acd8efd50cf94425421827a385a2d | |
parent | d5694b0bdfc7bb2ce8043ccab2f3e6c1bb8b33e8 (diff) | |
download | openbsd-5e667a70479419d08aa5042c692cf8c3ff282916.tar.gz openbsd-5e667a70479419d08aa5042c692cf8c3ff282916.tar.bz2 openbsd-5e667a70479419d08aa5042c692cf8c3ff282916.zip |
import the relevant parts of six more X509 manuals from OpenSSL
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_get_pubkey.3 | 147 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_get_serialNumber.3 | 112 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_get_subject_name.3 | 169 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_get_version.3 | 149 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_sign.3 | 202 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 | 387 |
7 files changed, 1173 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 3c14577966..f6c0ef249a 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.65 2016/12/05 16:13:19 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.66 2016/12/05 18:24:08 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -190,8 +190,14 @@ MAN= \ | |||
190 | X509_check_ca.3 \ | 190 | X509_check_ca.3 \ |
191 | X509_check_host.3 \ | 191 | X509_check_host.3 \ |
192 | X509_check_issued.3 \ | 192 | X509_check_issued.3 \ |
193 | X509_get_pubkey.3 \ | ||
194 | X509_get_serialNumber.3 \ | ||
195 | X509_get_subject_name.3 \ | ||
196 | X509_get_version.3 \ | ||
193 | X509_new.3 \ | 197 | X509_new.3 \ |
198 | X509_sign.3 \ | ||
194 | X509_verify_cert.3 \ | 199 | X509_verify_cert.3 \ |
200 | X509v3_get_ext_by_NID.3 \ | ||
195 | bn.3 \ | 201 | bn.3 \ |
196 | bn_dump.3 \ | 202 | bn_dump.3 \ |
197 | crypto.3 \ | 203 | crypto.3 \ |
diff --git a/src/lib/libcrypto/man/X509_get_pubkey.3 b/src/lib/libcrypto/man/X509_get_pubkey.3 new file mode 100644 index 0000000000..8948f5cfda --- /dev/null +++ b/src/lib/libcrypto/man/X509_get_pubkey.3 | |||
@@ -0,0 +1,147 @@ | |||
1 | .\" $OpenBSD: X509_get_pubkey.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL e7fabc5e Sep 7 13:41:20 2015 +0100 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509_GET_PUBKEY 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509_get_pubkey , | ||
56 | .Nm X509_set_pubkey , | ||
57 | .Nm X509_get_X509_PUBKEY , | ||
58 | .Nm X509_REQ_get_pubkey , | ||
59 | .Nm X509_REQ_set_pubkey | ||
60 | .Nd get or set certificate or certificate request public key | ||
61 | .Sh SYNOPSIS | ||
62 | .In openssl/x509.h | ||
63 | .Ft EVP_PKEY * | ||
64 | .Fo X509_get_pubkey | ||
65 | .Fa "X509 *x" | ||
66 | .Fc | ||
67 | .Ft int | ||
68 | .Fo X509_set_pubkey | ||
69 | .Fa "X509 *x" | ||
70 | .Fa "EVP_PKEY *pkey" | ||
71 | .Fc | ||
72 | .Ft X509_PUBKEY * | ||
73 | .Fo X509_get_X509_PUBKEY | ||
74 | .Fa "X509 *x" | ||
75 | .Fc | ||
76 | .Ft EVP_PKEY * | ||
77 | .Fo X509_REQ_get_pubkey | ||
78 | .Fa "X509_REQ *req" | ||
79 | .Fc | ||
80 | .Ft int | ||
81 | .Fo X509_REQ_set_pubkey | ||
82 | .Fa "X509_REQ *x" | ||
83 | .Fa "EVP_PKEY *pkey" | ||
84 | .Fc | ||
85 | .Sh DESCRIPTION | ||
86 | .Fn X509_get_pubkey | ||
87 | attempts to decode the public key for certificate | ||
88 | .Fa x . | ||
89 | If successful it returns the public key as an | ||
90 | .Vt EVP_PKEY | ||
91 | pointer with its reference count incremented: this means the returned | ||
92 | key must be freed up after use. | ||
93 | .Pp | ||
94 | .Fn X509_get_X509_PUBKEY | ||
95 | returns an internal pointer to the | ||
96 | .Vt X509_PUBKEY | ||
97 | structure which encodes the certificate of | ||
98 | .Fa x . | ||
99 | The returned value must not be freed up after use. | ||
100 | .Fn X509_get_X509_PUBKEY | ||
101 | is implemented as a macro. | ||
102 | .Pp | ||
103 | .Fn X509_set_pubkey | ||
104 | attempts to set the public key for certificate | ||
105 | .Fa x | ||
106 | to | ||
107 | .Fa pkey . | ||
108 | The key | ||
109 | .Fa pkey | ||
110 | should be freed up after use. | ||
111 | .Pp | ||
112 | .Fn X509_REQ_get_pubkey | ||
113 | and | ||
114 | .Fn X509_REQ_set_pubkey | ||
115 | are similar but operate on certificate request | ||
116 | .Fa req . | ||
117 | .Pp | ||
118 | The first time a public key is decoded, the | ||
119 | .Vt EVP_PKEY | ||
120 | structure is cached in the certificate or certificate request itself. | ||
121 | Subsequent calls return the cached structure with its reference count | ||
122 | incremented to improve performance. | ||
123 | .Sh RETURN VALUES | ||
124 | .Fn X509_get_pubkey , | ||
125 | .Fn X509_get_X509_PUBKEY , | ||
126 | and | ||
127 | .Fn X509_REQ_get_pubkey | ||
128 | return a public key or | ||
129 | .Dv NULL | ||
130 | if an error occurred. | ||
131 | .Pp | ||
132 | .Fn X509_set_pubkey | ||
133 | and | ||
134 | .Fn X509_REQ_set_pubkey | ||
135 | return 1 for success or 0 for failure. | ||
136 | .Sh SEE ALSO | ||
137 | .Xr d2i_X509 3 , | ||
138 | .Xr ERR_get_error 3 , | ||
139 | .Xr X509_CRL_get0_by_serial 3 , | ||
140 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
141 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
142 | .Xr X509_NAME_get_index_by_NID 3 , | ||
143 | .Xr X509_NAME_print_ex 3 , | ||
144 | .Xr X509_new 3 , | ||
145 | .Xr X509_sign 3 , | ||
146 | .Xr X509_verify_cert 3 , | ||
147 | .Xr X509V3_get_d2i 3 | ||
diff --git a/src/lib/libcrypto/man/X509_get_serialNumber.3 b/src/lib/libcrypto/man/X509_get_serialNumber.3 new file mode 100644 index 0000000000..9f2b14ec10 --- /dev/null +++ b/src/lib/libcrypto/man/X509_get_serialNumber.3 | |||
@@ -0,0 +1,112 @@ | |||
1 | .\" $OpenBSD: X509_get_serialNumber.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2016 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509_GET_SERIALNUMBER 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509_get_serialNumber , | ||
56 | .Nm X509_set_serialNumber | ||
57 | .Nd get or set certificate serial number | ||
58 | .Sh SYNOPSIS | ||
59 | .In openssl/x509.h | ||
60 | .Ft ASN1_INTEGER * | ||
61 | .Fo X509_get_serialNumber | ||
62 | .Fa "X509 *x" | ||
63 | .Fc | ||
64 | .Ft int | ||
65 | .Fo X509_set_serialNumber | ||
66 | .Fa "X509 *x" | ||
67 | .Fa "ASN1_INTEGER *serial" | ||
68 | .Fc | ||
69 | .Sh DESCRIPTION | ||
70 | .Fn X509_get_serialNumber | ||
71 | returns the serial number of certificate | ||
72 | .Fa x | ||
73 | as an | ||
74 | .Vt ASN1_INTEGER | ||
75 | structure which can be examined or initialised. | ||
76 | The value returned is an internal pointer which must not be freed | ||
77 | up after the call. | ||
78 | .Pp | ||
79 | .Fn X509_set_serialNumber | ||
80 | sets the serial number of certificate | ||
81 | .Fa x | ||
82 | to | ||
83 | .Fa serial . | ||
84 | A copy of the serial number is used internally so | ||
85 | .Fa serial | ||
86 | should be freed up after use. | ||
87 | .Sh RETURN VALUES | ||
88 | .Fn X509_get_serialNumber | ||
89 | returns an | ||
90 | .Vt ASN1_INTEGER | ||
91 | structure. | ||
92 | .Pp | ||
93 | .Fn X509_set_serialNumber | ||
94 | returns 1 for success and 0 for failure. | ||
95 | .Sh SEE ALSO | ||
96 | .Xr d2i_X509 3 , | ||
97 | .Xr ERR_get_error 3 , | ||
98 | .Xr X509_CRL_get0_by_serial 3 , | ||
99 | .Xr X509_get_pubkey 3 , | ||
100 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
101 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
102 | .Xr X509_NAME_get_index_by_NID 3 , | ||
103 | .Xr X509_NAME_print_ex 3 , | ||
104 | .Xr X509_new 3 , | ||
105 | .Xr X509_sign 3 , | ||
106 | .Xr X509_verify_cert 3 , | ||
107 | .Xr X509V3_get_d2i 3 | ||
108 | .Sh HISTORY | ||
109 | .Fn X509_get_serialNumber | ||
110 | and | ||
111 | .Fn X509_set_serialNumber | ||
112 | are available in all versions of OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/X509_get_subject_name.3 b/src/lib/libcrypto/man/X509_get_subject_name.3 new file mode 100644 index 0000000000..1b5814286f --- /dev/null +++ b/src/lib/libcrypto/man/X509_get_subject_name.3 | |||
@@ -0,0 +1,169 @@ | |||
1 | .\" $OpenBSD: X509_get_subject_name.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL 0ad69cd6 Jun 14 23:02:16 2016 +0200 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509_GET_SUBJECT_NAME 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509_get_subject_name , | ||
56 | .Nm X509_set_subject_name , | ||
57 | .Nm X509_get_issuer_name , | ||
58 | .Nm X509_set_issuer_name , | ||
59 | .Nm X509_REQ_get_subject_name , | ||
60 | .Nm X509_REQ_set_subject_name , | ||
61 | .Nm X509_CRL_get_issuer , | ||
62 | .Nm X509_CRL_set_issuer_name | ||
63 | .Nd get and set issuer or subject names | ||
64 | .Sh SYNOPSIS | ||
65 | .In openssl/x509.h | ||
66 | .Ft X509_NAME * | ||
67 | .Fo X509_get_subject_name | ||
68 | .Fa "X509 *x" | ||
69 | .Fc | ||
70 | .Ft int | ||
71 | .Fo X509_set_subject_name | ||
72 | .Fa "X509 *x" | ||
73 | .Fa "X509_NAME *name" | ||
74 | .Fc | ||
75 | .Ft X509_NAME * | ||
76 | .Fo X509_get_issuer_name | ||
77 | .Fa "X509 *x" | ||
78 | .Fc | ||
79 | .Ft int | ||
80 | .Fo X509_set_issuer_name | ||
81 | .Fa "X509 *x" | ||
82 | .Fa "X509_NAME *name" | ||
83 | .Fc | ||
84 | .Ft X509_NAME * | ||
85 | .Fo X509_REQ_get_subject_name | ||
86 | .Fa "const X509_REQ *req" | ||
87 | .Fc | ||
88 | .Ft int | ||
89 | .Fo X509_REQ_set_subject_name | ||
90 | .Fa "X509_REQ *req" | ||
91 | .Fa "X509_NAME *name" | ||
92 | .Fc | ||
93 | .Ft X509_NAME * | ||
94 | .Fo X509_CRL_get_issuer | ||
95 | .Fa "const X509_CRL *crl" | ||
96 | .Fc | ||
97 | .Ft int | ||
98 | .Fo X509_CRL_set_issuer_name | ||
99 | .Fa "X509_CRL *x" | ||
100 | .Fa "X509_NAME *name" | ||
101 | .Fc | ||
102 | .Sh DESCRIPTION | ||
103 | .Fn X509_get_subject_name | ||
104 | returns the subject name of certificate | ||
105 | .Fa x . | ||
106 | The returned value is an internal pointer which must not be freed. | ||
107 | .Pp | ||
108 | .Fn X509_set_subject_name | ||
109 | sets the issuer name of certificate | ||
110 | .Fa x | ||
111 | to | ||
112 | .Fa name . | ||
113 | The | ||
114 | .Fa name | ||
115 | parameter is copied internally and should be freed up when it is no | ||
116 | longer needed. | ||
117 | .Pp | ||
118 | .Fn X509_get_issuer_name | ||
119 | and | ||
120 | .Fn X509_set_issuer_name | ||
121 | are identical to | ||
122 | .Fn X509_get_subject_name | ||
123 | and | ||
124 | .Fn X509_set_subject_name | ||
125 | except that they get and set the issuer name of | ||
126 | .Fa x . | ||
127 | .Pp | ||
128 | Similarly | ||
129 | .Fn X509_REQ_get_subject_name , | ||
130 | .Fn X509_REQ_set_subject_name , | ||
131 | .Fn X509_CRL_get_issuer , | ||
132 | and | ||
133 | .Fn X509_CRL_set_issuer_name | ||
134 | get or set the subject or issuer names of certificate requests | ||
135 | of CRLs, respectively. | ||
136 | .Pp | ||
137 | .Fn X509_REQ_get_subject_name | ||
138 | and | ||
139 | .Fn X509_CRL_get_issuer | ||
140 | are implemented as macros. | ||
141 | .Sh RETURN VALUES | ||
142 | .Fn X509_get_subject_name , | ||
143 | .Fn X509_get_issuer_name , | ||
144 | .Fn X509_REQ_get_subject_name , | ||
145 | and | ||
146 | .Fn X509_CRL_get_issuer | ||
147 | return a pointer to an | ||
148 | .Vt X509_NAME | ||
149 | object. | ||
150 | .Pp | ||
151 | .Fn X509_set_subject_name , | ||
152 | .Fn X509_set_issuer_name , | ||
153 | .Fn X509_REQ_set_subject_name , | ||
154 | and | ||
155 | .Fn X509_CRL_set_issuer_name | ||
156 | return 1 for success or 0 for failure. | ||
157 | .Sh SEE ALSO | ||
158 | .Xr d2i_X509 3 , | ||
159 | .Xr ERR_get_error 3 , | ||
160 | .Xr X509_CRL_get0_by_serial 3 , | ||
161 | .Xr X509_get_pubkey 3 , | ||
162 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
163 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
164 | .Xr X509_NAME_get_index_by_NID 3 , | ||
165 | .Xr X509_NAME_print_ex 3 , | ||
166 | .Xr X509_new 3 , | ||
167 | .Xr X509_sign 3 , | ||
168 | .Xr X509_verify_cert 3 , | ||
169 | .Xr X509V3_get_d2i 3 | ||
diff --git a/src/lib/libcrypto/man/X509_get_version.3 b/src/lib/libcrypto/man/X509_get_version.3 new file mode 100644 index 0000000000..6e35f3df31 --- /dev/null +++ b/src/lib/libcrypto/man/X509_get_version.3 | |||
@@ -0,0 +1,149 @@ | |||
1 | .\" $OpenBSD: X509_get_version.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509_GET_VERSION 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509_get_version , | ||
56 | .Nm X509_set_version , | ||
57 | .Nm X509_REQ_get_version , | ||
58 | .Nm X509_REQ_set_version , | ||
59 | .Nm X509_CRL_get_version , | ||
60 | .Nm X509_CRL_set_version | ||
61 | .Nd get or set certificate, certificate request, or CRL version | ||
62 | .Sh SYNOPSIS | ||
63 | .In openssl/x509.h | ||
64 | .Ft long | ||
65 | .Fo X509_get_version | ||
66 | .Fa "const X509 *x" | ||
67 | .Fc | ||
68 | .Ft int | ||
69 | .Fo X509_set_version | ||
70 | .Fa "X509 *x" | ||
71 | .Fa "long version" | ||
72 | .Fc | ||
73 | .Ft long | ||
74 | .Fo X509_REQ_get_version | ||
75 | .Fa "const X509_REQ *req" | ||
76 | .Fc | ||
77 | .Ft int | ||
78 | .Fo X509_REQ_set_version | ||
79 | .Fa "X509_REQ *x" | ||
80 | .Fa "long version" | ||
81 | .Fc | ||
82 | .Ft long | ||
83 | .Fo X509_CRL_get_version | ||
84 | .Fa "const X509_CRL *crl" | ||
85 | .Fc | ||
86 | .Ft int | ||
87 | .Fo X509_CRL_set_version | ||
88 | .Fa "X509_CRL *x" | ||
89 | .Fa "long version" | ||
90 | .Fc | ||
91 | .Sh DESCRIPTION | ||
92 | .Fn X509_get_version | ||
93 | returns the numerical value of the version field of certificate | ||
94 | .Fa x . | ||
95 | Note: this is defined by standards (X.509 et al.) to be one less | ||
96 | than the certificate version. | ||
97 | So a version 3 certificate will return 2 and a version 1 certificate | ||
98 | will return 0. | ||
99 | .Pp | ||
100 | .Fn X509_set_version | ||
101 | sets the numerical value of the version field of certificate | ||
102 | .Fa x | ||
103 | to | ||
104 | .Fa version . | ||
105 | .Pp | ||
106 | Similarly | ||
107 | .Fn X509_REQ_get_version , | ||
108 | .Fn X509_REQ_set_version , | ||
109 | .Fn X509_CRL_get_version , | ||
110 | and | ||
111 | .Fn X509_CRL_set_version | ||
112 | get and set the version number of certificate requests and CRLs. | ||
113 | .Pp | ||
114 | The version field of certificates, certificate requests, and CRLs | ||
115 | has a DEFAULT value of v1(0) meaning the field should be omitted | ||
116 | for version 1. | ||
117 | This is handled transparently by these functions. | ||
118 | .Pp | ||
119 | .Fn X509_get_version , | ||
120 | .Fn X509_REQ_get_version | ||
121 | and | ||
122 | .Fn X509_CRL_get_version | ||
123 | are implemented as macros. | ||
124 | .Sh RETURN VALUES | ||
125 | .Fn X509_get_version , | ||
126 | .Fn X509_REQ_get_version , | ||
127 | and | ||
128 | .Fn X509_CRL_get_version | ||
129 | return the numerical value of the version field. | ||
130 | .Pp | ||
131 | .Fn X509_set_version , | ||
132 | .Fn X509_REQ_set_version , | ||
133 | and | ||
134 | .Fn X509_CRL_set_version | ||
135 | return 1 for success or 0 for failure. | ||
136 | .Sh SEE ALSO | ||
137 | .Xr d2i_X509 3 , | ||
138 | .Xr ERR_get_error 3 , | ||
139 | .Xr X509_CRL_get0_by_serial 3 , | ||
140 | .Xr X509_get_pubkey 3 , | ||
141 | .Xr X509_get_subject_name 3 , | ||
142 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
143 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
144 | .Xr X509_NAME_get_index_by_NID 3 , | ||
145 | .Xr X509_NAME_print_ex 3 , | ||
146 | .Xr X509_new 3 , | ||
147 | .Xr X509_sign 3 , | ||
148 | .Xr X509_verify_cert 3 , | ||
149 | .Xr X509V3_get_d2i 3 | ||
diff --git a/src/lib/libcrypto/man/X509_sign.3 b/src/lib/libcrypto/man/X509_sign.3 new file mode 100644 index 0000000000..2680f0b095 --- /dev/null +++ b/src/lib/libcrypto/man/X509_sign.3 | |||
@@ -0,0 +1,202 @@ | |||
1 | .\" $OpenBSD: X509_sign.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509_SIGN 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509_sign , | ||
56 | .Nm X509_sign_ctx , | ||
57 | .Nm X509_verify , | ||
58 | .Nm X509_REQ_sign , | ||
59 | .Nm X509_REQ_sign_ctx , | ||
60 | .Nm X509_REQ_verify , | ||
61 | .Nm X509_CRL_sign , | ||
62 | .Nm X509_CRL_sign_ctx , | ||
63 | .Nm X509_CRL_verify | ||
64 | .Nd sign or verify certificate, certificate request, or CRL signature | ||
65 | .Sh SYNOPSIS | ||
66 | .In openssl/x509.h | ||
67 | .Ft int | ||
68 | .Fo X509_sign | ||
69 | .Fa "X509 *x" | ||
70 | .Fa "EVP_PKEY *pkey" | ||
71 | .Fa "const EVP_MD *md" | ||
72 | .Fc | ||
73 | .Ft int | ||
74 | .Fo X509_sign_ctx | ||
75 | .Fa "X509 *x" | ||
76 | .Fa "EVP_MD_CTX *ctx" | ||
77 | .Fc | ||
78 | .Ft int | ||
79 | .Fo X509_verify | ||
80 | .Fa "X509 *a" | ||
81 | .Fa "EVP_PKEY *r" | ||
82 | .Fc | ||
83 | .Ft int | ||
84 | .Fo X509_REQ_sign | ||
85 | .Fa "X509_REQ *x" | ||
86 | .Fa "EVP_PKEY *pkey" | ||
87 | .Fa "const EVP_MD *md" | ||
88 | .Fc | ||
89 | .Ft int | ||
90 | .Fo X509_REQ_sign_ctx | ||
91 | .Fa "X509_REQ *x" | ||
92 | .Fa "EVP_MD_CTX *ctx" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo X509_REQ_verify | ||
96 | .Fa "X509_REQ *a" | ||
97 | .Fa "EVP_PKEY *r" | ||
98 | .Fc | ||
99 | .Ft int | ||
100 | .Fo X509_CRL_sign | ||
101 | .Fa "X509_CRL *x" | ||
102 | .Fa "EVP_PKEY *pkey" | ||
103 | .Fa "const EVP_MD *md" | ||
104 | .Fc | ||
105 | .Ft int | ||
106 | .Fo X509_CRL_sign_ctx | ||
107 | .Fa "X509_CRL *x" | ||
108 | .Fa "EVP_MD_CTX *ctx" | ||
109 | .Fc | ||
110 | .Ft int | ||
111 | .Fo X509_CRL_verify | ||
112 | .Fa "X509_CRL *a" | ||
113 | .Fa "EVP_PKEY *r" | ||
114 | .Fc | ||
115 | .Sh DESCRIPTION | ||
116 | .Fn X509_sign | ||
117 | signs the certificate | ||
118 | .Fa x | ||
119 | using the private key | ||
120 | .Fa pkey | ||
121 | and the message digest | ||
122 | .Fa md | ||
123 | and sets the signature in | ||
124 | .Fa x . | ||
125 | .Fn X509_sign_ctx | ||
126 | also signs the certificate | ||
127 | .Fa x | ||
128 | but uses the parameters contained in digest context | ||
129 | .Fa ctx . | ||
130 | .Pp | ||
131 | .Fn X509_verify | ||
132 | verifies the signature of certificate | ||
133 | .Fa x | ||
134 | using the public key | ||
135 | .Fa pkey . | ||
136 | Only the signature is checked: no other checks (such as certificate | ||
137 | chain validity) are performed. | ||
138 | .Pp | ||
139 | .Fn X509_REQ_sign , | ||
140 | .Fn X509_REQ_sign_ctx , | ||
141 | .Fn X509_REQ_verify , | ||
142 | .Fn X509_CRL_sign , | ||
143 | .Fn X509_CRL_sign_ctx , | ||
144 | and | ||
145 | .Fn X509_CRL_verify | ||
146 | sign and verify certificate requests and CRLs, respectively. | ||
147 | .Pp | ||
148 | .Fn X509_sign_ctx | ||
149 | is used where the default parameters for the corresponding public key | ||
150 | and digest are not suitable. | ||
151 | It can be used to sign keys using RSA-PSS for example. | ||
152 | .Pp | ||
153 | For efficiency reasons and to work around ASN.1 encoding issues, the | ||
154 | encoding of the signed portion of a certificate, certificate request, | ||
155 | and CRL is cached internally. | ||
156 | If the signed portion of the structure is modified, the encoding is not | ||
157 | always updated, meaning a stale version is sometimes used. | ||
158 | This is not normally a problem because modifying the signed portion will | ||
159 | invalidate the signature and signing will always update the encoding. | ||
160 | .Sh RETURN VALUES | ||
161 | .Fn X509_sign , | ||
162 | .Fn X509_sign_ctx , | ||
163 | .Fn X509_REQ_sign , | ||
164 | .Fn X509_REQ_sign_ctx , | ||
165 | .Fn X509_CRL_sign , | ||
166 | and | ||
167 | .Fn X509_CRL_sign_ctx | ||
168 | return the size of the signature in bytes for success or 0 for failure. | ||
169 | .Pp | ||
170 | .Fn X509_verify , | ||
171 | .Fn X509_REQ_verify , | ||
172 | and | ||
173 | .Fn X509_CRL_verify | ||
174 | return 1 if the signature is valid or 0 if the signature check fails. | ||
175 | If the signature could not be checked at all because it was invalid or | ||
176 | some other error occurred, then -1 is returned. | ||
177 | .Sh SEE ALSO | ||
178 | .Xr d2i_X509 3 , | ||
179 | .Xr ERR_get_error 3 , | ||
180 | .Xr X509_CRL_get0_by_serial 3 , | ||
181 | .Xr X509_get_pubkey 3 , | ||
182 | .Xr X509_get_subject_name 3 , | ||
183 | .Xr X509_get_version 3 , | ||
184 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
185 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
186 | .Xr X509_NAME_get_index_by_NID 3 , | ||
187 | .Xr X509_NAME_print_ex 3 , | ||
188 | .Xr X509_new 3 , | ||
189 | .Xr X509_verify_cert 3 , | ||
190 | .Xr X509V3_get_d2i 3 | ||
191 | .Sh HISTORY | ||
192 | .Fn X509_sign , | ||
193 | .Fn X509_REQ_sign , | ||
194 | and | ||
195 | .Fn X509_CRL_sign | ||
196 | are available in all versions of OpenSSL. | ||
197 | .Pp | ||
198 | .Fn X509_sign_ctx , | ||
199 | .Fn X509_REQ_sign_ctx , | ||
200 | and | ||
201 | .Fn X509_CRL_sign_ctx | ||
202 | were first added to OpenSSL 1.0.1. | ||
diff --git a/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 new file mode 100644 index 0000000000..32d828f230 --- /dev/null +++ b/src/lib/libcrypto/man/X509v3_get_ext_by_NID.3 | |||
@@ -0,0 +1,387 @@ | |||
1 | .\" $OpenBSD: X509v3_get_ext_by_NID.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $ | ||
2 | .\" OpenSSL c952780c Jun 21 07:03:34 2016 -0400 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2015 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: December 5 2016 $ | ||
52 | .Dt X509V3_GET_EXT_BY_NID 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm X509v3_get_ext_count , | ||
56 | .Nm X509v3_get_ext , | ||
57 | .Nm X509v3_get_ext_by_NID , | ||
58 | .Nm X509v3_get_ext_by_OBJ , | ||
59 | .Nm X509v3_get_ext_by_critical , | ||
60 | .Nm X509v3_delete_ext , | ||
61 | .Nm X509v3_add_ext , | ||
62 | .Nm X509_get_ext_count , | ||
63 | .Nm X509_get_ext , | ||
64 | .Nm X509_get_ext_by_NID , | ||
65 | .Nm X509_get_ext_by_OBJ , | ||
66 | .Nm X509_get_ext_by_critical , | ||
67 | .Nm X509_delete_ext , | ||
68 | .Nm X509_add_ext , | ||
69 | .Nm X509_CRL_get_ext_count , | ||
70 | .Nm X509_CRL_get_ext , | ||
71 | .Nm X509_CRL_get_ext_by_NID , | ||
72 | .Nm X509_CRL_get_ext_by_OBJ , | ||
73 | .Nm X509_CRL_get_ext_by_critical , | ||
74 | .Nm X509_CRL_delete_ext , | ||
75 | .Nm X509_CRL_add_ext , | ||
76 | .Nm X509_REVOKED_get_ext_count , | ||
77 | .Nm X509_REVOKED_get_ext , | ||
78 | .Nm X509_REVOKED_get_ext_by_NID , | ||
79 | .Nm X509_REVOKED_get_ext_by_OBJ , | ||
80 | .Nm X509_REVOKED_get_ext_by_critical , | ||
81 | .Nm X509_REVOKED_delete_ext , | ||
82 | .Nm X509_REVOKED_add_ext | ||
83 | .Nd extension stack utility functions | ||
84 | .Sh SYNOPSIS | ||
85 | .In openssl/x509.h | ||
86 | .Ft int | ||
87 | .Fo X509v3_get_ext_count | ||
88 | .Fa "const STACK_OF(X509_EXTENSION) *x" | ||
89 | .Fc | ||
90 | .Ft X509_EXTENSION * | ||
91 | .Fo X509v3_get_ext | ||
92 | .Fa "const STACK_OF(X509_EXTENSION) *x" | ||
93 | .Fa "int loc" | ||
94 | .Fc | ||
95 | .Ft int | ||
96 | .Fo X509v3_get_ext_by_NID | ||
97 | .Fa "const STACK_OF(X509_EXTENSION) *x" | ||
98 | .Fa "int nid" | ||
99 | .Fa "int lastpos" | ||
100 | .Fc | ||
101 | .Ft int | ||
102 | .Fo X509v3_get_ext_by_OBJ | ||
103 | .Fa "const STACK_OF(X509_EXTENSION) *x" | ||
104 | .Fa "ASN1_OBJECT *obj" | ||
105 | .Fa "int lastpos" | ||
106 | .Fc | ||
107 | .Ft int | ||
108 | .Fo X509v3_get_ext_by_critical | ||
109 | .Fa "const STACK_OF(X509_EXTENSION) *x" | ||
110 | .Fa "int crit" | ||
111 | .Fa "int lastpos" | ||
112 | .Fc | ||
113 | .Ft X509_EXTENSION * | ||
114 | .Fo X509v3_delete_ext | ||
115 | .Fa "STACK_OF(X509_EXTENSION) *x" | ||
116 | .Fa "int loc" | ||
117 | .Fc | ||
118 | .Ft STACK_OF(X509_EXTENSION) * | ||
119 | .Fo X509v3_add_ext | ||
120 | .Fa "STACK_OF(X509_EXTENSION) **x" | ||
121 | .Fa "X509_EXTENSION *ex" | ||
122 | .Fa "int loc" | ||
123 | .Fc | ||
124 | .Ft int | ||
125 | .Fo X509_get_ext_count | ||
126 | .Fa "X509 *x" | ||
127 | .Fc | ||
128 | .Ft X509_EXTENSION * | ||
129 | .Fo X509_get_ext | ||
130 | .Fa "X509 *x" | ||
131 | .Fa "int loc" | ||
132 | .Fc | ||
133 | .Ft int | ||
134 | .Fo X509_get_ext_by_NID | ||
135 | .Fa "X509 *x" | ||
136 | .Fa "int nid" | ||
137 | .Fa "int lastpos" | ||
138 | .Fc | ||
139 | .Ft int | ||
140 | .Fo X509_get_ext_by_OBJ | ||
141 | .Fa "X509 *x" | ||
142 | .Fa "ASN1_OBJECT *obj" | ||
143 | .Fa "int lastpos" | ||
144 | .Fc | ||
145 | .Ft int | ||
146 | .Fo X509_get_ext_by_critical | ||
147 | .Fa "X509 *x" | ||
148 | .Fa "int crit" | ||
149 | .Fa "int lastpos" | ||
150 | .Fc | ||
151 | .Ft X509_EXTENSION * | ||
152 | .Fo X509_delete_ext | ||
153 | .Fa "X509 *x" | ||
154 | .Fa "int loc" | ||
155 | .Fc | ||
156 | .Ft int | ||
157 | .Fo X509_add_ext | ||
158 | .Fa "X509 *x" | ||
159 | .Fa "X509_EXTENSION *ex" | ||
160 | .Fa "int loc" | ||
161 | .Fc | ||
162 | .Ft int | ||
163 | .Fo X509_CRL_get_ext_count | ||
164 | .Fa "X509_CRL *x" | ||
165 | .Fc | ||
166 | .Ft X509_EXTENSION * | ||
167 | .Fo X509_CRL_get_ext | ||
168 | .Fa "X509_CRL *x" | ||
169 | .Fa "int loc" | ||
170 | .Fc | ||
171 | .Ft int | ||
172 | .Fo X509_CRL_get_ext_by_NID | ||
173 | .Fa "X509_CRL *x" | ||
174 | .Fa "int nid" | ||
175 | .Fa "int lastpos" | ||
176 | .Fc | ||
177 | .Ft int | ||
178 | .Fo X509_CRL_get_ext_by_OBJ | ||
179 | .Fa "X509_CRL *x" | ||
180 | .Fa "ASN1_OBJECT *obj" | ||
181 | .Fa "int lastpos" | ||
182 | .Fc | ||
183 | .Ft int | ||
184 | .Fo X509_CRL_get_ext_by_critical | ||
185 | .Fa "X509_CRL *x" | ||
186 | .Fa "int crit" | ||
187 | .Fa "int lastpos" | ||
188 | .Fc | ||
189 | .Ft X509_EXTENSION * | ||
190 | .Fo X509_CRL_delete_ext | ||
191 | .Fa "X509_CRL *x" | ||
192 | .Fa "int loc" | ||
193 | .Fc | ||
194 | .Ft int | ||
195 | .Fo X509_CRL_add_ext | ||
196 | .Fa "X509_CRL *x" | ||
197 | .Fa "X509_EXTENSION *ex" | ||
198 | .Fa "int loc" | ||
199 | .Fc | ||
200 | .Ft int | ||
201 | .Fo X509_REVOKED_get_ext_count | ||
202 | .Fa "X509_REVOKED *x" | ||
203 | .Fc | ||
204 | .Ft X509_EXTENSION * | ||
205 | .Fo X509_REVOKED_get_ext | ||
206 | .Fa "X509_REVOKED *x" | ||
207 | .Fa "int loc" | ||
208 | .Fc | ||
209 | .Ft int | ||
210 | .Fo X509_REVOKED_get_ext_by_NID | ||
211 | .Fa "X509_REVOKED *x" | ||
212 | .Fa "int nid" | ||
213 | .Fa "int lastpos" | ||
214 | .Fc | ||
215 | .Ft int | ||
216 | .Fo X509_REVOKED_get_ext_by_OBJ | ||
217 | .Fa "X509_REVOKED *x" | ||
218 | .Fa "ASN1_OBJECT *obj" | ||
219 | .Fa "int lastpos" | ||
220 | .Fc | ||
221 | .Ft int | ||
222 | .Fo X509_REVOKED_get_ext_by_critical | ||
223 | .Fa "X509_REVOKED *x" | ||
224 | .Fa "int crit" | ||
225 | .Fa "int lastpos" | ||
226 | .Fc | ||
227 | .Ft X509_EXTENSION * | ||
228 | .Fo X509_REVOKED_delete_ext | ||
229 | .Fa "X509_REVOKED *x" | ||
230 | .Fa "int loc" | ||
231 | .Fc | ||
232 | .Ft int | ||
233 | .Fo X509_REVOKED_add_ext | ||
234 | .Fa "X509_REVOKED *x" | ||
235 | .Fa "X509_EXTENSION *ex" | ||
236 | .Fa "int loc" | ||
237 | .Fc | ||
238 | .Sh DESCRIPTION | ||
239 | .Fn X509v3_get_ext_count | ||
240 | retrieves the number of extensions in | ||
241 | .Fa x . | ||
242 | .Pp | ||
243 | .Fn X509v3_get_ext | ||
244 | retrieves extension | ||
245 | .Fa loc | ||
246 | from | ||
247 | .Fa x . | ||
248 | The index | ||
249 | .Fa loc | ||
250 | can take any value from 0 to | ||
251 | .Fn X509_get_ext_count x No - 1 . | ||
252 | The returned extension is an internal pointer which must not be | ||
253 | freed up by the application. | ||
254 | .Pp | ||
255 | .Fn X509v3_get_ext_by_NID | ||
256 | and | ||
257 | .Fn X509v3_get_ext_by_OBJ | ||
258 | look for an extension with | ||
259 | .Fa nid | ||
260 | or | ||
261 | .Fa obj | ||
262 | from extension stack | ||
263 | .Fa x . | ||
264 | The search starts from the extension after | ||
265 | .Fa lastpos | ||
266 | or from the beginning if | ||
267 | .Fa lastpos | ||
268 | is -1. | ||
269 | If the extension is found, its index is returned; otherwise, -1 is | ||
270 | returned. | ||
271 | .Pp | ||
272 | .Fn X509v3_get_ext_by_critical | ||
273 | is similar to | ||
274 | .Fn X509v3_get_ext_by_NID | ||
275 | except that it looks for an extension of criticality | ||
276 | .Fa crit . | ||
277 | A zero value for | ||
278 | .Fa crit | ||
279 | looks for a non-critical extension; a non-zero value looks for a | ||
280 | critical extension. | ||
281 | .Pp | ||
282 | .Fn X509v3_delete_ext | ||
283 | deletes the extension with index | ||
284 | .Fa loc | ||
285 | from | ||
286 | .Fa x . | ||
287 | The deleted extension is returned and must be freed by the caller. | ||
288 | If | ||
289 | .Fa loc | ||
290 | is in invalid index value, | ||
291 | .Dv NULL | ||
292 | is returned. | ||
293 | .Pp | ||
294 | .Xr X509v3_add_ext 3 | ||
295 | adds the extension | ||
296 | .Fa ex | ||
297 | to the stack | ||
298 | .Pf * Fa x | ||
299 | at position | ||
300 | .Fa loc . | ||
301 | If | ||
302 | .Fa loc | ||
303 | is -1, the new extension is added to the end. | ||
304 | If | ||
305 | .Pf * Fa x | ||
306 | is | ||
307 | .Dv NULL , | ||
308 | a new stack will be allocated. | ||
309 | The passed extension | ||
310 | .Fa ex | ||
311 | is duplicated internally so it must be freed after use. | ||
312 | .Pp | ||
313 | .Fn X509_get_ext_count , | ||
314 | .Fn X509_get_ext , | ||
315 | .Fn X509_get_ext_by_NID , | ||
316 | .Fn X509_get_ext_by_OBJ , | ||
317 | .Fn X509_get_ext_by_critical , | ||
318 | .Fn X509_delete_ext , | ||
319 | and | ||
320 | .Fn X509_add_ext | ||
321 | operate on the extensions of certificate | ||
322 | .Fa x . | ||
323 | They are otherwise identical to the X509v3 functions. | ||
324 | .Pp | ||
325 | .Fn X509_CRL_get_ext_count , | ||
326 | .Fn X509_CRL_get_ext , | ||
327 | .Fn X509_CRL_get_ext_by_NID , | ||
328 | .Fn X509_CRL_get_ext_by_OBJ , | ||
329 | .Fn X509_CRL_get_ext_by_critical , | ||
330 | .Fn X509_CRL_delete_ext , | ||
331 | and | ||
332 | .Fn X509_CRL_add_ext | ||
333 | operate on the extensions of the CRL | ||
334 | .Fa x . | ||
335 | They are otherwise identical to the X509v3 functions. | ||
336 | .Pp | ||
337 | .Fn X509_REVOKED_get_ext_count , | ||
338 | .Fn X509_REVOKED_get_ext , | ||
339 | .Fn X509_REVOKED_get_ext_by_NID , | ||
340 | .Fn X509_REVOKED_get_ext_by_OBJ , | ||
341 | .Fn X509_REVOKED_get_ext_by_critical , | ||
342 | .Fn X509_REVOKED_delete_ext , | ||
343 | and | ||
344 | .Fn X509_REVOKED_add_ext | ||
345 | operate on the extensions of the CRL entry | ||
346 | .Fa x . | ||
347 | They are otherwise identical to the X509v3 functions. | ||
348 | .Pp | ||
349 | These functions are used to examine stacks of extensions directly. | ||
350 | Many applications will want to parse or encode and add an extension: | ||
351 | they should use the extension encode and decode functions instead | ||
352 | such as | ||
353 | .Xr X509_get_ext_d2i 3 . | ||
354 | .Pp | ||
355 | Extension indices start from zero, so a zero index return value is | ||
356 | not an error. | ||
357 | These search functions start from the extension | ||
358 | .Em after | ||
359 | the | ||
360 | .Fa lastpos | ||
361 | parameter, so it should initially be set to -1. | ||
362 | If it is set to 0, the initial extension will not be checked. | ||
363 | .Sh RETURN VALUES | ||
364 | .Fn X509v3_get_ext_count | ||
365 | returns the extension count. | ||
366 | .Pp | ||
367 | .Fn X509v3_get_ext | ||
368 | and | ||
369 | .Fn X509v3_delete_ext | ||
370 | return an | ||
371 | .Vt X509_EXTENSION | ||
372 | pointer or | ||
373 | .Dv NULL | ||
374 | if an error occurs. | ||
375 | .Pp | ||
376 | .Fn X509v3_get_ext_by_NID , | ||
377 | .Fn X509v3_get_ext_by_OBJ , | ||
378 | and | ||
379 | .Fn X509v3_get_ext_by_critical | ||
380 | return the an extension index or -1 if an error occurs. | ||
381 | .Pp | ||
382 | .Xr X509v3_add_ext 3 | ||
383 | returns a stack of extensions or | ||
384 | .Dv NULL | ||
385 | on error. | ||
386 | .Sh SEE ALSO | ||
387 | .Xr X509V3_get_d2i 3 | ||