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

Side by Side Diff: webrtc/base/opensslstreamadapter.h

Issue 1269843005: Added DtlsCertificate, a ref counted object owning an SSLIdentity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merge with master Created 5 years, 4 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 class OpenSSLIdentity; 55 class OpenSSLIdentity;
56 56
57 /////////////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////////////
58 58
59 class OpenSSLStreamAdapter : public SSLStreamAdapter { 59 class OpenSSLStreamAdapter : public SSLStreamAdapter {
60 public: 60 public:
61 explicit OpenSSLStreamAdapter(StreamInterface* stream); 61 explicit OpenSSLStreamAdapter(StreamInterface* stream);
62 ~OpenSSLStreamAdapter() override; 62 ~OpenSSLStreamAdapter() override;
63 63
64 void SetIdentity(SSLIdentity* identity) override; 64 void SetCertificate(
65 const scoped_refptr<webrtc::DtlsCertificate>& certificate) override;
65 66
66 // Default argument is for compatibility 67 // Default argument is for compatibility
67 void SetServerRole(SSLRole role = SSL_SERVER) override; 68 void SetServerRole(SSLRole role = SSL_SERVER) override;
68 bool SetPeerCertificateDigest(const std::string& digest_alg, 69 bool SetPeerCertificateDigest(const std::string& digest_alg,
69 const unsigned char* digest_val, 70 const unsigned char* digest_val,
70 size_t digest_len) override; 71 size_t digest_len) override;
71 72
72 bool GetPeerCertificate(SSLCertificate** cert) const override; 73 bool GetPeerCertificate(SSLCertificate** cert) const override;
73 74
74 int StartSSLWithServer(const char* server_name) override; 75 int StartSSLWithServer(const char* server_name) override;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SSLRole role_; 176 SSLRole role_;
176 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED 177 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED
177 // Whether the SSL negotiation is blocked on needing to read or 178 // Whether the SSL negotiation is blocked on needing to read or
178 // write to the wrapped stream. 179 // write to the wrapped stream.
179 bool ssl_read_needs_write_; 180 bool ssl_read_needs_write_;
180 bool ssl_write_needs_read_; 181 bool ssl_write_needs_read_;
181 182
182 SSL* ssl_; 183 SSL* ssl_;
183 SSL_CTX* ssl_ctx_; 184 SSL_CTX* ssl_ctx_;
184 185
185 // Our key and certificate, mostly useful in peer-to-peer mode. 186 // Contains our key and certificate, mostly useful in peer-to-peer mode.
186 scoped_ptr<OpenSSLIdentity> identity_; 187 scoped_refptr<webrtc::DtlsCertificate> certificate_;
187 // in traditional mode, the server name that the server's certificate 188 // in traditional mode, the server name that the server's certificate
188 // must specify. Empty in peer-to-peer mode. 189 // must specify. Empty in peer-to-peer mode.
189 std::string ssl_server_name_; 190 std::string ssl_server_name_;
190 // The certificate that the peer must present or did present. Initially 191 // The certificate that the peer must present or did present. Initially
191 // null in traditional mode, until the connection is established. 192 // null in traditional mode, until the connection is established.
192 scoped_ptr<OpenSSLCertificate> peer_certificate_; 193 scoped_ptr<OpenSSLCertificate> peer_certificate_;
193 // In peer-to-peer mode, the digest of the certificate that 194 // In peer-to-peer mode, the digest of the certificate that
194 // the peer must present. 195 // the peer must present.
195 Buffer peer_certificate_digest_value_; 196 Buffer peer_certificate_digest_value_;
196 std::string peer_certificate_digest_algorithm_; 197 std::string peer_certificate_digest_algorithm_;
197 198
198 // OpenSSLAdapter::custom_verify_callback_ result 199 // OpenSSLAdapter::custom_verify_callback_ result
199 bool custom_verification_succeeded_; 200 bool custom_verification_succeeded_;
200 201
201 // The DtlsSrtp ciphers 202 // The DtlsSrtp ciphers
202 std::string srtp_ciphers_; 203 std::string srtp_ciphers_;
203 204
204 // Do DTLS or not 205 // Do DTLS or not
205 SSLMode ssl_mode_; 206 SSLMode ssl_mode_;
206 207
207 // Max. allowed protocol version 208 // Max. allowed protocol version
208 SSLProtocolVersion ssl_max_version_; 209 SSLProtocolVersion ssl_max_version_;
209 }; 210 };
210 211
211 ///////////////////////////////////////////////////////////////////////////// 212 /////////////////////////////////////////////////////////////////////////////
212 213
213 } // namespace rtc 214 } // namespace rtc
214 215
215 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ 216 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698