summaryrefslogtreecommitdiffstats
path: root/net/base/x509_certificate.cc
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:49:49 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:49:49 +0000
commit931945aa9d1a72f61eb37d3f75eb13a542d4fc2e (patch)
treef0ff0f2bb66f1dadff926ae7bb3dd270692ae146 /net/base/x509_certificate.cc
parentc5addfbb9cb0518d8346cc9b827c2a5e8c32957d (diff)
downloadchromium_src-931945aa9d1a72f61eb37d3f75eb13a542d4fc2e.zip
chromium_src-931945aa9d1a72f61eb37d3f75eb13a542d4fc2e.tar.gz
chromium_src-931945aa9d1a72f61eb37d3f75eb13a542d4fc2e.tar.bz2
Reverting 8864.
Revert r8864. It broke the build url_request_intercept_job.cc. Review URL: http://codereview.chromium.org/19462 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/x509_certificate.cc')
-rw-r--r--net/base/x509_certificate.cc62
1 files changed, 0 insertions, 62 deletions
diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc
index 443ef81..d62f963 100644
--- a/net/base/x509_certificate.cc
+++ b/net/base/x509_certificate.cc
@@ -4,7 +4,6 @@
#include "net/base/x509_certificate.h"
-#include "base/histogram.h"
#include "base/logging.h"
namespace net {
@@ -123,66 +122,5 @@ void X509Certificate::Policy::Deny(X509Certificate* cert) {
denied_.insert(cert->fingerprint());
}
-// static
-X509Certificate* X509Certificate::CreateFromHandle(OSCertHandle cert_handle,
- Source source) {
- DCHECK(cert_handle);
- DCHECK(source != SOURCE_UNUSED);
-
- // Check if we already have this certificate in memory.
- X509Certificate::Cache* cache = X509Certificate::Cache::GetInstance();
- X509Certificate* cached_cert =
- cache->Find(CalculateFingerprint(cert_handle));
- if (cached_cert) {
- DCHECK(cached_cert->source_ != SOURCE_UNUSED);
- if (cached_cert->source_ >= source) {
- // We've found a certificate with the same fingerprint in our cache. We
- // own the |cert_handle|, which makes it our job to free it.
- FreeOSCertHandle(cert_handle);
- DHISTOGRAM_COUNTS(L"X509CertificateReuseCount", 1);
- return cached_cert;
- }
- // Kick out the old certificate from our cache. The new one is better.
- cache->Remove(cached_cert);
- }
- // Otherwise, allocate a new object.
- return new X509Certificate(cert_handle, source);
-}
-
-// static
-X509Certificate* X509Certificate::CreateFromBytes(const char* data,
- int length) {
- OSCertHandle cert_handle = CreateOSCertHandleFromBytes(data, length);
- if (!cert_handle)
- return NULL;
-
- return CreateFromHandle(cert_handle, SOURCE_LONE_CERT_IMPORT);
-}
-
-X509Certificate::X509Certificate(OSCertHandle cert_handle, Source source)
- : cert_handle_(cert_handle), source_(source) {
- Initialize();
-}
-
-X509Certificate::X509Certificate(const std::string& subject,
- const std::string& issuer,
- base::Time start_date,
- base::Time expiration_date)
- : subject_(subject),
- issuer_(issuer),
- valid_start_(start_date),
- valid_expiry_(expiration_date),
- cert_handle_(NULL),
- source_(SOURCE_UNUSED) {
- memset(fingerprint_.data, 0, sizeof(fingerprint_.data));
-}
-
-X509Certificate::~X509Certificate() {
- // We might not be in the cache, but it is safe to remove ourselves anyway.
- X509Certificate::Cache::GetInstance()->Remove(this);
- if (cert_handle_)
- FreeOSCertHandle(cert_handle_);
-}
-
} // namespace net