1X509_GET_EXTENSION_FLAGS(3)         OpenSSL        X509_GET_EXTENSION_FLAGS(3)
2
3
4

NAME

6       X509_get0_subject_key_id, X509_get0_authority_key_id, X509_get_pathlen,
7       X509_get_extension_flags, X509_get_key_usage,
8       X509_get_extended_key_usage, X509_set_proxy_flag,
9       X509_set_proxy_pathlen, X509_get_proxy_pathlen - retrieve certificate
10       extension data
11

SYNOPSIS

13        #include <openssl/x509v3.h>
14
15        long X509_get_pathlen(X509 *x);
16        uint32_t X509_get_extension_flags(X509 *x);
17        uint32_t X509_get_key_usage(X509 *x);
18        uint32_t X509_get_extended_key_usage(X509 *x);
19        const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x);
20        const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x);
21        void X509_set_proxy_flag(X509 *x);
22        void X509_set_proxy_pathlen(int l);
23        long X509_get_proxy_pathlen(X509 *x);
24

DESCRIPTION

26       These functions retrieve information related to commonly used
27       certificate extensions.
28
29       X509_get_pathlen() retrieves the path length extension from a
30       certificate.  This extension is used to limit the length of a cert
31       chain that may be issued from that CA.
32
33       X509_get_extension_flags() retrieves general information about a
34       certificate, it will return one or more of the following flags ored
35       together.
36
37       EXFLAG_V1
38           The certificate is an obsolete version 1 certificate.
39
40       EXFLAG_BCONS
41           The certificate contains a basic constraints extension.
42
43       EXFLAG_CA
44           The certificate contains basic constraints and asserts the CA flag.
45
46       EXFLAG_PROXY
47           The certificate is a valid proxy certificate.
48
49       EXFLAG_SI
50           The certificate is self issued (that is subject and issuer names
51           match).
52
53       EXFLAG_SS
54           The subject and issuer names match and extension values imply it is
55           self signed.
56
57       EXFLAG_FRESHEST
58           The freshest CRL extension is present in the certificate.
59
60       EXFLAG_CRITICAL
61           The certificate contains an unhandled critical extension.
62
63       EXFLAG_INVALID
64           Some certificate extension values are invalid or inconsistent. The
65           certificate should be rejected.
66
67       EXFLAG_KUSAGE
68           The certificate contains a key usage extension. The value can be
69           retrieved using X509_get_key_usage().
70
71       EXFLAG_XKUSAGE
72           The certificate contains an extended key usage extension. The value
73           can be retrieved using X509_get_extended_key_usage().
74
75       X509_get_key_usage() returns the value of the key usage extension.  If
76       key usage is present will return zero or more of the flags:
77       KU_DIGITAL_SIGNATURE, KU_NON_REPUDIATION, KU_KEY_ENCIPHERMENT,
78       KU_DATA_ENCIPHERMENT, KU_KEY_AGREEMENT, KU_KEY_CERT_SIGN, KU_CRL_SIGN,
79       KU_ENCIPHER_ONLY or KU_DECIPHER_ONLY corresponding to individual key
80       usage bits. If key usage is absent then UINT32_MAX is returned.
81
82       X509_get_extended_key_usage() returns the value of the extended key
83       usage extension. If extended key usage is present it will return zero
84       or more of the flags: XKU_SSL_SERVER, XKU_SSL_CLIENT, XKU_SMIME,
85       XKU_CODE_SIGN XKU_OCSP_SIGN, XKU_TIMESTAMP, XKU_DVCS or XKU_ANYEKU.
86       These correspond to the OIDs id-kp-serverAuth, id-kp-clientAuth, id-kp-
87       emailProtection, id-kp-codeSigning, id-kp-OCSPSigning, id-kp-
88       timeStamping, id-kp-dvcs and anyExtendedKeyUsage respectively.
89       Additionally XKU_SGC is set if either Netscape or Microsoft SGC OIDs
90       are present.
91
92       X509_get0_subject_key_id() returns an internal pointer to the subject
93       key identifier of x as an ASN1_OCTET_STRING or NULL if the extension is
94       not present or cannot be parsed.
95
96       X509_get0_authority_key_id() returns an internal pointer to the
97       authority key identifier of x as an ASN1_OCTET_STRING or NULL if the
98       extension is not present or cannot be parsed.
99
100       X509_set_proxy_flag() marks the certificate with the EXFLAG_PROXY flag.
101       This is for the users who need to mark non-RFC3820 proxy certificates
102       as such, as OpenSSL only detects RFC3820 compliant ones.
103
104       X509_set_proxy_pathlen() sets the proxy certificate path length for the
105       given certificate x.  This is for the users who need to mark
106       non-RFC3820 proxy certificates as such, as OpenSSL only detects RFC3820
107       compliant ones.
108
109       X509_get_proxy_pathlen() returns the proxy certificate path length for
110       the given certificate x if it is a proxy certificate.
111

NOTES

113       The value of the flags correspond to extension values which are cached
114       in the X509 structure. If the flags returned do not provide sufficient
115       information an application should examine extension values directly for
116       example using X509_get_ext_d2i().
117
118       If the key usage or extended key usage extension is absent then
119       typically usage is unrestricted. For this reason X509_get_key_usage()
120       and X509_get_extended_key_usage() return UINT32_MAX when the
121       corresponding extension is absent. Applications can additionally check
122       the return value of X509_get_extension_flags() and take appropriate
123       action is an extension is absent.
124
125       If X509_get0_subject_key_id() returns NULL then the extension may be
126       absent or malformed. Applications can determine the precise reason
127       using X509_get_ext_d2i().
128

RETURN VALUES

130       X509_get_pathlen() returns the path length value, or -1 if the
131       extension is not present.
132
133       X509_get_extension_flags(), X509_get_key_usage() and
134       X509_get_extended_key_usage() return sets of flags corresponding to the
135       certificate extension values.
136
137       X509_get0_subject_key_id() returns the subject key identifier as a
138       pointer to an ASN1_OCTET_STRING structure or NULL if the extension is
139       absent or an error occurred during parsing.
140
141       X509_get_proxy_pathlen() returns the path length value if the given
142       certificate is a proxy one and has a path length set, and -1 otherwise.
143

SEE ALSO

145       X509_check_purpose(3)
146

HISTORY

148       X509_get_pathlen(), X509_set_proxy_flag(), X509_set_proxy_pathlen() and
149       X509_get_proxy_pathlen() were added in OpenSSL 1.1.0.
150
152       Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
153
154       Licensed under the OpenSSL license (the "License").  You may not use
155       this file except in compliance with the License.  You can obtain a copy
156       in the file LICENSE in the source distribution or at
157       <https://www.openssl.org/source/license.html>.
158
159
160
1611.1.1                             2018-09-11       X509_GET_EXTENSION_FLAGS(3)
Impressum