2014-01-20 22:10:33 -08: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: */
|
2012-10-27 00:11:35 -07:00
|
|
|
/* 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__CertVerifier_h
|
|
|
|
#define mozilla_psm__CertVerifier_h
|
|
|
|
|
|
|
|
#include "certt.h"
|
2014-01-22 17:13:19 -08:00
|
|
|
#include "insanity/pkixtypes.h"
|
2012-10-27 00:11:35 -07:00
|
|
|
|
|
|
|
namespace mozilla { namespace psm {
|
|
|
|
|
|
|
|
class CertVerifier
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef unsigned int Flags;
|
2014-01-17 11:04:09 -08:00
|
|
|
// XXX: FLAG_LOCAL_ONLY is ignored in the classic verification case
|
2012-10-27 00:11:35 -07:00
|
|
|
static const Flags FLAG_LOCAL_ONLY;
|
2014-01-17 11:04:09 -08:00
|
|
|
// Don't perform fallback DV validation on EV validation failure.
|
|
|
|
static const Flags FLAG_NO_DV_FALLBACK_FOR_EV;
|
2012-10-27 00:11:35 -07:00
|
|
|
|
|
|
|
// *evOidPolicy == SEC_OID_UNKNOWN means the cert is NOT EV
|
2013-12-06 13:42:44 -08:00
|
|
|
// Only one usage per verification is supported.
|
2014-01-21 17:30:44 -08:00
|
|
|
SECStatus VerifyCert(CERTCertificate* cert,
|
2012-10-27 00:11:35 -07:00
|
|
|
const SECCertificateUsage usage,
|
|
|
|
const PRTime time,
|
2014-01-19 14:05:40 -08:00
|
|
|
void* pinArg,
|
2012-10-27 00:11:35 -07:00
|
|
|
const Flags flags = 0,
|
2014-01-22 17:13:19 -08:00
|
|
|
/*optional out*/ insanity::pkix::ScopedCERTCertList* validationChain = nullptr,
|
|
|
|
/*optional out*/ SECOidTag* evOidPolicy = nullptr ,
|
|
|
|
/*optional out*/ CERTVerifyLog* verifyLog = nullptr);
|
2012-10-27 00:11:35 -07:00
|
|
|
|
2013-07-08 16:30:59 -07:00
|
|
|
SECStatus VerifySSLServerCert(
|
|
|
|
CERTCertificate* peerCert,
|
|
|
|
PRTime time,
|
|
|
|
/*optional*/ void* pinarg,
|
|
|
|
const char* hostname,
|
|
|
|
bool saveIntermediatesInPermanentDatabase = false,
|
|
|
|
/*optional out*/ insanity::pkix::ScopedCERTCertList* certChainOut = nullptr,
|
|
|
|
/*optional out*/ SECOidTag* evOidPolicy = nullptr);
|
|
|
|
|
|
|
|
|
2014-01-19 14:05:40 -08:00
|
|
|
enum implementation_config {
|
|
|
|
classic = 0,
|
|
|
|
#ifndef NSS_NO_LIBPKIX
|
|
|
|
libpkix = 1,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2012-10-27 00:11:35 -07:00
|
|
|
enum missing_cert_download_config { missing_cert_download_off = 0, missing_cert_download_on };
|
|
|
|
enum crl_download_config { crl_local_only = 0, crl_download_allowed };
|
|
|
|
enum ocsp_download_config { ocsp_off = 0, ocsp_on };
|
|
|
|
enum ocsp_strict_config { ocsp_relaxed = 0, ocsp_strict };
|
2013-10-24 14:32:09 -07:00
|
|
|
enum ocsp_get_config { ocsp_get_disabled = 0, ocsp_get_enabled = 1 };
|
2012-10-27 00:11:35 -07:00
|
|
|
|
|
|
|
bool IsOCSPDownloadEnabled() const { return mOCSPDownloadEnabled; }
|
|
|
|
|
2014-01-19 14:05:40 -08:00
|
|
|
CertVerifier(implementation_config ic, missing_cert_download_config ac,
|
|
|
|
crl_download_config cdc, ocsp_download_config odc,
|
|
|
|
ocsp_strict_config osc, ocsp_get_config ogc);
|
2012-10-27 00:11:35 -07:00
|
|
|
~CertVerifier();
|
|
|
|
|
2014-01-19 14:05:40 -08:00
|
|
|
public:
|
|
|
|
const implementation_config mImplementation;
|
2012-10-27 00:11:35 -07:00
|
|
|
const bool mMissingCertDownloadEnabled;
|
|
|
|
const bool mCRLDownloadEnabled;
|
|
|
|
const bool mOCSPDownloadEnabled;
|
|
|
|
const bool mOCSPStrict;
|
2013-10-24 14:32:09 -07:00
|
|
|
const bool mOCSPGETEnabled;
|
2012-10-27 00:11:35 -07:00
|
|
|
};
|
|
|
|
|
2013-07-10 23:47:09 -07:00
|
|
|
void InitCertVerifierLog();
|
2012-10-27 00:11:35 -07:00
|
|
|
} } // namespace mozilla::psm
|
|
|
|
|
|
|
|
#endif // mozilla_psm__CertVerifier_h
|