Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef CTVerifyResult_h
8 : #define CTVerifyResult_h
9 :
10 : #include "CTLog.h"
11 : #include "mozilla/Vector.h"
12 : #include "SignedCertificateTimestamp.h"
13 :
14 : namespace mozilla { namespace ct {
15 :
16 : // Holds a verified Signed Certificate Timestamp along with the verification
17 : // status (e.g. valid/invalid) and additional information related to the
18 : // verification.
19 0 : struct VerifiedSCT
20 : {
21 : VerifiedSCT();
22 :
23 : // The original SCT.
24 : SignedCertificateTimestamp sct;
25 :
26 : enum class Status
27 : {
28 : None,
29 : // The SCT is from a known log, and the signature is valid.
30 : Valid,
31 : // The SCT is from a known disqualified log, and the signature is valid.
32 : // For the disqualification time of the log see |logDisqualificationTime|.
33 : ValidFromDisqualifiedLog,
34 : // The SCT is from an unknown log and can not be verified.
35 : UnknownLog,
36 : // The SCT is from a known log, but the signature is invalid.
37 : InvalidSignature,
38 : // The SCT signature is valid, but the timestamp is in the future.
39 : // Such SCTs are considered invalid (see RFC 6962, Section 5.2).
40 : InvalidTimestamp,
41 : };
42 :
43 : enum class Origin
44 : {
45 : Unknown,
46 : Embedded,
47 : TLSExtension,
48 : OCSPResponse,
49 : };
50 :
51 : Status status;
52 : Origin origin;
53 : CTLogOperatorId logOperatorId;
54 : uint64_t logDisqualificationTime;
55 : };
56 :
57 : typedef Vector<VerifiedSCT> VerifiedSCTList;
58 :
59 : // Holds Signed Certificate Timestamps verification results.
60 0 : class CTVerifyResult
61 : {
62 : public:
63 : // SCTs that were processed during the verification along with their
64 : // verification results.
65 : VerifiedSCTList verifiedScts;
66 :
67 : // The verifier makes the best effort to extract the available SCTs
68 : // from the binary sources provided to it.
69 : // If some SCT cannot be extracted due to encoding errors, the verifier
70 : // proceeds to the next available one. In other words, decoding errors are
71 : // effectively ignored.
72 : // Note that a serialized SCT may fail to decode for a "legitimate" reason,
73 : // e.g. if the SCT is from a future version of the Certificate Transparency
74 : // standard.
75 : // |decodingErrors| field counts the errors of the above kind.
76 : size_t decodingErrors;
77 :
78 : void Reset();
79 : };
80 :
81 : } } // namespace mozilla::ct
82 :
83 : #endif // CTVerifyResult_h
|