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

Unified Diff: net/cert/x509_util.h

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_win.cc ('k') | net/cert/x509_util_nss.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_util.h
diff --git a/net/cert/x509_util.h b/net/cert/x509_util.h
index 50ffc7f55fc9538cd6ca724e292cd224722ebc64..c618fe9760bfbc903a71dadc94ce50c6c71ed989 100644
--- a/net/cert/x509_util.h
+++ b/net/cert/x509_util.h
@@ -13,6 +13,7 @@
namespace crypto {
class ECPrivateKey;
+class RSAPrivateKey;
}
namespace net {
@@ -44,6 +45,31 @@ NET_EXPORT_PRIVATE bool CreateDomainBoundCertEC(
base::Time not_valid_after,
std::string* der_cert);
+// Create a self-signed certificate containing the public key in |key|.
+// Subject, serial number and validity period are given as parameters.
+// The certificate is signed by the private key in |key|. The hashing
+// algorithm for the signature is SHA-1.
+//
+// |subject| is a distinguished name defined in RFC4514.
+//
+// An example:
+// CN=Michael Wong,O=FooBar Corporation,DC=foobar,DC=com
+//
+// SECURITY WARNING
+//
+// Using self-signed certificates has the following security risks:
+// 1. Encryption without authentication and thus vulnerable to
+// man-in-the-middle attacks.
+// 2. Self-signed certificates cannot be revoked.
+//
+// Use this certificate only after the above risks are acknowledged.
+NET_EXPORT bool CreateSelfSignedCert(crypto::RSAPrivateKey* key,
+ const std::string& subject,
+ uint32 serial_number,
+ base::Time not_valid_before,
+ base::Time not_valid_after,
+ std::string* der_cert);
+
// Comparator for use in STL algorithms that will sort client certificates by
// order of preference.
// Returns true if |a| is more preferable than |b|, allowing it to be used
« no previous file with comments | « net/cert/x509_certificate_win.cc ('k') | net/cert/x509_util_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698