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

Side by Side Diff: webrtc/rtc_base/opensslidentity.h

Issue 3010363002: Implement GetChain for OpenSSLCertificate.
Patch Set: Created 3 years, 3 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
« no previous file with comments | « no previous file | webrtc/rtc_base/opensslidentity.cc » ('j') | webrtc/rtc_base/opensslidentity.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 EVP_PKEY* pkey_; 55 EVP_PKEY* pkey_;
56 56
57 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair); 57 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair);
58 }; 58 };
59 59
60 // OpenSSLCertificate encapsulates an OpenSSL X509* certificate object, 60 // OpenSSLCertificate encapsulates an OpenSSL X509* certificate object,
61 // which is also reference counted inside the OpenSSL library. 61 // which is also reference counted inside the OpenSSL library.
62 class OpenSSLCertificate : public SSLCertificate { 62 class OpenSSLCertificate : public SSLCertificate {
63 public: 63 public:
64 // Caller retains ownership of the X509 object. 64 // Caller retains ownership of the X509 object.
65 explicit OpenSSLCertificate(X509* x509) : x509_(x509) { 65 explicit OpenSSLCertificate(X509* x509);
66 AddReference(); 66
67 } 67 // Caller retains owership of STACK_OF(X509).
68 explicit OpenSSLCertificate(STACK_OF(X509)* chain);
68 69
69 static OpenSSLCertificate* Generate(OpenSSLKeyPair* key_pair, 70 static OpenSSLCertificate* Generate(OpenSSLKeyPair* key_pair,
70 const SSLIdentityParams& params); 71 const SSLIdentityParams& params);
71 static OpenSSLCertificate* FromPEMString(const std::string& pem_string); 72 static OpenSSLCertificate* FromPEMString(const std::string& pem_string);
72 73
73 ~OpenSSLCertificate() override; 74 ~OpenSSLCertificate() override;
74 75
75 OpenSSLCertificate* GetReference() const override; 76 OpenSSLCertificate* GetReference() const override;
76 77
77 X509* x509() const { return x509_; } 78 X509* x509() const { return x509_; }
(...skipping 15 matching lines...) Expand all
93 unsigned char* digest, 94 unsigned char* digest,
94 size_t size, 95 size_t size,
95 size_t* length); 96 size_t* length);
96 97
97 bool GetSignatureDigestAlgorithm(std::string* algorithm) const override; 98 bool GetSignatureDigestAlgorithm(std::string* algorithm) const override;
98 std::unique_ptr<SSLCertChain> GetChain() const override; 99 std::unique_ptr<SSLCertChain> GetChain() const override;
99 100
100 int64_t CertificateExpirationTime() const override; 101 int64_t CertificateExpirationTime() const override;
101 102
102 private: 103 private:
103 void AddReference() const; 104 void AddReference(X509* x509) const;
104 105
105 X509* x509_; 106 X509* x509_;
107 // Non-leaf certificate chain.
108 std::vector<OpenSSLCertificate*> cert_chain_;
106 109
107 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate); 110 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate);
108 }; 111 };
109 112
110 // Holds a keypair and certificate together, and a method to generate 113 // Holds a keypair and certificate together, and a method to generate
111 // them consistently. 114 // them consistently.
112 class OpenSSLIdentity : public SSLIdentity { 115 class OpenSSLIdentity : public SSLIdentity {
113 public: 116 public:
114 static OpenSSLIdentity* GenerateWithExpiration(const std::string& common_name, 117 static OpenSSLIdentity* GenerateWithExpiration(const std::string& common_name,
115 const KeyParams& key_params, 118 const KeyParams& key_params,
(...skipping 22 matching lines...) Expand all
138 std::unique_ptr<OpenSSLKeyPair> key_pair_; 141 std::unique_ptr<OpenSSLKeyPair> key_pair_;
139 std::unique_ptr<OpenSSLCertificate> certificate_; 142 std::unique_ptr<OpenSSLCertificate> certificate_;
140 143
141 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); 144 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity);
142 }; 145 };
143 146
144 147
145 } // namespace rtc 148 } // namespace rtc
146 149
147 #endif // WEBRTC_RTC_BASE_OPENSSLIDENTITY_H_ 150 #endif // WEBRTC_RTC_BASE_OPENSSLIDENTITY_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/rtc_base/opensslidentity.cc » ('j') | webrtc/rtc_base/opensslidentity.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698