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

Side by Side Diff: webrtc/base/sslstreamadapterhelper.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 12 matching lines...) Expand all
23 23
24 // SSLStreamAdapterHelper : A stream adapter which implements much 24 // SSLStreamAdapterHelper : A stream adapter which implements much
25 // of the logic that is common between the known implementations 25 // of the logic that is common between the known implementations
26 // (NSS and OpenSSL) 26 // (NSS and OpenSSL)
27 class SSLStreamAdapterHelper : public SSLStreamAdapter { 27 class SSLStreamAdapterHelper : public SSLStreamAdapter {
28 public: 28 public:
29 explicit SSLStreamAdapterHelper(StreamInterface* stream); 29 explicit SSLStreamAdapterHelper(StreamInterface* stream);
30 ~SSLStreamAdapterHelper() override; 30 ~SSLStreamAdapterHelper() override;
31 31
32 // Overrides of SSLStreamAdapter 32 // Overrides of SSLStreamAdapter
33 void SetIdentity(SSLIdentity* identity) override; 33 void SetCertificate(
34 const rtc::scoped_refptr<webrtc::DtlsCertificate>& dtlscert) override;
34 void SetServerRole(SSLRole role = SSL_SERVER) override; 35 void SetServerRole(SSLRole role = SSL_SERVER) override;
35 void SetMode(SSLMode mode) override; 36 void SetMode(SSLMode mode) override;
36 void SetMaxProtocolVersion(SSLProtocolVersion version) override; 37 void SetMaxProtocolVersion(SSLProtocolVersion version) override;
37 38
38 int StartSSLWithServer(const char* server_name) override; 39 int StartSSLWithServer(const char* server_name) override;
39 int StartSSLWithPeer() override; 40 int StartSSLWithPeer() override;
40 41
41 bool SetPeerCertificateDigest(const std::string& digest_alg, 42 bool SetPeerCertificateDigest(const std::string& digest_alg,
42 const unsigned char* digest_val, 43 const unsigned char* digest_val,
43 size_t digest_len) override; 44 size_t digest_len) override;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 SSL_CLOSED // Clean close 81 SSL_CLOSED // Clean close
81 }; 82 };
82 83
83 // MSG_MAX is the maximum generic stream message number. 84 // MSG_MAX is the maximum generic stream message number.
84 enum { MSG_DTLS_TIMEOUT = MSG_MAX + 1 }; 85 enum { MSG_DTLS_TIMEOUT = MSG_MAX + 1 };
85 86
86 SSLState state_; 87 SSLState state_;
87 SSLRole role_; 88 SSLRole role_;
88 int ssl_error_code_; // valid when state_ == SSL_ERROR 89 int ssl_error_code_; // valid when state_ == SSL_ERROR
89 90
90 // Our key and certificate, mostly useful in peer-to-peer mode. 91 // Contains our key and certificate, mostly useful in peer-to-peer mode.
91 scoped_ptr<SSLIdentity> identity_; 92 scoped_refptr<webrtc::DtlsCertificate> dtlscertificate_;
92 // in traditional mode, the server name that the server's certificate 93 // in traditional mode, the server name that the server's certificate
93 // must specify. Empty in peer-to-peer mode. 94 // must specify. Empty in peer-to-peer mode.
94 std::string ssl_server_name_; 95 std::string ssl_server_name_;
95 // The peer's certificate. Only used for GetPeerCertificate. 96 // The peer's certificate. Only used for GetPeerCertificate.
96 scoped_ptr<SSLCertificate> peer_certificate_; 97 scoped_ptr<SSLCertificate> peer_certificate_;
97 98
98 // The digest of the certificate that the peer must present. 99 // The digest of the certificate that the peer must present.
99 Buffer peer_certificate_digest_value_; 100 Buffer peer_certificate_digest_value_;
100 std::string peer_certificate_digest_algorithm_; 101 std::string peer_certificate_digest_algorithm_;
101 102
102 // Do DTLS or not 103 // Do DTLS or not
103 SSLMode ssl_mode_; 104 SSLMode ssl_mode_;
104 105
105 // Maximum allowed protocol version. 106 // Maximum allowed protocol version.
106 SSLProtocolVersion ssl_max_version_; 107 SSLProtocolVersion ssl_max_version_;
107 108
108 private: 109 private:
109 // Go from state SSL_NONE to either SSL_CONNECTING or SSL_WAIT, 110 // Go from state SSL_NONE to either SSL_CONNECTING or SSL_WAIT,
110 // depending on whether the underlying stream is already open or 111 // depending on whether the underlying stream is already open or
111 // not. Returns 0 on success and a negative value on error. 112 // not. Returns 0 on success and a negative value on error.
112 int StartSSL(); 113 int StartSSL();
113 }; 114 };
114 115
115 } // namespace rtc 116 } // namespace rtc
116 117
117 #endif // WEBRTC_BASE_SSLSTREAMADAPTERHELPER_H_ 118 #endif // WEBRTC_BASE_SSLSTREAMADAPTERHELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698