Chromium Code Reviews| Index: net/cert/x509_util.h |
| diff --git a/net/cert/x509_util.h b/net/cert/x509_util.h |
| index 50ffc7f55fc9538cd6ca724e292cd224722ebc64..92fffc62cee3d28227cc84a7a84bdf99f7cafe9d 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, |
|
wtc
2013/06/20 21:35:56
The change to x509_util::CreateSelfSignedCert shou
|
| + const std::string& common_name, |
| + uint32 serial_number, |
| + base::Time not_valid_before, |
| + base::Time not_valid_after, |
| + std::string* der_encoded); |
|
wtc
2013/06/20 21:35:56
Nit: this output argument should ideally have the
|
| + |
| // 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 |