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

Unified Diff: net/cert/x509_util_nss.cc

Issue 16158005: Adds CreateSelfSignedCertEC to x509_util.h in preparation of persistent DTLS identity store for Web… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: net/cert/x509_util_nss.cc
diff --git a/net/cert/x509_util_nss.cc b/net/cert/x509_util_nss.cc
index 66ccedda6848fcbd85d33332d200fbe7b4fb3658..f8b5e3d37cd91625f00ebec9f3e3572f290a2679 100644
--- a/net/cert/x509_util_nss.cc
+++ b/net/cert/x509_util_nss.cc
@@ -365,6 +365,30 @@ bool CreateDomainBoundCertEC(
der_cert);
}
+bool CreateSelfSignedCertEC(
+ crypto::ECPrivateKey* key,
+ const std::string& subject,
+ uint32 serial_number,
+ base::Time not_valid_before,
+ base::Time not_valid_after,
+ std::string* der_cert) {
+ DCHECK(key);
Ryan Sleevi 2013/06/06 23:26:15 DESIGN: You probably want to be looking at IsSuppo
jiayl 2013/06/06 23:45:37 CreateCertificate already checks range validity an
+ CERTCertificate* cert = CreateSelfSignedCert(key->public_key(),
+ key->key(),
+ subject,
+ serial_number,
+ not_valid_before,
+ not_valid_after);
+ if (!cert)
+ return false;
+ der_cert->assign(reinterpret_cast<char*>(cert->derCert.data),
+ cert->derCert.len);
+ CERT_DestroyCertificate(cert);
+ cert = NULL;
Ryan Sleevi 2013/06/06 23:26:15 There's no need for this "= NULL"
jiayl 2013/06/06 23:45:37 Done.
+
+ return true;
+}
+
#if defined(USE_NSS) || defined(OS_IOS)
void ParsePrincipal(CERTName* name, CertPrincipal* principal) {
// Starting in NSS 3.15, CERTGetNameFunc takes a const CERTName* argument.

Powered by Google App Engine
This is Rietveld 408576698