OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_X509_CERTIFICATE_H_ | 5 #ifndef NET_BASE_X509_CERTIFICATE_H_ |
6 #define NET_BASE_X509_CERTIFICATE_H_ | 6 #define NET_BASE_X509_CERTIFICATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 // 1. Encryption without authentication and thus vulnerable to | 195 // 1. Encryption without authentication and thus vulnerable to |
196 // man-in-the-middle attacks. | 196 // man-in-the-middle attacks. |
197 // 2. Self-signed certificates cannot be revoked. | 197 // 2. Self-signed certificates cannot be revoked. |
198 // | 198 // |
199 // Use this certificate only after the above risks are acknowledged. | 199 // Use this certificate only after the above risks are acknowledged. |
200 static X509Certificate* CreateSelfSigned(crypto::RSAPrivateKey* key, | 200 static X509Certificate* CreateSelfSigned(crypto::RSAPrivateKey* key, |
201 const std::string& subject, | 201 const std::string& subject, |
202 uint32 serial_number, | 202 uint32 serial_number, |
203 base::TimeDelta valid_duration); | 203 base::TimeDelta valid_duration); |
204 | 204 |
205 // Create an origin bound certificate containing the public key in |key|. | |
206 // Subject, web origin, serial number and validity period are given as | |
207 // parameters. The certificate is signed by the private key in |key|. | |
208 // The hashing algorithm for the signature is SHA-1. | |
209 // | |
210 // |subject| is a distinguished name defined in RFC4514. | |
211 // | |
212 // An example: | |
213 // CN=Michael Wong,O=FooBar Corporation,DC=foobar,DC=com | |
214 // | |
215 // SECURITY WARNING | |
216 // | |
217 // Using self-signed certificates has the following security risks: | |
218 // 1. Encryption without authentication and thus vulnerable to | |
219 // man-in-the-middle attacks. | |
220 // 2. Self-signed certificates cannot be revoked. | |
221 // | |
222 // Use this certificate only after the above risks are acknowledged. | |
wtc
2011/08/04 00:37:53
Remove the security warning (lines 215-222). Repl
| |
223 static X509Certificate* CreateOriginBound(crypto::RSAPrivateKey* key, | |
224 const std::string& subject, | |
225 const std::string& origin, | |
226 uint32 serial_number, | |
227 base::TimeDelta valid_duration); | |
228 | |
205 // Appends a representation of this object to the given pickle. | 229 // Appends a representation of this object to the given pickle. |
206 void Persist(Pickle* pickle); | 230 void Persist(Pickle* pickle); |
207 | 231 |
208 // The subject of the certificate. For HTTPS server certificates, this | 232 // The subject of the certificate. For HTTPS server certificates, this |
209 // represents the web server. The common name of the subject should match | 233 // represents the web server. The common name of the subject should match |
210 // the host name of the web server. | 234 // the host name of the web server. |
211 const CertPrincipal& subject() const { return subject_; } | 235 const CertPrincipal& subject() const { return subject_; } |
212 | 236 |
213 // The issuer of the certificate. | 237 // The issuer of the certificate. |
214 const CertPrincipal& issuer() const { return issuer_; } | 238 const CertPrincipal& issuer() const { return issuer_; } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 | 517 |
494 // Where the certificate comes from. | 518 // Where the certificate comes from. |
495 Source source_; | 519 Source source_; |
496 | 520 |
497 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 521 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
498 }; | 522 }; |
499 | 523 |
500 } // namespace net | 524 } // namespace net |
501 | 525 |
502 #endif // NET_BASE_X509_CERTIFICATE_H_ | 526 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |