Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=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 CSTrustDomain_h
8 : #define CSTrustDomain_h
9 :
10 : #include "pkix/pkixtypes.h"
11 : #include "mozilla/StaticMutex.h"
12 : #include "mozilla/UniquePtr.h"
13 : #include "nsDebug.h"
14 : #include "nsICertBlocklist.h"
15 : #include "nsIX509CertDB.h"
16 : #include "ScopedNSSTypes.h"
17 :
18 : namespace mozilla { namespace psm {
19 :
20 0 : class CSTrustDomain final : public mozilla::pkix::TrustDomain
21 : {
22 : public:
23 : typedef mozilla::pkix::Result Result;
24 :
25 : explicit CSTrustDomain(UniqueCERTCertList& certChain);
26 :
27 : virtual Result GetCertTrust(
28 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
29 : const mozilla::pkix::CertPolicyId& policy,
30 : mozilla::pkix::Input candidateCertDER,
31 : /*out*/ mozilla::pkix::TrustLevel& trustLevel) override;
32 : virtual Result FindIssuer(mozilla::pkix::Input encodedIssuerName,
33 : IssuerChecker& checker,
34 : mozilla::pkix::Time time) override;
35 : virtual Result CheckRevocation(
36 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
37 : const mozilla::pkix::CertID& certID, mozilla::pkix::Time time,
38 : mozilla::pkix::Duration validityDuration,
39 : /*optional*/ const mozilla::pkix::Input* stapledOCSPresponse,
40 : /*optional*/ const mozilla::pkix::Input* aiaExtension) override;
41 : virtual Result IsChainValid(const mozilla::pkix::DERArray& certChain,
42 : mozilla::pkix::Time time,
43 : const mozilla::pkix::CertPolicyId& requiredPolicy)
44 : override;
45 : virtual Result CheckSignatureDigestAlgorithm(
46 : mozilla::pkix::DigestAlgorithm digestAlg,
47 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
48 : mozilla::pkix::Time notBefore) override;
49 : virtual Result CheckRSAPublicKeyModulusSizeInBits(
50 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
51 : unsigned int modulusSizeInBits) override;
52 : virtual Result VerifyRSAPKCS1SignedDigest(
53 : const mozilla::pkix::SignedDigest& signedDigest,
54 : mozilla::pkix::Input subjectPublicKeyInfo) override;
55 : virtual Result CheckECDSACurveIsAcceptable(
56 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
57 : mozilla::pkix::NamedCurve curve) override;
58 : virtual Result VerifyECDSASignedDigest(
59 : const mozilla::pkix::SignedDigest& signedDigest,
60 : mozilla::pkix::Input subjectPublicKeyInfo) override;
61 : virtual Result CheckValidityIsAcceptable(
62 : mozilla::pkix::Time notBefore, mozilla::pkix::Time notAfter,
63 : mozilla::pkix::EndEntityOrCA endEntityOrCA,
64 : mozilla::pkix::KeyPurposeId keyPurpose) override;
65 : virtual Result NetscapeStepUpMatchesServerAuth(
66 : mozilla::pkix::Time notBefore, /*out*/ bool& matches) override;
67 : virtual void NoteAuxiliaryExtension(
68 : mozilla::pkix::AuxiliaryExtension extension,
69 : mozilla::pkix::Input extensionData) override;
70 : virtual Result DigestBuf(mozilla::pkix::Input item,
71 : mozilla::pkix::DigestAlgorithm digestAlg,
72 : /*out*/ uint8_t* digestBuf,
73 : size_t digestBufLen) override;
74 :
75 : private:
76 : /*out*/ UniqueCERTCertList& mCertChain;
77 : nsCOMPtr<nsICertBlocklist> mCertBlocklist;
78 : };
79 :
80 : } } // namespace mozilla::psm
81 :
82 : #endif // CSTrustDomain_h
|