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

Unified Diff: remoting/base/rsa_key_pair.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_util_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/rsa_key_pair.cc
diff --git a/remoting/base/rsa_key_pair.cc b/remoting/base/rsa_key_pair.cc
index 9f8b11f03c690911b028cada25e744be0f9b7743..81e8a9203ecceacd58c2d9c8017288de20b6fd66 100644
--- a/remoting/base/rsa_key_pair.cc
+++ b/remoting/base/rsa_key_pair.cc
@@ -14,7 +14,7 @@
#include "base/time.h"
#include "crypto/rsa_private_key.h"
#include "crypto/signature_creator.h"
-#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util.h"
namespace remoting {
@@ -92,19 +92,15 @@ std::string RsaKeyPair::SignMessage(const std::string& message) const {
}
std::string RsaKeyPair::GenerateCertificate() const {
- scoped_refptr<net::X509Certificate> cert =
- net::X509Certificate::CreateSelfSigned(
- key_.get(), "CN=chromoting",
- base::RandInt(1, std::numeric_limits<int>::max()),
- base::TimeDelta::FromDays(1));
- if (!cert.get())
- return std::string();
-
- std::string encoded;
- bool result = net::X509Certificate::GetDEREncoded(cert->os_cert_handle(),
- &encoded);
- CHECK(result);
- return encoded;
+ std::string der_cert;
+ net::x509_util::CreateSelfSignedCert(
+ key_.get(),
+ "CN=chromoting",
+ base::RandInt(1, std::numeric_limits<int>::max()),
+ base::Time::Now(),
+ base::Time::Now() + base::TimeDelta::FromDays(1),
+ &der_cert);
+ return der_cert;
}
} // namespace remoting
« no previous file with comments | « net/cert/x509_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698