1CT_POLICY_EVAL_CTX_NEW(3ossl) OpenSSL CT_POLICY_EVAL_CTX_NEW(3ossl)
2
3
4
6 CT_POLICY_EVAL_CTX_new_ex, CT_POLICY_EVAL_CTX_new,
7 CT_POLICY_EVAL_CTX_free, CT_POLICY_EVAL_CTX_get0_cert,
8 CT_POLICY_EVAL_CTX_set1_cert, CT_POLICY_EVAL_CTX_get0_issuer,
9 CT_POLICY_EVAL_CTX_set1_issuer, CT_POLICY_EVAL_CTX_get0_log_store,
10 CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE, CT_POLICY_EVAL_CTX_get_time,
11 CT_POLICY_EVAL_CTX_set_time - Encapsulates the data required to
12 evaluate whether SCTs meet a Certificate Transparency policy
13
15 #include <openssl/ct.h>
16
17 CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
18 const char *propq);
19 CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
20 void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
21 X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
22 int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
23 X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
24 int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
25 const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
26 void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
27 CTLOG_STORE *log_store);
28 uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
29 void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
30
32 A CT_POLICY_EVAL_CTX is used by functions that evaluate whether Signed
33 Certificate Timestamps (SCTs) fulfil a Certificate Transparency (CT)
34 policy. This policy may be, for example, that at least one valid SCT
35 is available. To determine this, an SCT's timestamp and signature must
36 be verified. This requires:
37
38 • the public key of the log that issued the SCT
39
40 • the certificate that the SCT was issued for
41
42 • the issuer certificate (if the SCT was issued for a pre-certificate)
43
44 • the current time
45
46 The above requirements are met using the setters described below.
47
48 CT_POLICY_EVAL_CTX_new_ex() creates an empty policy evaluation context
49 and associates it with the given library context libctx and property
50 query string propq.
51
52 CT_POLICY_EVAL_CTX_new() does the same thing as
53 CT_POLICY_EVAL_CTX_new_ex() except that it uses the default library
54 context and property query string.
55
56 The CT_POLICY_EVAL_CTX should then be populated using:
57
58 • CT_POLICY_EVAL_CTX_set1_cert() to provide the certificate the SCTs
59 were issued for
60
61 Increments the reference count of the certificate.
62
63 • CT_POLICY_EVAL_CTX_set1_issuer() to provide the issuer certificate
64
65 Increments the reference count of the certificate.
66
67 • CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE() to provide a list of logs
68 that are trusted as sources of SCTs
69
70 Holds a pointer to the CTLOG_STORE, so the CTLOG_STORE must outlive
71 the CT_POLICY_EVAL_CTX.
72
73 • CT_POLICY_EVAL_CTX_set_time() to set the time SCTs should be compared
74 with to determine if they are valid
75
76 The SCT timestamp will be compared to this time to check whether the
77 SCT was issued in the future. RFC6962 states that "TLS clients MUST
78 reject SCTs whose timestamp is in the future". By default, this will
79 be set to 5 minutes in the future (e.g. (time() + 300) * 1000), to
80 allow for clock drift.
81
82 The time should be in milliseconds since the Unix Epoch.
83
84 Each setter has a matching getter for accessing the current value.
85
86 When no longer required, the CT_POLICY_EVAL_CTX should be passed to
87 CT_POLICY_EVAL_CTX_free() to delete it.
88
90 The issuer certificate only needs to be provided if at least one of the
91 SCTs was issued for a pre-certificate. This will be the case for SCTs
92 embedded in a certificate (i.e. those in an X.509 extension), but may
93 not be the case for SCTs found in the TLS SCT extension or OCSP
94 response.
95
97 CT_POLICY_EVAL_CTX_new_ex() and CT_POLICY_EVAL_CTX_new() will return
98 NULL if malloc fails.
99
101 ct(7)
102
104 CT_POLICY_EVAL_CTX_new_ex was added in OpenSSL 3.0. All other functions
105 were added in OpenSSL 1.1.0.
106
108 Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
109
110 Licensed under the Apache License 2.0 (the "License"). You may not use
111 this file except in compliance with the License. You can obtain a copy
112 in the file LICENSE in the source distribution or at
113 <https://www.openssl.org/source/license.html>.
114
115
116
1173.0.5 2022-07-05 CT_POLICY_EVAL_CTX_NEW(3ossl)