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

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
« no previous file with comments | « net/cert/x509_util.h ('k') | net/cert/x509_util_nss_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c7ec15c3b81a76caa49438a077fe67a60142abb1 100644
--- a/net/cert/x509_util_nss.cc
+++ b/net/cert/x509_util_nss.cc
@@ -365,6 +365,29 @@ bool CreateDomainBoundCertEC(
der_cert);
}
+bool CreateSelfSignedCertEC(
+ crypto::ECPrivateKey* key,
+ const std::string& common_name,
+ uint32 serial_number,
+ base::Time not_valid_before,
+ base::Time not_valid_after,
+ std::string* der_cert) {
+ DCHECK(key);
+ CERTCertificate* cert = CreateSelfSignedCert(key->public_key(),
+ key->key(),
+ "CN=" + common_name,
Ryan Sleevi 2013/06/11 20:01:12 From an API perspective, it seems better to allow
jiayl 2013/06/11 20:55:21 Done.
+ 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);
+
+ 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.
« no previous file with comments | « net/cert/x509_util.h ('k') | net/cert/x509_util_nss_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698