$NetBSD: SSL_CTX_add1_chain_cert.3,v 1.1.1.2 2023/04/18 14:19:14 christos Exp $ Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) 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
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). 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 "SSL_CTX_add1_chain_cert 3" SSL_CTX_add1_chain_cert 3 "2019-03-12" "1.1.1i" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes way too many mistakes in technical documents..nh
"NAME"
SSL_CTX_set0_chain, SSL_CTX_set1_chain, SSL_CTX_add0_chain_cert,
SSL_CTX_add1_chain_cert, SSL_CTX_get0_chain_certs, SSL_CTX_clear_chain_certs,
SSL_set0_chain, SSL_set1_chain, SSL_add0_chain_cert, SSL_add1_chain_cert,
SSL_get0_chain_certs, SSL_clear_chain_certs, SSL_CTX_build_cert_chain,
SSL_build_cert_chain, SSL_CTX_select_current_cert,
SSL_select_current_cert, SSL_CTX_set_current_cert, SSL_set_current_cert - extra
chain certificate processing
"LIBRARY"
libcrypto, -lcrypto
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1
#include <
openssl/
ssl.h>
\&
int SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);
int SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);
int SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509);
int SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509);
int SSL_CTX_get0_chain_certs(SSL_CTX *ctx, STACK_OF(X509) **sk);
int SSL_CTX_clear_chain_certs(SSL_CTX *ctx);
\&
int SSL_set0_chain(SSL *ssl, STACK_OF(X509) *sk);
int SSL_set1_chain(SSL *ssl, STACK_OF(X509) *sk);
int SSL_add0_chain_cert(SSL *ssl, X509 *x509);
int SSL_add1_chain_cert(SSL *ssl, X509 *x509);
int SSL_get0_chain_certs(SSL *ssl, STACK_OF(X509) **sk);
int SSL_clear_chain_certs(SSL *ssl);
\&
int SSL_CTX_build_cert_chain(SSL_CTX *ctx, flags);
int SSL_build_cert_chain(SSL *ssl, flags);
\&
int SSL_CTX_select_current_cert(SSL_CTX *ctx, X509 *x509);
int SSL_select_current_cert(SSL *ssl, X509 *x509);
int SSL_CTX_set_current_cert(SSL_CTX *ctx, long op);
int SSL_set_current_cert(SSL *ssl, long op);
.Ve
"DESCRIPTION"
Header "DESCRIPTION" \fBSSL_CTX_set0_chain() and
SSL_CTX_set1_chain() set the certificate chain
associated with the current certificate of
ctx to
sk.
\fBSSL_CTX_add0_chain_cert() and SSL_CTX_add1_chain_cert() append the single
certificate x509 to the chain associated with the current certificate of
\fBctx.
\fBSSL_CTX_get0_chain_certs() retrieves the chain associated with the current
certificate of ctx.
\fBSSL_CTX_clear_chain_certs() clears any existing chain associated with the
current certificate of ctx. (This is implemented by calling
\fBSSL_CTX_set0_chain() with sk set to \s-1NULL\s0).
\fBSSL_CTX_build_cert_chain() builds the certificate chain for ctx normally
this uses the chain store or the verify store if the chain store is not set.
If the function is successful the built chain will replace any existing chain.
The flags parameter can be set to \s-1SSL_BUILD_CHAIN_FLAG_UNTRUSTED\s0 to use
existing chain certificates as untrusted CAs, \s-1SSL_BUILD_CHAIN_FLAG_NO_ROOT\s0
to omit the root \s-1CA\s0 from the built chain, \s-1SSL_BUILD_CHAIN_FLAG_CHECK\s0 to
use all existing chain certificates only to build the chain (effectively
sanity checking and rearranging them if necessary), the flag
\fB\s-1SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR\s0 ignores any errors during verification:
if flag \s-1SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR\s0 is also set verification errors
are cleared from the error queue.
Each of these functions operates on the current end entity
(i.e. server or client) certificate. This is the last certificate loaded or
selected on the corresponding ctx structure.
\fBSSL_CTX_select_current_cert() selects x509 as the current end entity
certificate, but only if x509 has already been loaded into ctx using a
function such as SSL_CTX_use_certificate().
\fBSSL_set0_chain(), SSL_set1_chain(), SSL_add0_chain_cert(),
\fBSSL_add1_chain_cert(), SSL_get0_chain_certs(), SSL_clear_chain_certs(),
\fBSSL_build_cert_chain(), SSL_select_current_cert() and SSL_set_current_cert()
are similar except they apply to \s-1SSL\s0 structure ssl.
\fBSSL_CTX_set_current_cert() changes the current certificate to a value based
on the op argument. Currently op can be \s-1SSL_CERT_SET_FIRST\s0 to use
the first valid certificate or \s-1SSL_CERT_SET_NEXT\s0 to set the next valid
certificate after the current certificate. These two operations can be
used to iterate over all certificates in an \s-1SSL_CTX\s0 structure.
\fBSSL_set_current_cert() also supports the option \s-1SSL_CERT_SET_SERVER\s0.
If ssl is a server and has sent a certificate to a connected client
this option sets that certificate to the current certificate and returns 1.
If the negotiated cipher suite is anonymous (and thus no certificate will
be sent) 2 is returned and the current certificate is unchanged. If ssl
is not a server or a certificate has not been sent 0 is returned and
the current certificate is unchanged.
All these functions are implemented as macros. Those containing a 1
increment the reference count of the supplied certificate or chain so it must
be freed at some point after the operation. Those containing a 0 do
not increment reference counts and the supplied certificate or chain
\fB\s-1MUST NOT\s0 be freed after the operation.
"NOTES"
Header "NOTES" The chains associate with an \s-1SSL_CTX\s0 structure are copied to any \s-1SSL\s0
structures when
SSL_new() is called. \s-1SSL\s0 structures will not be affected
by any chains subsequently changed in the parent \s-1SSL_CTX.\s0
One chain can be set for each key type supported by a server. So, for example,
an \s-1RSA\s0 and a \s-1DSA\s0 certificate can (and often will) have different chains.
The functions SSL_CTX_build_cert_chain() and SSL_build_cert_chain() can
be used to check application configuration and to ensure any necessary
subordinate CAs are sent in the correct order. Misconfigured applications
sending incorrect certificate chains often cause problems with peers.
For example an application can add any set of certificates using
\fBSSL_CTX_use_certificate_chain_file() then call SSL_CTX_build_cert_chain()
with the option \s-1SSL_BUILD_CHAIN_FLAG_CHECK\s0 to check and reorder them.
Applications can issue non fatal warnings when checking chains by setting
the flag \s-1SSL_BUILD_CHAIN_FLAG_IGNORE_ERRORS\s0 and checking the return
value.
Calling SSL_CTX_build_cert_chain() or SSL_build_cert_chain() is more
efficient than the automatic chain building as it is only performed once.
Automatic chain building is performed on each new session.
If any certificates are added using these functions no certificates added
using SSL_CTX_add_extra_chain_cert() will be used.
"RETURN VALUES"
Header "RETURN VALUES" \fBSSL_set_current_cert() with
\s-1SSL_CERT_SET_SERVER\s0 return 1 for success, 2 if
no server certificate is used because the cipher suites is anonymous and 0
for failure.
\fBSSL_CTX_build_cert_chain() and SSL_build_cert_chain() return 1 for success
and 0 for failure. If the flag \s-1SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR\s0 and
a verification error occurs then 2 is returned.
All other functions return 1 for success and 0 for failure.
"SEE ALSO"
Header "SEE ALSO" \fBSSL_CTX_add_extra_chain_cert\|(3)
"HISTORY"
Header "HISTORY" These functions were added in OpenSSL 1.0.2.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the OpenSSL license (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>.