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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // 1. Encryption without authentication and thus vulnerable to | 180 // 1. Encryption without authentication and thus vulnerable to |
181 // man-in-the-middle attacks. | 181 // man-in-the-middle attacks. |
182 // 2. Self-signed certificates cannot be revoked. | 182 // 2. Self-signed certificates cannot be revoked. |
183 // | 183 // |
184 // Use this certificate only after the above risks are acknowledged. | 184 // Use this certificate only after the above risks are acknowledged. |
185 static X509Certificate* CreateSelfSigned(crypto::RSAPrivateKey* key, | 185 static X509Certificate* CreateSelfSigned(crypto::RSAPrivateKey* key, |
186 const std::string& subject, | 186 const std::string& subject, |
187 uint32 serial_number, | 187 uint32 serial_number, |
188 base::TimeDelta valid_duration); | 188 base::TimeDelta valid_duration); |
189 | 189 |
| 190 // Create an origin bound certificate containing the public key in |key|. |
| 191 // Web origin, serial number and validity period are given as |
| 192 // parameters. The certificate is signed by the private key in |key|. |
| 193 // The hashing algorithm for the signature is SHA-1. |
| 194 // |
| 195 // See Internet Draft draft-balfanz-tls-obc-00 for more details: |
| 196 // http://balfanz.github.com/tls-obc-spec/draft-balfanz-tls-obc-00.html |
| 197 static X509Certificate* CreateOriginBound(crypto::RSAPrivateKey* key, |
| 198 const std::string& origin, |
| 199 uint32 serial_number, |
| 200 base::TimeDelta valid_duration); |
| 201 |
190 // Appends a representation of this object to the given pickle. | 202 // Appends a representation of this object to the given pickle. |
191 void Persist(Pickle* pickle); | 203 void Persist(Pickle* pickle); |
192 | 204 |
193 // The subject of the certificate. For HTTPS server certificates, this | 205 // The subject of the certificate. For HTTPS server certificates, this |
194 // represents the web server. The common name of the subject should match | 206 // represents the web server. The common name of the subject should match |
195 // the host name of the web server. | 207 // the host name of the web server. |
196 const CertPrincipal& subject() const { return subject_; } | 208 const CertPrincipal& subject() const { return subject_; } |
197 | 209 |
198 // The issuer of the certificate. | 210 // The issuer of the certificate. |
199 const CertPrincipal& issuer() const { return issuer_; } | 211 const CertPrincipal& issuer() const { return issuer_; } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // (Marked mutable because it's used in a const method.) | 487 // (Marked mutable because it's used in a const method.) |
476 mutable base::Lock verification_lock_; | 488 mutable base::Lock verification_lock_; |
477 #endif | 489 #endif |
478 | 490 |
479 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 491 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
480 }; | 492 }; |
481 | 493 |
482 } // namespace net | 494 } // namespace net |
483 | 495 |
484 #endif // NET_BASE_X509_CERTIFICATE_H_ | 496 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |