Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | SCT_validate, SCT_LIST_validate, SCT_get_validation_status - |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 6 | checks Signed Certificate Timestamps (SCTs) are valid |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 7 | |
| 8 | =head1 SYNOPSIS |
| 9 | |
| 10 | #include <openssl/ct.h> |
| 11 | |
Rob Percival | ae97a65 | 2016-08-02 15:39:41 +0100 | [diff] [blame] | 12 | typedef enum { |
Beat Bolli | 2947af3 | 2016-11-19 00:10:05 +0100 | [diff] [blame] | 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 |
Rob Percival | ae97a65 | 2016-08-02 15:39:41 +0100 | [diff] [blame] | 19 | } sct_validation_status_t; |
| 20 | |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 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); |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 23 | sct_validation_status_t SCT_get_validation_status(const SCT *sct); |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 24 | |
| 25 | =head1 DESCRIPTION |
| 26 | |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 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(). |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 31 | |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 32 | A CT_POLICY_EVAL_CTX must be provided that specifies: |
| 33 | |
Rich Salz | 2f61bc2 | 2017-04-07 13:37:47 -0400 | [diff] [blame] | 34 | =over 2 |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 35 | |
Rich Salz | 2f61bc2 | 2017-04-07 13:37:47 -0400 | [diff] [blame] | 36 | =item * |
| 37 | |
| 38 | The certificate the SCT was issued for. |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 39 | |
| 40 | Failure to provide the certificate will result in the validation status being |
| 41 | SCT_VALIDATION_STATUS_UNVERIFIED. |
| 42 | |
Rich Salz | 2f61bc2 | 2017-04-07 13:37:47 -0400 | [diff] [blame] | 43 | =item * |
| 44 | |
| 45 | The issuer of that certificate. |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 46 | |
| 47 | This 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 |
| 49 | be SCT_VALIDATION_STATUS_UNVERIFIED. |
| 50 | |
Rich Salz | 2f61bc2 | 2017-04-07 13:37:47 -0400 | [diff] [blame] | 51 | =item * |
| 52 | |
| 53 | A CTLOG_STORE that contains the CT log that issued this SCT. |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 54 | |
| 55 | If the SCT was issued by a log that is not in this CTLOG_STORE, the validation |
| 56 | status will be SCT_VALIDATION_STATUS_UNKNOWN_LOG. |
| 57 | |
| 58 | =back |
| 59 | |
| 60 | If the SCT is of an unsupported version (only v1 is currently supported), the |
| 61 | validation status will be SCT_VALIDATION_STATUS_UNKNOWN_VERSION. |
| 62 | |
Rob Percival | 1fa9ffd | 2016-09-08 16:02:46 +0100 | [diff] [blame] | 63 | If the SCT's signature is incorrect, its timestamp is in the future (relative to |
| 64 | the time in CT_POLICY_EVAL_CTX), or if it is otherwise invalid, the validation |
| 65 | status will be SCT_VALIDATION_STATUS_INVALID. |
| 66 | |
| 67 | If all checks pass, the validation status will be SCT_VALIDATION_STATUS_VALID. |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 68 | |
| 69 | =head1 NOTES |
| 70 | |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 71 | A return value of 0 from SCT_LIST_validate() should not be interpreted as a |
| 72 | failure. At a minimum, only one valid SCT may provide sufficient confidence |
| 73 | that a certificate has been publicly logged. |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 74 | |
| 75 | =head1 RETURN VALUES |
| 76 | |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 77 | SCT_validate() returns a negative integer if an internal error occurs, 0 if the |
| 78 | SCT fails validation, or 1 if the SCT passes validation. |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 79 | |
Rob Percival | a0a9f36 | 2016-08-23 18:05:28 +0100 | [diff] [blame] | 80 | SCT_LIST_validate() returns a negative integer if an internal error occurs, 0 |
| 81 | if any of SCTs fails validation, or 1 if they all pass validation. |
| 82 | |
| 83 | SCT_get_validation_status() returns the validation status of the SCT. |
| 84 | If SCT_validate() or SCT_LIST_validate() have not been passed that SCT, the |
| 85 | returned value will be SCT_VALIDATION_STATUS_NOT_SET. |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 86 | |
| 87 | =head1 SEE ALSO |
| 88 | |
Richard Levitte | b97fdb5 | 2016-11-11 09:33:09 +0100 | [diff] [blame] | 89 | L<ct(7)> |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 90 | |
Rob Percival | 32fa3da | 2016-08-04 16:42:42 +0100 | [diff] [blame] | 91 | =head1 HISTORY |
| 92 | |
| 93 | These functions were added in OpenSSL 1.1.0. |
| 94 | |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 95 | =head1 COPYRIGHT |
| 96 | |
| 97 | Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. |
| 98 | |
Richard Levitte | 4746f25 | 2018-12-06 14:04:44 +0100 | [diff] [blame] | 99 | Licensed under the Apache License 2.0 (the "License"). You may not use |
Rob Percival | 56f3f71 | 2016-04-28 07:37:24 +0100 | [diff] [blame] | 100 | this file except in compliance with the License. You can obtain a copy |
| 101 | in the file LICENSE in the source distribution or at |
| 102 | L<https://www.openssl.org/source/license.html>. |
| 103 | |
Rob Percival | 6c3e9a7 | 2016-08-04 11:29:23 +0100 | [diff] [blame] | 104 | =cut |