2014-02-15 02:37:07 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-05-06 00:56:36 +03:00
|
|
|
#ifndef AppTrustDomain_h
|
|
|
|
#define AppTrustDomain_h
|
2014-02-15 02:37:07 +04:00
|
|
|
|
2014-03-21 01:29:21 +04:00
|
|
|
#include "pkix/pkixtypes.h"
|
2015-10-08 12:08:45 +03:00
|
|
|
#include "mozilla/StaticMutex.h"
|
2015-12-06 16:06:03 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2014-02-15 02:37:07 +04:00
|
|
|
#include "nsDebug.h"
|
|
|
|
#include "nsIX509CertDB.h"
|
2014-07-04 08:49:56 +04:00
|
|
|
#include "ScopedNSSTypes.h"
|
2014-02-15 02:37:07 +04:00
|
|
|
|
|
|
|
namespace mozilla { namespace psm {
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class AppTrustDomain final : public mozilla::pkix::TrustDomain
|
2014-02-15 02:37:07 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-07-18 22:48:49 +04:00
|
|
|
typedef mozilla::pkix::Result Result;
|
|
|
|
|
2016-05-06 00:56:36 +03:00
|
|
|
AppTrustDomain(UniqueCERTCertList& certChain, void* pinArg);
|
2014-02-15 02:37:07 +04:00
|
|
|
|
2016-12-14 15:10:25 +03:00
|
|
|
nsresult SetTrustedRoot(AppTrustedRoot trustedRoot);
|
2014-02-15 02:37:07 +04:00
|
|
|
|
2014-07-18 22:48:49 +04:00
|
|
|
virtual Result GetCertTrust(mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
|
|
|
const mozilla::pkix::CertPolicyId& policy,
|
2014-07-31 23:17:31 +04:00
|
|
|
mozilla::pkix::Input candidateCertDER,
|
2014-07-20 22:06:26 +04:00
|
|
|
/*out*/ mozilla::pkix::TrustLevel& trustLevel)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2014-07-31 23:17:31 +04:00
|
|
|
virtual Result FindIssuer(mozilla::pkix::Input encodedIssuerName,
|
2014-07-18 22:48:49 +04:00
|
|
|
IssuerChecker& checker,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::pkix::Time time) override;
|
2014-07-18 22:48:49 +04:00
|
|
|
virtual Result CheckRevocation(mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
2014-08-02 19:49:12 +04:00
|
|
|
const mozilla::pkix::CertID& certID,
|
|
|
|
mozilla::pkix::Time time,
|
2015-04-07 02:10:28 +03:00
|
|
|
mozilla::pkix::Duration validityDuration,
|
2014-07-31 23:17:31 +04:00
|
|
|
/*optional*/ const mozilla::pkix::Input* stapledOCSPresponse,
|
2015-03-21 19:28:04 +03:00
|
|
|
/*optional*/ const mozilla::pkix::Input* aiaExtension) override;
|
2014-09-25 22:18:56 +04:00
|
|
|
virtual Result IsChainValid(const mozilla::pkix::DERArray& certChain,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::pkix::Time time) override;
|
2015-02-15 03:59:02 +03:00
|
|
|
virtual Result CheckSignatureDigestAlgorithm(
|
2015-07-09 09:22:29 +03:00
|
|
|
mozilla::pkix::DigestAlgorithm digestAlg,
|
2015-09-11 21:52:30 +03:00
|
|
|
mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
|
|
|
mozilla::pkix::Time notBefore) override;
|
2015-02-03 03:17:08 +03:00
|
|
|
virtual Result CheckRSAPublicKeyModulusSizeInBits(
|
|
|
|
mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
2015-03-21 19:28:04 +03:00
|
|
|
unsigned int modulusSizeInBits) override;
|
2015-02-07 23:14:31 +03:00
|
|
|
virtual Result VerifyRSAPKCS1SignedDigest(
|
|
|
|
const mozilla::pkix::SignedDigest& signedDigest,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::pkix::Input subjectPublicKeyInfo) override;
|
2015-02-03 03:17:08 +03:00
|
|
|
virtual Result CheckECDSACurveIsAcceptable(
|
|
|
|
mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::pkix::NamedCurve curve) override;
|
2015-02-07 23:14:31 +03:00
|
|
|
virtual Result VerifyECDSASignedDigest(
|
|
|
|
const mozilla::pkix::SignedDigest& signedDigest,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::pkix::Input subjectPublicKeyInfo) override;
|
2015-06-29 23:19:00 +03:00
|
|
|
virtual Result CheckValidityIsAcceptable(
|
|
|
|
mozilla::pkix::Time notBefore, mozilla::pkix::Time notAfter,
|
|
|
|
mozilla::pkix::EndEntityOrCA endEntityOrCA,
|
|
|
|
mozilla::pkix::KeyPurposeId keyPurpose) override;
|
2016-05-06 02:11:11 +03:00
|
|
|
virtual Result NetscapeStepUpMatchesServerAuth(
|
|
|
|
mozilla::pkix::Time notBefore,
|
|
|
|
/*out*/ bool& matches) override;
|
2016-06-15 11:11:00 +03:00
|
|
|
virtual void NoteAuxiliaryExtension(
|
|
|
|
mozilla::pkix::AuxiliaryExtension extension,
|
|
|
|
mozilla::pkix::Input extensionData) override;
|
2014-07-31 23:17:31 +04:00
|
|
|
virtual Result DigestBuf(mozilla::pkix::Input item,
|
2015-02-07 23:14:31 +03:00
|
|
|
mozilla::pkix::DigestAlgorithm digestAlg,
|
2014-07-19 09:30:51 +04:00
|
|
|
/*out*/ uint8_t* digestBuf,
|
2015-03-21 19:28:04 +03:00
|
|
|
size_t digestBufLen) override;
|
2014-07-07 06:36:05 +04:00
|
|
|
|
2014-02-15 02:37:07 +04:00
|
|
|
private:
|
2016-05-06 00:56:36 +03:00
|
|
|
/*out*/ UniqueCERTCertList& mCertChain;
|
2014-02-15 02:37:07 +04:00
|
|
|
void* mPinArg; // non-owning!
|
2016-04-20 11:14:22 +03:00
|
|
|
UniqueCERTCertificate mTrustedRoot;
|
2015-10-08 12:08:45 +03:00
|
|
|
|
|
|
|
static StaticMutex sMutex;
|
2015-12-06 16:06:03 +03:00
|
|
|
static UniquePtr<unsigned char[]> sDevImportedDERData;
|
2015-10-08 12:08:45 +03:00
|
|
|
static unsigned int sDevImportedDERLen;
|
2014-02-15 02:37:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace mozilla::psm
|
|
|
|
|
2016-05-06 00:56:36 +03:00
|
|
|
#endif // AppTrustDomain_h
|