1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | CT_POLICY_EVAL_CTX_new_ex,
|
---|
6 | CT_POLICY_EVAL_CTX_new, CT_POLICY_EVAL_CTX_free,
|
---|
7 | CT_POLICY_EVAL_CTX_get0_cert, CT_POLICY_EVAL_CTX_set1_cert,
|
---|
8 | CT_POLICY_EVAL_CTX_get0_issuer, CT_POLICY_EVAL_CTX_set1_issuer,
|
---|
9 | CT_POLICY_EVAL_CTX_get0_log_store, CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE,
|
---|
10 | CT_POLICY_EVAL_CTX_get_time, CT_POLICY_EVAL_CTX_set_time -
|
---|
11 | Encapsulates the data required to evaluate whether SCTs meet a Certificate Transparency policy
|
---|
12 |
|
---|
13 | =head1 SYNOPSIS
|
---|
14 |
|
---|
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 |
|
---|
31 | =head1 DESCRIPTION
|
---|
32 |
|
---|
33 | A B<CT_POLICY_EVAL_CTX> is used by functions that evaluate whether Signed
|
---|
34 | Certificate Timestamps (SCTs) fulfil a Certificate Transparency (CT) policy.
|
---|
35 | This policy may be, for example, that at least one valid SCT is available. To
|
---|
36 | determine this, an SCT's timestamp and signature must be verified.
|
---|
37 | This requires:
|
---|
38 |
|
---|
39 | =over 2
|
---|
40 |
|
---|
41 | =item *
|
---|
42 |
|
---|
43 | the public key of the log that issued the SCT
|
---|
44 |
|
---|
45 | =item *
|
---|
46 |
|
---|
47 | the certificate that the SCT was issued for
|
---|
48 |
|
---|
49 | =item *
|
---|
50 |
|
---|
51 | the issuer certificate (if the SCT was issued for a pre-certificate)
|
---|
52 |
|
---|
53 | =item *
|
---|
54 |
|
---|
55 | the current time
|
---|
56 |
|
---|
57 | =back
|
---|
58 |
|
---|
59 | The above requirements are met using the setters described below.
|
---|
60 |
|
---|
61 | CT_POLICY_EVAL_CTX_new_ex() creates an empty policy evaluation context
|
---|
62 | and associates it with the given library context I<libctx> and property query
|
---|
63 | string I<propq>.
|
---|
64 |
|
---|
65 | CT_POLICY_EVAL_CTX_new() does the same thing as
|
---|
66 | CT_POLICY_EVAL_CTX_new_ex() except that it uses the default library
|
---|
67 | context and property query string.
|
---|
68 |
|
---|
69 | The CT_POLICY_EVAL_CTX should then be populated using:
|
---|
70 |
|
---|
71 | =over 2
|
---|
72 |
|
---|
73 | =item *
|
---|
74 |
|
---|
75 | CT_POLICY_EVAL_CTX_set1_cert() to provide the certificate the SCTs were issued for
|
---|
76 |
|
---|
77 | Increments the reference count of the certificate.
|
---|
78 |
|
---|
79 | =item *
|
---|
80 |
|
---|
81 | CT_POLICY_EVAL_CTX_set1_issuer() to provide the issuer certificate
|
---|
82 |
|
---|
83 | Increments the reference count of the certificate.
|
---|
84 |
|
---|
85 | =item *
|
---|
86 |
|
---|
87 | CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE() to provide a list of logs that are trusted as sources of SCTs
|
---|
88 |
|
---|
89 | Holds a pointer to the CTLOG_STORE, so the CTLOG_STORE must outlive the
|
---|
90 | CT_POLICY_EVAL_CTX.
|
---|
91 |
|
---|
92 | =item *
|
---|
93 |
|
---|
94 | CT_POLICY_EVAL_CTX_set_time() to set the time SCTs should be compared with to determine if they are valid
|
---|
95 |
|
---|
96 | The SCT timestamp will be compared to this time to check whether the SCT was
|
---|
97 | issued in the future. RFC6962 states that "TLS clients MUST reject SCTs whose
|
---|
98 | timestamp is in the future". By default, this will be set to 5 minutes in the
|
---|
99 | future (e.g. (time() + 300) * 1000), to allow for clock drift.
|
---|
100 |
|
---|
101 | The time should be in milliseconds since the Unix Epoch.
|
---|
102 |
|
---|
103 | =back
|
---|
104 |
|
---|
105 | Each setter has a matching getter for accessing the current value.
|
---|
106 |
|
---|
107 | When no longer required, the B<CT_POLICY_EVAL_CTX> should be passed to
|
---|
108 | CT_POLICY_EVAL_CTX_free() to delete it. If the argument to
|
---|
109 | CT_POLICY_EVAL_CTX_free() is NULL, nothing is done.
|
---|
110 |
|
---|
111 | =head1 NOTES
|
---|
112 |
|
---|
113 | The issuer certificate only needs to be provided if at least one of the SCTs
|
---|
114 | was issued for a pre-certificate. This will be the case for SCTs embedded in a
|
---|
115 | certificate (i.e. those in an X.509 extension), but may not be the case for SCTs
|
---|
116 | found in the TLS SCT extension or OCSP response.
|
---|
117 |
|
---|
118 | =head1 RETURN VALUES
|
---|
119 |
|
---|
120 | CT_POLICY_EVAL_CTX_new_ex() and CT_POLICY_EVAL_CTX_new() will return
|
---|
121 | NULL if malloc fails.
|
---|
122 |
|
---|
123 | =head1 SEE ALSO
|
---|
124 |
|
---|
125 | L<ct(7)>
|
---|
126 |
|
---|
127 | =head1 HISTORY
|
---|
128 |
|
---|
129 | CT_POLICY_EVAL_CTX_new_ex was added in OpenSSL 3.0. All other
|
---|
130 | functions were added in OpenSSL 1.1.0.
|
---|
131 |
|
---|
132 | =head1 COPYRIGHT
|
---|
133 |
|
---|
134 | Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
|
---|
135 |
|
---|
136 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
137 | this file except in compliance with the License. You can obtain a copy
|
---|
138 | in the file LICENSE in the source distribution or at
|
---|
139 | L<https://www.openssl.org/source/license.html>.
|
---|
140 |
|
---|
141 | =cut
|
---|