2014-01-21 06:10:33 +00: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 07:11:35 +00: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-19 22:05:40 +00:00
|
|
|
#include "insanity/ScopedPtr.h"
|
2012-10-27 07:11:35 +00:00
|
|
|
|
|
|
|
namespace mozilla { namespace psm {
|
|
|
|
|
|
|
|
class CertVerifier
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef unsigned int Flags;
|
2014-01-17 19:04:09 +00:00
|
|
|
// XXX: FLAG_LOCAL_ONLY is ignored in the classic verification case
|
2012-10-27 07:11:35 +00:00
|
|
|
static const Flags FLAG_LOCAL_ONLY;
|
2014-01-17 19:04:09 +00:00
|
|
|
// Don't perform fallback DV validation on EV validation failure.
|
|
|
|
static const Flags FLAG_NO_DV_FALLBACK_FOR_EV;
|
2012-10-27 07:11:35 +00:00
|
|
|
|
|
|
|
// *evOidPolicy == SEC_OID_UNKNOWN means the cert is NOT EV
|
2013-12-06 21:42:44 +00:00
|
|
|
// Only one usage per verification is supported.
|
2014-01-22 01:30:44 +00:00
|
|
|
SECStatus VerifyCert(CERTCertificate* cert,
|
2012-10-27 07:11:35 +00:00
|
|
|
const SECCertificateUsage usage,
|
|
|
|
const PRTime time,
|
2014-01-19 22:05:40 +00:00
|
|
|
void* pinArg,
|
2012-10-27 07:11:35 +00:00
|
|
|
const Flags flags = 0,
|
2014-01-22 01:30:44 +00:00
|
|
|
/*optional out*/ CERTCertList** validationChain = nullptr,
|
|
|
|
/*optional out*/ SECOidTag* evOidPolicy = nullptr ,
|
|
|
|
/*optional out*/ CERTVerifyLog* verifyLog = nullptr);
|
2012-10-27 07:11:35 +00:00
|
|
|
|
2014-01-19 22:05:40 +00:00
|
|
|
enum implementation_config {
|
|
|
|
classic = 0,
|
|
|
|
#ifndef NSS_NO_LIBPKIX
|
|
|
|
libpkix = 1,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2012-10-27 07:11:35 +00: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 21:32:09 +00:00
|
|
|
enum ocsp_get_config { ocsp_get_disabled = 0, ocsp_get_enabled = 1 };
|
2012-10-27 07:11:35 +00:00
|
|
|
|
|
|
|
bool IsOCSPDownloadEnabled() const { return mOCSPDownloadEnabled; }
|
|
|
|
|
2014-01-19 22:05:40 +00: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 07:11:35 +00:00
|
|
|
~CertVerifier();
|
|
|
|
|
2014-01-19 22:05:40 +00:00
|
|
|
public:
|
|
|
|
const implementation_config mImplementation;
|
2012-10-27 07:11:35 +00:00
|
|
|
const bool mMissingCertDownloadEnabled;
|
|
|
|
const bool mCRLDownloadEnabled;
|
|
|
|
const bool mOCSPDownloadEnabled;
|
|
|
|
const bool mOCSPStrict;
|
2013-10-24 21:32:09 +00:00
|
|
|
const bool mOCSPGETEnabled;
|
2012-10-27 07:11:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace mozilla::psm
|
|
|
|
|
|
|
|
#endif // mozilla_psm__CertVerifier_h
|