xref: /freebsd/secure/lib/libcrypto/man/man3/X509_get_extension_flags.3 (revision 02e9120893770924227138ba49df1edb3896112a)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "X509_GET_EXTENSION_FLAGS 3ossl"
X509_GET_EXTENSION_FLAGS 3ossl "2023-09-19" "3.0.11" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
X509_get0_subject_key_id, X509_get0_authority_key_id, X509_get0_authority_issuer, X509_get0_authority_serial, X509_get_pathlen, X509_get_extension_flags, X509_get_key_usage, X509_get_extended_key_usage, X509_set_proxy_flag, X509_set_proxy_pathlen, X509_get_proxy_pathlen - retrieve certificate extension data
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/x509v3.h> \& long X509_get_pathlen(X509 *x); uint32_t X509_get_extension_flags(X509 *x); uint32_t X509_get_key_usage(X509 *x); uint32_t X509_get_extended_key_usage(X509 *x); const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); void X509_set_proxy_flag(X509 *x); void X509_set_proxy_pathlen(int l); long X509_get_proxy_pathlen(X509 *x); .Ve
"DESCRIPTION"
Header "DESCRIPTION" These functions retrieve information related to commonly used certificate extensions.

\fBX509_get_pathlen() retrieves the path length extension from a certificate. This extension is used to limit the length of a cert chain that may be issued from that \s-1CA.\s0

\fBX509_get_extension_flags() retrieves general information about a certificate, it will return one or more of the following flags ored together.

"\s-1EXFLAG_V1\s0" 4
Item "EXFLAG_V1" The certificate is an obsolete version 1 certificate.
"\s-1EXFLAG_BCONS\s0" 4
Item "EXFLAG_BCONS" The certificate contains a basic constraints extension.
"\s-1EXFLAG_CA\s0" 4
Item "EXFLAG_CA" The certificate contains basic constraints and asserts the \s-1CA\s0 flag.
"\s-1EXFLAG_PROXY\s0" 4
Item "EXFLAG_PROXY" The certificate is a valid proxy certificate.
"\s-1EXFLAG_SI\s0" 4
Item "EXFLAG_SI" The certificate is self issued (that is subject and issuer names match).
"\s-1EXFLAG_SS\s0" 4
Item "EXFLAG_SS" The subject and issuer names match and extension values imply it is self signed.
"\s-1EXFLAG_FRESHEST\s0" 4
Item "EXFLAG_FRESHEST" The freshest \s-1CRL\s0 extension is present in the certificate.
"\s-1EXFLAG_CRITICAL\s0" 4
Item "EXFLAG_CRITICAL" The certificate contains an unhandled critical extension.
"\s-1EXFLAG_INVALID\s0" 4
Item "EXFLAG_INVALID" Some certificate extension values are invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed \s-1ASN1\s0 object itself.
"\s-1EXFLAG_NO_FINGERPRINT\s0" 4
Item "EXFLAG_NO_FINGERPRINT" Failed to compute the internal \s-1SHA1\s0 hash value of the certificate or \s-1CRL.\s0 This may be due to malloc failure or because no \s-1SHA1\s0 implementation was found.
"\s-1EXFLAG_INVALID_POLICY\s0" 4
Item "EXFLAG_INVALID_POLICY" The NID_certificate_policies certificate extension is invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed \s-1ASN1\s0 object itself.
"\s-1EXFLAG_KUSAGE\s0" 4
Item "EXFLAG_KUSAGE" The certificate contains a key usage extension. The value can be retrieved using X509_get_key_usage().
"\s-1EXFLAG_XKUSAGE\s0" 4
Item "EXFLAG_XKUSAGE" The certificate contains an extended key usage extension. The value can be retrieved using X509_get_extended_key_usage().

\fBX509_get_key_usage() returns the value of the key usage extension. If key usage is present will return zero or more of the flags: \fB\s-1KU_DIGITAL_SIGNATURE\s0, \s-1KU_NON_REPUDIATION\s0, \s-1KU_KEY_ENCIPHERMENT\s0, \fB\s-1KU_DATA_ENCIPHERMENT\s0, \s-1KU_KEY_AGREEMENT\s0, \s-1KU_KEY_CERT_SIGN\s0, \fB\s-1KU_CRL_SIGN\s0, \s-1KU_ENCIPHER_ONLY\s0 or \s-1KU_DECIPHER_ONLY\s0 corresponding to individual key usage bits. If key usage is absent then \s-1UINT32_MAX\s0 is returned.

\fBX509_get_extended_key_usage() returns the value of the extended key usage extension. If extended key usage is present it will return zero or more of the flags: \s-1XKU_SSL_SERVER\s0, \s-1XKU_SSL_CLIENT\s0, \s-1XKU_SMIME\s0, \s-1XKU_CODE_SIGN\s0 \fB\s-1XKU_OCSP_SIGN\s0, \s-1XKU_TIMESTAMP\s0, \s-1XKU_DVCS\s0 or \s-1XKU_ANYEKU\s0. These correspond to the OIDs id-kp-serverAuth, id-kp-clientAuth, \fBid-kp-emailProtection, id-kp-codeSigning, id-kp-OCSPSigning, \fBid-kp-timeStamping, id-kp-dvcs and anyExtendedKeyUsage respectively. Additionally \s-1XKU_SGC\s0 is set if either Netscape or Microsoft \s-1SGC\s0 OIDs are present.

\fBX509_get0_subject_key_id() returns an internal pointer to the subject key identifier of x as an \s-1ASN1_OCTET_STRING\s0 or \s-1NULL\s0 if the extension is not present or cannot be parsed.

\fBX509_get0_authority_key_id() returns an internal pointer to the authority key identifier of x as an \s-1ASN1_OCTET_STRING\s0 or \s-1NULL\s0 if the extension is not present or cannot be parsed.

\fBX509_get0_authority_issuer() returns an internal pointer to the authority certificate issuer of x as a stack of \s-1GENERAL_NAME\s0 structures or \fB\s-1NULL\s0 if the extension is not present or cannot be parsed.

\fBX509_get0_authority_serial() returns an internal pointer to the authority certificate serial number of x as an \s-1ASN1_INTEGER\s0 or \s-1NULL\s0 if the extension is not present or cannot be parsed.

\fBX509_set_proxy_flag() marks the certificate with the \s-1EXFLAG_PROXY\s0 flag. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects \s-1RFC3820\s0 compliant ones.

\fBX509_set_proxy_pathlen() sets the proxy certificate path length for the given certificate x. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects \s-1RFC3820\s0 compliant ones.

\fBX509_get_proxy_pathlen() returns the proxy certificate path length for the given certificate x if it is a proxy certificate.

"NOTES"
Header "NOTES" The value of the flags correspond to extension values which are cached in the X509 structure. If the flags returned do not provide sufficient information an application should examine extension values directly for example using X509_get_ext_d2i().

If the key usage or extended key usage extension is absent then typically usage is unrestricted. For this reason X509_get_key_usage() and \fBX509_get_extended_key_usage() return \s-1UINT32_MAX\s0 when the corresponding extension is absent. Applications can additionally check the return value of \fBX509_get_extension_flags() and take appropriate action is an extension is absent.

If X509_get0_subject_key_id() returns \s-1NULL\s0 then the extension may be absent or malformed. Applications can determine the precise reason using \fBX509_get_ext_d2i().

"RETURN VALUES"
Header "RETURN VALUES" \fBX509_get_pathlen() returns the path length value, or -1 if the extension is not present.

\fBX509_get_extension_flags(), X509_get_key_usage() and \fBX509_get_extended_key_usage() return sets of flags corresponding to the certificate extension values.

\fBX509_get0_subject_key_id() returns the subject key identifier as a pointer to an \s-1ASN1_OCTET_STRING\s0 structure or \s-1NULL\s0 if the extension is absent or an error occurred during parsing.

\fBX509_get_proxy_pathlen() returns the path length value if the given certificate is a proxy one and has a path length set, and -1 otherwise.

"SEE ALSO"
Header "SEE ALSO" \fBX509_check_purpose\|(3)
"HISTORY"
Header "HISTORY" \fBX509_get_pathlen(), X509_set_proxy_flag(), X509_set_proxy_pathlen() and \fBX509_get_proxy_pathlen() were added in OpenSSL 1.1.0.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.