713bcd29d87a81d4fafb0683f42e3f1d9b2944ba
[openssl.git] / doc / man3 / SCT_validate.pod
1 =pod
2
3 =head1 NAME
4
5 SCT_validate, SCT_LIST_validate, SCT_get_validation_status -
6 checks Signed Certificate Timestamps (SCTs) are valid
7
8 =head1 SYNOPSIS
9
10  #include <openssl/ct.h>
11
12  typedef enum {
13   SCT_VALIDATION_STATUS_NOT_SET,
14   SCT_VALIDATION_STATUS_UNKNOWN_LOG,
15   SCT_VALIDATION_STATUS_VALID,
16   SCT_VALIDATION_STATUS_INVALID,
17   SCT_VALIDATION_STATUS_UNVERIFIED,
18   SCT_VALIDATION_STATUS_UNKNOWN_VERSION
19  } sct_validation_status_t;
20
21  int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
22  int SCT_LIST_validate(const STACK_OF(SCT) *scts, CT_POLICY_EVAL_CTX *ctx);
23  sct_validation_status_t SCT_get_validation_status(const SCT *sct);
24
25 =head1 DESCRIPTION
26
27 SCT_validate() will check that an SCT is valid and verify its signature.
28 SCT_LIST_validate() performs the same checks on an entire stack of SCTs.
29 The result of the validation checks can be obtained by passing the SCT to
30 SCT_get_validation_status().
31
32 A CT_POLICY_EVAL_CTX must be provided that specifies:
33
34 =over
35
36 =item * The certificate the SCT was issued for.
37
38 Failure to provide the certificate will result in the validation status being
39 SCT_VALIDATION_STATUS_UNVERIFIED.
40
41 =item * The issuer of that certificate.
42
43 This is only required if the SCT was issued for a pre-certificate
44 (see RFC 6962). If it is required but not provided, the validation status will
45 be SCT_VALIDATION_STATUS_UNVERIFIED.
46
47 =item * A CTLOG_STORE that contains the CT log that issued this SCT.
48
49 If the SCT was issued by a log that is not in this CTLOG_STORE, the validation
50 status will be SCT_VALIDATION_STATUS_UNKNOWN_LOG.
51
52 =back
53
54 If the SCT is of an unsupported version (only v1 is currently supported), the
55 validation status will be SCT_VALIDATION_STATUS_UNKNOWN_VERSION.
56
57 If the SCT's signature is incorrect, the validation status will be
58 SCT_VALIDATION_STATUS_INVALID. Otherwise, if all checks have passed, the
59 validation status will be SCT_VALIDATION_STATUS_VALID.
60
61 =head1 NOTES
62
63 A return value of 0 from SCT_LIST_validate() should not be interpreted as a
64 failure. At a minimum, only one valid SCT may provide sufficient confidence
65 that a certificate has been publicly logged.
66
67 =head1 RETURN VALUES
68
69 SCT_validate() returns a negative integer if an internal error occurs, 0 if the
70 SCT fails validation, or 1 if the SCT passes validation.
71
72 SCT_LIST_validate() returns a negative integer if an internal error occurs, 0
73 if any of SCTs fails validation, or 1 if they all pass validation.
74
75 SCT_get_validation_status() returns the validation status of the SCT.
76 If SCT_validate() or SCT_LIST_validate() have not been passed that SCT, the
77 returned value will be SCT_VALIDATION_STATUS_NOT_SET.
78
79 =head1 SEE ALSO
80
81 L<ct(3)>
82
83 =head1 HISTORY
84
85 These functions were added in OpenSSL 1.1.0.
86
87 =head1 COPYRIGHT
88
89 Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
90
91 Licensed under the OpenSSL license (the "License").  You may not use
92 this file except in compliance with the License.  You can obtain a copy
93 in the file LICENSE in the source distribution or at
94 L<https://www.openssl.org/source/license.html>.
95
96 =cut