blob: 20fdfb44b5c480e21eaab6b80e768cac2586d7bd [file] [log] [blame]
Rob Percival56f3f712016-04-28 07:37:24 +01001=pod
2
3=head1 NAME
4
5SCT_validate, SCT_LIST_validate, SCT_get_validation_status -
Rob Percivala0a9f362016-08-23 18:05:28 +01006checks Signed Certificate Timestamps (SCTs) are valid
Rob Percival56f3f712016-04-28 07:37:24 +01007
8=head1 SYNOPSIS
9
10 #include <openssl/ct.h>
11
Rob Percivalae97a652016-08-02 15:39:41 +010012 typedef enum {
Beat Bolli2947af32016-11-19 00:10:05 +010013 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
Rob Percivalae97a652016-08-02 15:39:41 +010019 } sct_validation_status_t;
20
Rob Percival56f3f712016-04-28 07:37:24 +010021 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);
Rob Percivala0a9f362016-08-23 18:05:28 +010023 sct_validation_status_t SCT_get_validation_status(const SCT *sct);
Rob Percival56f3f712016-04-28 07:37:24 +010024
25=head1 DESCRIPTION
26
Rob Percivala0a9f362016-08-23 18:05:28 +010027SCT_validate() will check that an SCT is valid and verify its signature.
28SCT_LIST_validate() performs the same checks on an entire stack of SCTs.
29The result of the validation checks can be obtained by passing the SCT to
30SCT_get_validation_status().
Rob Percival56f3f712016-04-28 07:37:24 +010031
Rob Percivala0a9f362016-08-23 18:05:28 +010032A CT_POLICY_EVAL_CTX must be provided that specifies:
33
Rich Salz2f61bc22017-04-07 13:37:47 -040034=over 2
Rob Percivala0a9f362016-08-23 18:05:28 +010035
Rich Salz2f61bc22017-04-07 13:37:47 -040036=item *
37
38The certificate the SCT was issued for.
Rob Percivala0a9f362016-08-23 18:05:28 +010039
40Failure to provide the certificate will result in the validation status being
41SCT_VALIDATION_STATUS_UNVERIFIED.
42
Rich Salz2f61bc22017-04-07 13:37:47 -040043=item *
44
45The issuer of that certificate.
Rob Percivala0a9f362016-08-23 18:05:28 +010046
47This is only required if the SCT was issued for a pre-certificate
48(see RFC 6962). If it is required but not provided, the validation status will
49be SCT_VALIDATION_STATUS_UNVERIFIED.
50
Rich Salz2f61bc22017-04-07 13:37:47 -040051=item *
52
53A CTLOG_STORE that contains the CT log that issued this SCT.
Rob Percivala0a9f362016-08-23 18:05:28 +010054
55If the SCT was issued by a log that is not in this CTLOG_STORE, the validation
56status will be SCT_VALIDATION_STATUS_UNKNOWN_LOG.
57
58=back
59
60If the SCT is of an unsupported version (only v1 is currently supported), the
61validation status will be SCT_VALIDATION_STATUS_UNKNOWN_VERSION.
62
Rob Percival1fa9ffd2016-09-08 16:02:46 +010063If the SCT's signature is incorrect, its timestamp is in the future (relative to
64the time in CT_POLICY_EVAL_CTX), or if it is otherwise invalid, the validation
65status will be SCT_VALIDATION_STATUS_INVALID.
66
67If all checks pass, the validation status will be SCT_VALIDATION_STATUS_VALID.
Rob Percival56f3f712016-04-28 07:37:24 +010068
69=head1 NOTES
70
Rob Percivala0a9f362016-08-23 18:05:28 +010071A return value of 0 from SCT_LIST_validate() should not be interpreted as a
72failure. At a minimum, only one valid SCT may provide sufficient confidence
73that a certificate has been publicly logged.
Rob Percival56f3f712016-04-28 07:37:24 +010074
75=head1 RETURN VALUES
76
Rob Percivala0a9f362016-08-23 18:05:28 +010077SCT_validate() returns a negative integer if an internal error occurs, 0 if the
78SCT fails validation, or 1 if the SCT passes validation.
Rob Percival56f3f712016-04-28 07:37:24 +010079
Rob Percivala0a9f362016-08-23 18:05:28 +010080SCT_LIST_validate() returns a negative integer if an internal error occurs, 0
81if any of SCTs fails validation, or 1 if they all pass validation.
82
83SCT_get_validation_status() returns the validation status of the SCT.
84If SCT_validate() or SCT_LIST_validate() have not been passed that SCT, the
85returned value will be SCT_VALIDATION_STATUS_NOT_SET.
Rob Percival56f3f712016-04-28 07:37:24 +010086
87=head1 SEE ALSO
88
Richard Levitteb97fdb52016-11-11 09:33:09 +010089L<ct(7)>
Rob Percival56f3f712016-04-28 07:37:24 +010090
Rob Percival32fa3da2016-08-04 16:42:42 +010091=head1 HISTORY
92
93These functions were added in OpenSSL 1.1.0.
94
Rob Percival56f3f712016-04-28 07:37:24 +010095=head1 COPYRIGHT
96
97Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
98
Richard Levitte4746f252018-12-06 14:04:44 +010099Licensed under the Apache License 2.0 (the "License"). You may not use
Rob Percival56f3f712016-04-28 07:37:24 +0100100this file except in compliance with the License. You can obtain a copy
101in the file LICENSE in the source distribution or at
102L<https://www.openssl.org/source/license.html>.
103
Rob Percival6c3e9a72016-08-04 11:29:23 +0100104=cut