Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: net/cert/x509_certificate_win.cc

Issue 17265013: Remove platform-specific implementations of RSAPrivateKey and SignatureCreator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix colliding serial numbers Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_win.cc
diff --git a/net/cert/x509_certificate_win.cc b/net/cert/x509_certificate_win.cc
index 02e4df64a4d14a3447dd90d45f79e0afefee24c6..9c8901d66f1cbbd0d2190a7de3febeee2f9f665e 100644
--- a/net/cert/x509_certificate_win.cc
+++ b/net/cert/x509_certificate_win.cc
@@ -13,7 +13,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "crypto/capi_util.h"
-#include "crypto/rsa_private_key.h"
#include "crypto/scoped_capi_types.h"
#include "net/base/net_errors.h"
@@ -165,67 +164,6 @@ void X509Certificate::Initialize() {
reinterpret_cast<char*>(serial_bytes.get()), serial->cbData);
}
-// static
-X509Certificate* X509Certificate::CreateSelfSigned(
- crypto::RSAPrivateKey* key,
- const std::string& subject,
- uint32 serial_number,
- base::TimeDelta valid_duration) {
- // Get the ASN.1 encoding of the certificate subject.
- std::wstring w_subject = ASCIIToWide(subject);
- DWORD encoded_subject_length = 0;
- if (!CertStrToName(
- X509_ASN_ENCODING,
- w_subject.c_str(),
- CERT_X500_NAME_STR, NULL, NULL, &encoded_subject_length, NULL)) {
- return NULL;
- }
-
- scoped_ptr<BYTE[]> encoded_subject(new BYTE[encoded_subject_length]);
- if (!CertStrToName(
- X509_ASN_ENCODING,
- w_subject.c_str(),
- CERT_X500_NAME_STR, NULL,
- encoded_subject.get(),
- &encoded_subject_length, NULL)) {
- return NULL;
- }
-
- CERT_NAME_BLOB subject_name;
- memset(&subject_name, 0, sizeof(subject_name));
- subject_name.cbData = encoded_subject_length;
- subject_name.pbData = encoded_subject.get();
-
- CRYPT_ALGORITHM_IDENTIFIER sign_algo;
- memset(&sign_algo, 0, sizeof(sign_algo));
- sign_algo.pszObjId = szOID_RSA_SHA1RSA;
-
- base::Time not_before = base::Time::Now();
- base::Time not_after = not_before + valid_duration;
- base::Time::Exploded exploded;
-
- // Create the system time structs representing our exploded times.
- not_before.UTCExplode(&exploded);
- SYSTEMTIME start_time;
- ExplodedTimeToSystemTime(exploded, &start_time);
- not_after.UTCExplode(&exploded);
- SYSTEMTIME end_time;
- ExplodedTimeToSystemTime(exploded, &end_time);
-
- PCCERT_CONTEXT cert_handle =
- CertCreateSelfSignCertificate(key->provider(), &subject_name,
- CERT_CREATE_SELFSIGN_NO_KEY_INFO, NULL,
- &sign_algo, &start_time, &end_time, NULL);
- DCHECK(cert_handle) << "Failed to create self-signed certificate: "
- << GetLastError();
- if (!cert_handle)
- return NULL;
-
- X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles());
- FreeOSCertHandle(cert_handle);
- return cert;
-}
-
void X509Certificate::GetSubjectAltName(
std::vector<std::string>* dns_names,
std::vector<std::string>* ip_addrs) const {
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698