First draft of CT documentation
[openssl.git] / doc / crypto / CT_POLICY_EVAL_CTX.pod
1 =pod
2
3 =head1 NAME
4
5 CT_POLICY_EVAL_CTX -
6 Encapsulates the data required to evaluate whether SCTs meet a Certificate Transparency policy
7
8 =head1 SYNOPSIS
9
10  #include <openssl/ct.h>
11
12  CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
13  void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
14  X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
15  void CT_POLICY_EVAL_CTX_set0_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
16  X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
17  void CT_POLICY_EVAL_CTX_set0_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
18  const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
19  void CT_POLICY_EVAL_CTX_set0_log_store(CT_POLICY_EVAL_CTX *ctx, CTLOG_STORE *log_store);
20
21 =head1 DESCRIPTION
22
23 A B<CT_POLICY_EVAL_CTX> is used by functions that evaluate whether Signed
24 Certificate Timestamps (SCTs) fulfil a Certificate Transparency (CT) policy.
25 This policy may be, for example, that at least one valid SCT is available. To
26 determine this, an SCT's signature must be verified. This requires:
27
28 =over
29
30 =item * the public key of the log that issued the SCT
31
32 =item * the certificate that the SCT was issued for
33
34 =item * the issuer certificate (if the SCT was issued for a pre-certificate)
35
36 =back
37
38 The above requirements are met using the setters described below.
39
40 B<CT_POLICY_EVAL_CTX_new>() creates an empty policy evaluation context. This
41 should then be populated using:
42
43 =over
44
45 =item * B<CT_POLICY_EVAL_CTX_set0_cert>() to provide the certificate the SCTs were issued for
46
47 =item * B<CT_POLICY_EVAL_CTX_set0_issuer>() to provide the issuer certificate
48
49 =item * B<CT_POLICY_EVAL_CTX_set0_log_store>() to provide a list of logs that are trusted as sources of SCTs
50
51 =back
52
53 None of these setters take ownership of the pointers passed to them.
54 Each setter has a matching getter for accessing the current value.
55 The getters do not transfer ownership either.
56
57 When no longer required, the B<CT_POLICY_EVAL_CTX> should be passed to
58 B<CT_POLICY_EVAL_CTX_free>() to delete it.
59
60 =head1 NOTES
61
62 The issuer certificate only needs to be provided if at least one of the SCTs
63 was issued for a pre-certificate. This will be the case for SCTs embedded in a
64 certificate (i.e. those in an X.509 extension), but may not be the case for SCTs
65 found in the TLS SCT extension or OCSP response.
66
67 =head1 RETURN VALUES
68
69 B<CT_POLICY_EVAL_CTX_new>() will return NULL if malloc fails.
70
71 =head1 SEE ALSO
72
73 L<ct(3)>
74
75 =head1 COPYRIGHT
76
77 Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
78
79 Licensed under the OpenSSL license (the "License").  You may not use
80 this file except in compliance with the License.  You can obtain a copy
81 in the file LICENSE in the source distribution or at
82 L<https://www.openssl.org/source/license.html>.
83
84 =cut