1SSL_CTX_GET0_PARAM(3ossl) OpenSSL SSL_CTX_GET0_PARAM(3ossl)
2
3
4
6 SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param,
7 SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust
8 - get and set verification parameters
9
11 #include <openssl/ssl.h>
12
13 X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
14 X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
15 int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
16 int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
17
18 int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
19 int SSL_set_purpose(SSL *ssl, int purpose);
20
21 int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
22 int SSL_set_trust(SSL *ssl, int trust);
23
25 SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer
26 to the verification parameters for ctx or ssl respectively. The
27 returned pointer must not be freed by the calling application.
28
29 SSL_CTX_set1_param() and SSL_set1_param() set the verification
30 parameters to vpm for ctx or ssl.
31
32 The functions SSL_CTX_set_purpose() and SSL_set_purpose() are
33 shorthands which set the purpose parameter on the verification
34 parameters object. These functions are equivalent to calling
35 X509_VERIFY_PARAM_set_purpose() directly.
36
37 The functions SSL_CTX_set_trust() and SSL_set_trust() are similarly
38 shorthands which set the trust parameter on the verification parameters
39 object. These functions are equivalent to calling
40 X509_VERIFY_PARAM_set_trust() directly.
41
43 Typically parameters are retrieved from an SSL_CTX or SSL structure
44 using SSL_CTX_get0_param() or SSL_get0_param() and an application
45 modifies them to suit its needs: for example to add a hostname check.
46
48 SSL_CTX_get0_param() and SSL_get0_param() return a pointer to an
49 X509_VERIFY_PARAM structure.
50
51 SSL_CTX_set1_param(), SSL_set1_param(), SSL_CTX_set_purpose(),
52 SSL_set_purpose(), SSL_CTX_set_trust() and SSL_set_trust() return 1 for
53 success and 0 for failure.
54
56 Check hostname matches "www.foo.com" in peer certificate:
57
58 X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);
59 X509_VERIFY_PARAM_set1_host(vpm, "www.foo.com", 0);
60
62 ssl(7), X509_VERIFY_PARAM_set_flags(3)
63
65 These functions were added in OpenSSL 1.0.2.
66
68 Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
69
70 Licensed under the Apache License 2.0 (the "License"). You may not use
71 this file except in compliance with the License. You can obtain a copy
72 in the file LICENSE in the source distribution or at
73 <https://www.openssl.org/source/license.html>.
74
75
76
773.0.9 2023-07-27 SSL_CTX_GET0_PARAM(3ossl)