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

Side by Side Diff: net/cert/x509_certificate.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « crypto/signature_creator_win.cc ('k') | net/cert/x509_certificate_ios.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CERT_X509_CERTIFICATE_H_ 5 #ifndef NET_CERT_X509_CERTIFICATE_H_
6 #define NET_CERT_X509_CERTIFICATE_H_ 6 #define NET_CERT_X509_CERTIFICATE_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 19 matching lines...) Expand all
30 typedef struct x509_st X509; 30 typedef struct x509_st X509;
31 typedef struct x509_store_st X509_STORE; 31 typedef struct x509_store_st X509_STORE;
32 #elif defined(USE_NSS) 32 #elif defined(USE_NSS)
33 // Forward declaration; real one in <cert.h> 33 // Forward declaration; real one in <cert.h>
34 struct CERTCertificateStr; 34 struct CERTCertificateStr;
35 #endif 35 #endif
36 36
37 class Pickle; 37 class Pickle;
38 class PickleIterator; 38 class PickleIterator;
39 39
40 namespace crypto {
41 class RSAPrivateKey;
42 } // namespace crypto
43
44 namespace net { 40 namespace net {
45 41
46 class CRLSet; 42 class CRLSet;
47 class CertVerifyResult; 43 class CertVerifyResult;
48 44
49 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; 45 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
50 46
51 // X509Certificate represents a X.509 certificate, which is comprised a 47 // X509Certificate represents a X.509 certificate, which is comprised a
52 // particular identity or end-entity certificate, such as an SSL server 48 // particular identity or end-entity certificate, such as an SSL server
53 // identity or an SSL client certificate, and zero or more intermediate 49 // identity or an SSL client certificate, and zero or more intermediate
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 PickleType type); 184 PickleType type);
189 185
190 // Parses all of the certificates possible from |data|. |format| is a 186 // Parses all of the certificates possible from |data|. |format| is a
191 // bit-wise OR of Format, indicating the possible formats the 187 // bit-wise OR of Format, indicating the possible formats the
192 // certificates may have been serialized as. If an error occurs, an empty 188 // certificates may have been serialized as. If an error occurs, an empty
193 // collection will be returned. 189 // collection will be returned.
194 static CertificateList CreateCertificateListFromBytes(const char* data, 190 static CertificateList CreateCertificateListFromBytes(const char* data,
195 int length, 191 int length,
196 int format); 192 int format);
197 193
198 // Create a self-signed certificate containing the public key in |key|.
199 // Subject, serial number and validity period are given as parameters.
200 // The certificate is signed by the private key in |key|. The hashing
201 // algorithm for the signature is SHA-1.
202 //
203 // |subject| is a distinguished name defined in RFC4514.
204 //
205 // An example:
206 // CN=Michael Wong,O=FooBar Corporation,DC=foobar,DC=com
207 //
208 // SECURITY WARNING
209 //
210 // Using self-signed certificates has the following security risks:
211 // 1. Encryption without authentication and thus vulnerable to
212 // man-in-the-middle attacks.
213 // 2. Self-signed certificates cannot be revoked.
214 //
215 // Use this certificate only after the above risks are acknowledged.
216 static X509Certificate* CreateSelfSigned(crypto::RSAPrivateKey* key,
217 const std::string& subject,
218 uint32 serial_number,
219 base::TimeDelta valid_duration);
220
221 // Appends a representation of this object to the given pickle. 194 // Appends a representation of this object to the given pickle.
222 void Persist(Pickle* pickle); 195 void Persist(Pickle* pickle);
223 196
224 // The serial number, DER encoded, possibly including a leading 00 byte. 197 // The serial number, DER encoded, possibly including a leading 00 byte.
225 const std::string& serial_number() const { return serial_number_; } 198 const std::string& serial_number() const { return serial_number_; }
226 199
227 // The subject of the certificate. For HTTPS server certificates, this 200 // The subject of the certificate. For HTTPS server certificates, this
228 // represents the web server. The common name of the subject should match 201 // represents the web server. The common name of the subject should match
229 // the host name of the web server. 202 // the host name of the web server.
230 const CertPrincipal& subject() const { return subject_; } 203 const CertPrincipal& subject() const { return subject_; }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // based on the type of the certificate. 471 // based on the type of the certificate.
499 std::string default_nickname_; 472 std::string default_nickname_;
500 #endif 473 #endif
501 474
502 DISALLOW_COPY_AND_ASSIGN(X509Certificate); 475 DISALLOW_COPY_AND_ASSIGN(X509Certificate);
503 }; 476 };
504 477
505 } // namespace net 478 } // namespace net
506 479
507 #endif // NET_CERT_X509_CERTIFICATE_H_ 480 #endif // NET_CERT_X509_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « crypto/signature_creator_win.cc ('k') | net/cert/x509_certificate_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698