1X509_STORE_CTX_new(3)               OpenSSL              X509_STORE_CTX_new(3)
2
3
4

NAME

6       X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free,
7       X509_STORE_CTX_init, X509_STORE_CTX_trusted_stack,
8       X509_STORE_CTX_set_cert, X509_STORE_CTX_set_chain,
9       X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param,
10       X509_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX
11       initialisation
12

SYNOPSIS

14        #include <openssl/x509_vfy.h>
15
16        X509_STORE_CTX *X509_STORE_CTX_new(void);
17        void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
18        void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
19
20        int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
21                                X509 *x509, STACK_OF(X509) *chain);
22
23        void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
24
25        void   X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x);
26        void   X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk);
27        void   X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);
28
29        X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
30        void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
31        int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
32

DESCRIPTION

34       These functions initialise an X509_STORE_CTX structure for subsequent
35       use by X509_verify_cert().
36
37       X509_STORE_CTX_new() returns a newly initialised X509_STORE_CTX
38       structure.
39
40       X509_STORE_CTX_cleanup() internally cleans up an X509_STORE_CTX
41       structure.  The context can then be reused with an new call to
42       X509_STORE_CTX_init().
43
44       X509_STORE_CTX_free() completely frees up ctx. After this call ctx is
45       no longer valid.
46
47       X509_STORE_CTX_init() sets up ctx for a subsequent verification
48       operation.  It must be called before each call to X509_verify_cert(),
49       i.e. a ctx is only good for one call to X509_verify_cert(); if you want
50       to verify a second certificate with the same ctx then you must call
51       X509_STORE_CTX_cleanup() and then X509_STORE_CTX_init() again before
52       the second call to X509_verify_cert(). The trusted certificate store is
53       set to store, the end entity certificate to be verified is set to x509
54       and a set of additional certificates (which will be untrusted but may
55       be used to build the chain) in chain. Any or all of the store, x509 and
56       chain parameters can be NULL.
57
58       X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of
59       ctx to sk. This is an alternative way of specifying trusted
60       certificates instead of using an X509_STORE.
61
62       X509_STORE_CTX_set_cert() sets the certificate to be vertified in ctx
63       to x.
64
65       X509_STORE_CTX_set_chain() sets the additional certificate chain used
66       by ctx to sk.
67
68       X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate
69       verification to sk. These CRLs will only be used if CRL verification is
70       enabled in the associated X509_VERIFY_PARAM structure. This might be
71       used where additional "useful" CRLs are supplied as part of a protocol,
72       for example in a PKCS#7 structure.
73
74       X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an intenal
75       pointer to the verification parameters associated with ctx.
76
77       X509_STORE_CTX_set0_param() sets the intenal verification parameter
78       pointer to param. After this call param should not be used.
79
80       X509_STORE_CTX_set_default() looks up and sets the default verification
81       method to name. This uses the function X509_VERIFY_PARAM_lookup() to
82       find an appropriate set of parameters from name.
83

NOTES

85       The certificates and CRLs in a store are used internally and should not
86       be freed up until after the associated X509_STORE_CTX is freed. Legacy
87       applications might implicitly use an X509_STORE_CTX like this:
88
89         X509_STORE_CTX ctx;
90         X509_STORE_CTX_init(&ctx, store, cert, chain);
91
92       this is not recommended in new applications they should instead do:
93
94         X509_STORE_CTX *ctx;
95         ctx = X509_STORE_CTX_new();
96         if (ctx == NULL)
97               /* Bad error */
98         X509_STORE_CTX_init(ctx, store, cert, chain);
99

BUGS

101       The certificates and CRLs in a context are used internally and should
102       not be freed up until after the associated X509_STORE_CTX is freed.
103       Copies should be made or reference counts increased instead.
104

RETURN VALUES

106       X509_STORE_CTX_new() returns an newly allocates context or NULL is an
107       error occurred.
108
109       X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.
110
111       X509_STORE_CTX_get0_param() returns a pointer to an X509_VERIFY_PARAM
112       structure or NULL if an error occurred.
113
114       X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(),
115       X509_STORE_CTX_trusted_stack(), X509_STORE_CTX_set_cert(),
116       X509_STORE_CTX_set_chain(), X509_STORE_CTX_set0_crls() and
117       X509_STORE_CTX_set0_param() do not return values.
118
119       X509_STORE_CTX_set_default() returns 1 for success or 0 if an error
120       occurred.
121

SEE ALSO

123       X509_verify_cert(3) X509_VERIFY_PARAM_set_flags(3)
124

HISTORY

126       X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0
127
128
129
1301.0.2o                            2020-08-01             X509_STORE_CTX_new(3)
Impressum