2014-01-21 10:10:33 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_psm__NSSCertDBTrustDomain_h
|
|
|
|
#define mozilla_psm__NSSCertDBTrustDomain_h
|
|
|
|
|
2013-09-28 06:53:36 +04:00
|
|
|
#include "insanity/pkixtypes.h"
|
2014-01-21 10:10:33 +04:00
|
|
|
#include "secmodt.h"
|
|
|
|
#include "CertVerifier.h"
|
|
|
|
|
|
|
|
namespace mozilla { namespace psm {
|
|
|
|
|
|
|
|
SECStatus InitializeNSS(const char* dir, bool readOnly);
|
|
|
|
|
2014-01-20 13:30:25 +04:00
|
|
|
void DisableMD5();
|
|
|
|
|
2014-01-21 10:10:33 +04:00
|
|
|
extern const char BUILTIN_ROOTS_MODULE_DEFAULT_NAME[];
|
|
|
|
|
2014-03-13 00:08:48 +04:00
|
|
|
void PORT_Free_string(char* str);
|
|
|
|
|
2014-01-21 10:10:33 +04:00
|
|
|
// The dir parameter is the path to the directory containing the NSS builtin
|
|
|
|
// roots module. Usually this is the same as the path to the other NSS shared
|
|
|
|
// libraries. If it is null then the (library) path will be searched.
|
|
|
|
//
|
|
|
|
// The modNameUTF8 parameter should usually be
|
|
|
|
// BUILTIN_ROOTS_MODULE_DEFAULT_NAME.
|
|
|
|
SECStatus LoadLoadableRoots(/*optional*/ const char* dir,
|
|
|
|
const char* modNameUTF8);
|
|
|
|
|
|
|
|
void UnloadLoadableRoots(const char* modNameUTF8);
|
|
|
|
|
2013-07-09 03:30:59 +04:00
|
|
|
// Controls the OCSP fetching behavior of the classic verification mode. In the
|
|
|
|
// classic mode, the OCSP fetching behavior is set globally instead of per
|
|
|
|
// validation.
|
2014-01-21 10:10:33 +04:00
|
|
|
void
|
|
|
|
SetClassicOCSPBehavior(CertVerifier::ocsp_download_config enabled,
|
|
|
|
CertVerifier::ocsp_strict_config strict,
|
|
|
|
CertVerifier::ocsp_get_config get);
|
|
|
|
|
2013-07-09 03:30:59 +04:00
|
|
|
// Caller must free the result with PR_Free
|
|
|
|
char* DefaultServerNicknameForCert(CERTCertificate* cert);
|
|
|
|
|
|
|
|
void SaveIntermediateCerts(const insanity::pkix::ScopedCERTCertList& certList);
|
|
|
|
|
2014-02-10 23:41:12 +04:00
|
|
|
class NSSCertDBTrustDomain : public insanity::pkix::TrustDomain
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2014-02-24 10:15:53 +04:00
|
|
|
enum OCSPFetching {
|
|
|
|
NeverFetchOCSP = 0,
|
|
|
|
FetchOCSPForDVSoftFail = 1,
|
|
|
|
FetchOCSPForDVHardFail = 2,
|
|
|
|
FetchOCSPForEV = 3,
|
|
|
|
LocalOnlyOCSPForEV = 4,
|
|
|
|
};
|
|
|
|
NSSCertDBTrustDomain(SECTrustType certDBTrustType, OCSPFetching ocspFetching,
|
2014-03-13 00:08:48 +04:00
|
|
|
OCSPCache& ocspCache, void* pinArg);
|
2014-02-10 23:41:12 +04:00
|
|
|
|
|
|
|
virtual SECStatus FindPotentialIssuers(
|
|
|
|
const SECItem* encodedIssuerName,
|
|
|
|
PRTime time,
|
|
|
|
/*out*/ insanity::pkix::ScopedCERTCertList& results);
|
|
|
|
|
|
|
|
virtual SECStatus GetCertTrust(insanity::pkix::EndEntityOrCA endEntityOrCA,
|
2014-02-25 00:37:45 +04:00
|
|
|
SECOidTag policy,
|
2014-02-10 23:41:12 +04:00
|
|
|
const CERTCertificate* candidateCert,
|
|
|
|
/*out*/ TrustLevel* trustLevel);
|
|
|
|
|
|
|
|
virtual SECStatus VerifySignedData(const CERTSignedData* signedData,
|
|
|
|
const CERTCertificate* cert);
|
|
|
|
|
2014-02-17 05:35:40 +04:00
|
|
|
virtual SECStatus CheckRevocation(insanity::pkix::EndEntityOrCA endEntityOrCA,
|
|
|
|
const CERTCertificate* cert,
|
|
|
|
/*const*/ CERTCertificate* issuerCert,
|
|
|
|
PRTime time,
|
|
|
|
/*optional*/ const SECItem* stapledOCSPResponse);
|
|
|
|
|
2014-02-10 23:41:12 +04:00
|
|
|
private:
|
2014-03-13 00:08:48 +04:00
|
|
|
SECStatus VerifyAndMaybeCacheEncodedOCSPResponse(
|
|
|
|
const CERTCertificate* cert, CERTCertificate* issuerCert, PRTime time,
|
|
|
|
const SECItem* encodedResponse);
|
|
|
|
|
2014-02-10 23:41:12 +04:00
|
|
|
const SECTrustType mCertDBTrustType;
|
2014-02-24 10:15:53 +04:00
|
|
|
const OCSPFetching mOCSPFetching;
|
2014-03-13 00:08:48 +04:00
|
|
|
OCSPCache& mOCSPCache; // non-owning!
|
2014-02-10 23:41:12 +04:00
|
|
|
void* mPinArg; // non-owning!
|
|
|
|
};
|
|
|
|
|
2014-01-21 10:10:33 +04:00
|
|
|
} } // namespace mozilla::psm
|
|
|
|
|
|
|
|
#endif // mozilla_psm__NSSCertDBTrustDomain_h
|