]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/man3/X509v3_get_ext_by_NID.3
OpenSSL: Merge OpenSSL 1.1.1o
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / man3 / X509v3_get_ext_by_NID.3
1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "X509V3_GET_EXT_BY_NID 3"
136 .TH X509V3_GET_EXT_BY_NID 3 "2022-05-03" "1.1.1o" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 X509v3_get_ext_count, X509v3_get_ext, X509v3_get_ext_by_NID, X509v3_get_ext_by_OBJ, X509v3_get_ext_by_critical, X509v3_delete_ext, X509v3_add_ext, X509_get_ext_count, X509_get_ext, X509_get_ext_by_NID, X509_get_ext_by_OBJ, X509_get_ext_by_critical, X509_delete_ext, X509_add_ext, X509_CRL_get_ext_count, X509_CRL_get_ext, X509_CRL_get_ext_by_NID, X509_CRL_get_ext_by_OBJ, X509_CRL_get_ext_by_critical, X509_CRL_delete_ext, X509_CRL_add_ext, X509_REVOKED_get_ext_count, X509_REVOKED_get_ext, X509_REVOKED_get_ext_by_NID, X509_REVOKED_get_ext_by_OBJ, X509_REVOKED_get_ext_by_critical, X509_REVOKED_delete_ext, X509_REVOKED_add_ext \- extension stack utility functions
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/x509.h>
147 \&
148 \& int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);
149 \& X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);
150 \&
151 \& int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,
152 \&                           int nid, int lastpos);
153 \& int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,
154 \&                           const ASN1_OBJECT *obj, int lastpos);
155 \& int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,
156 \&                                int crit, int lastpos);
157 \& X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);
158 \& STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,
159 \&                                          X509_EXTENSION *ex, int loc);
160 \&
161 \& int X509_get_ext_count(const X509 *x);
162 \& X509_EXTENSION *X509_get_ext(const X509 *x, int loc);
163 \& int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);
164 \& int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos);
165 \& int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos);
166 \& X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
167 \& int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
168 \&
169 \& int X509_CRL_get_ext_count(const X509_CRL *x);
170 \& X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);
171 \& int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);
172 \& int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, int lastpos);
173 \& int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos);
174 \& X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
175 \& int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
176 \&
177 \& int X509_REVOKED_get_ext_count(const X509_REVOKED *x);
178 \& X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);
179 \& int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos);
180 \& int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
181 \&                                 int lastpos);
182 \& int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos);
183 \& X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
184 \& int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
185 .Ve
186 .SH "DESCRIPTION"
187 .IX Header "DESCRIPTION"
188 \&\fBX509v3_get_ext_count()\fR retrieves the number of extensions in \fBx\fR.
189 .PP
190 \&\fBX509v3_get_ext()\fR retrieves extension \fBloc\fR from \fBx\fR. The index \fBloc\fR
191 can take any value from \fB0\fR to X509_get_ext_count(x) \- 1. The returned
192 extension is an internal pointer which \fBmust not\fR be freed up by the
193 application.
194 .PP
195 \&\fBX509v3_get_ext_by_NID()\fR and \fBX509v3_get_ext_by_OBJ()\fR look for an extension
196 with \fBnid\fR or \fBobj\fR from extension stack \fBx\fR. The search starts from the
197 extension after \fBlastpos\fR or from the beginning if <lastpos> is \fB\-1\fR. If
198 the extension is found its index is returned otherwise \fB\-1\fR is returned.
199 .PP
200 \&\fBX509v3_get_ext_by_critical()\fR is similar to \fBX509v3_get_ext_by_NID()\fR except it
201 looks for an extension of criticality \fBcrit\fR. A zero value for \fBcrit\fR
202 looks for a non-critical extension a nonzero value looks for a critical
203 extension.
204 .PP
205 \&\fBX509v3_delete_ext()\fR deletes the extension with index \fBloc\fR from \fBx\fR. The
206 deleted extension is returned and must be freed by the caller. If \fBloc\fR
207 is in invalid index value \fB\s-1NULL\s0\fR is returned.
208 .PP
209 \&\fBX509v3_add_ext()\fR adds extension \fBex\fR to stack \fB*x\fR at position \fBloc\fR. If
210 \&\fBloc\fR is \fB\-1\fR the new extension is added to the end. If \fB*x\fR is \fB\s-1NULL\s0\fR
211 a new stack will be allocated. The passed extension \fBex\fR is duplicated
212 internally so it must be freed after use.
213 .PP
214 \&\fBX509_get_ext_count()\fR, \fBX509_get_ext()\fR, \fBX509_get_ext_by_NID()\fR,
215 \&\fBX509_get_ext_by_OBJ()\fR, \fBX509_get_ext_by_critical()\fR, \fBX509_delete_ext()\fR
216 and \fBX509_add_ext()\fR operate on the extensions of certificate \fBx\fR they are
217 otherwise identical to the X509v3 functions.
218 .PP
219 \&\fBX509_CRL_get_ext_count()\fR, \fBX509_CRL_get_ext()\fR, \fBX509_CRL_get_ext_by_NID()\fR,
220 \&\fBX509_CRL_get_ext_by_OBJ()\fR, \fBX509_CRL_get_ext_by_critical()\fR,
221 \&\fBX509_CRL_delete_ext()\fR and \fBX509_CRL_add_ext()\fR operate on the extensions of
222 \&\s-1CRL\s0 \fBx\fR they are otherwise identical to the X509v3 functions.
223 .PP
224 \&\fBX509_REVOKED_get_ext_count()\fR, \fBX509_REVOKED_get_ext()\fR,
225 \&\fBX509_REVOKED_get_ext_by_NID()\fR, \fBX509_REVOKED_get_ext_by_OBJ()\fR,
226 \&\fBX509_REVOKED_get_ext_by_critical()\fR, \fBX509_REVOKED_delete_ext()\fR and
227 \&\fBX509_REVOKED_add_ext()\fR operate on the extensions of \s-1CRL\s0 entry \fBx\fR
228 they are otherwise identical to the X509v3 functions.
229 .SH "NOTES"
230 .IX Header "NOTES"
231 These functions are used to examine stacks of extensions directly. Many
232 applications will want to parse or encode and add an extension: they should
233 use the extension encode and decode functions instead such as
234 \&\fBX509_add1_ext_i2d()\fR and \fBX509_get_ext_d2i()\fR.
235 .PP
236 Extension indices start from zero, so a zero index return value is \fBnot\fR an
237 error. These search functions start from the extension \fBafter\fR the \fBlastpos\fR
238 parameter so it should initially be set to \fB\-1\fR, if it is set to zero the
239 initial extension will not be checked.
240 .SH "RETURN VALUES"
241 .IX Header "RETURN VALUES"
242 \&\fBX509v3_get_ext_count()\fR returns the extension count.
243 .PP
244 \&\fBX509v3_get_ext()\fR, \fBX509v3_delete_ext()\fR and \fBX509_delete_ext()\fR return an
245 \&\fBX509_EXTENSION\fR pointer or \fB\s-1NULL\s0\fR if an error occurs.
246 .PP
247 \&\fBX509v3_get_ext_by_NID()\fR \fBX509v3_get_ext_by_OBJ()\fR and
248 \&\fBX509v3_get_ext_by_critical()\fR return the an extension index or \fB\-1\fR if an
249 error occurs.
250 .PP
251 \&\fBX509v3_add_ext()\fR returns a stack of extensions or \fB\s-1NULL\s0\fR on error.
252 .PP
253 \&\fBX509_add_ext()\fR returns 1 on success and 0 on error.
254 .SH "SEE ALSO"
255 .IX Header "SEE ALSO"
256 \&\fBX509V3_get_d2i\fR\|(3)
257 .SH "COPYRIGHT"
258 .IX Header "COPYRIGHT"
259 Copyright 2015\-2020 The OpenSSL Project Authors. All Rights Reserved.
260 .PP
261 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
262 this file except in compliance with the License.  You can obtain a copy
263 in the file \s-1LICENSE\s0 in the source distribution or at
264 <https://www.openssl.org/source/license.html>.