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