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

Side by Side Diff: webrtc/base/sslstreamadapter.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
11 #ifndef WEBRTC_BASE_SSLSTREAMADAPTER_H_ 11 #ifndef WEBRTC_BASE_SSLSTREAMADAPTER_H_
12 #define WEBRTC_BASE_SSLSTREAMADAPTER_H_ 12 #define WEBRTC_BASE_SSLSTREAMADAPTER_H_
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "talk/app/webrtc/dtlscertificate.h"
17 #include "webrtc/base/stream.h" 18 #include "webrtc/base/stream.h"
18 #include "webrtc/base/sslidentity.h" 19 #include "webrtc/base/sslidentity.h"
19 20
20 namespace rtc { 21 namespace rtc {
21 22
22 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS. 23 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS.
23 // After SSL has been started, the stream will only open on successful 24 // After SSL has been started, the stream will only open on successful
24 // SSL verification of certificates, and the communication is 25 // SSL verification of certificates, and the communication is
25 // encrypted of course. 26 // encrypted of course.
26 // 27 //
(...skipping 30 matching lines...) Expand all
57 explicit SSLStreamAdapter(StreamInterface* stream) 58 explicit SSLStreamAdapter(StreamInterface* stream)
58 : StreamAdapterInterface(stream), ignore_bad_cert_(false), 59 : StreamAdapterInterface(stream), ignore_bad_cert_(false),
59 client_auth_enabled_(true) { } 60 client_auth_enabled_(true) { }
60 61
61 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; } 62 void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; }
62 bool ignore_bad_cert() const { return ignore_bad_cert_; } 63 bool ignore_bad_cert() const { return ignore_bad_cert_; }
63 64
64 void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; } 65 void set_client_auth_enabled(bool enabled) { client_auth_enabled_ = enabled; }
65 bool client_auth_enabled() const { return client_auth_enabled_; } 66 bool client_auth_enabled() const { return client_auth_enabled_; }
66 67
67 // Specify our SSL identity: key and certificate. Mostly this is 68 // Specify our DtlsCertificate containing an SSL identity: our key and
68 // only used in the peer-to-peer mode (unless we actually want to 69 // SSLCertificate. Mostly this is only used in the peer-to-peer mode (unless
69 // provide a client certificate to a server). 70 // we actually want to provide a client certificate to a server).
70 // SSLStream takes ownership of the SSLIdentity object and will 71 virtual void SetCertificate(
71 // free it when appropriate. Should be called no more than once on a 72 const scoped_refptr<webrtc::DtlsCertificate>& certificate) = 0;
72 // given SSLStream instance.
73 virtual void SetIdentity(SSLIdentity* identity) = 0;
74 73
75 // Call this to indicate that we are to play the server's role in 74 // Call this to indicate that we are to play the server's role in
76 // the peer-to-peer mode. 75 // the peer-to-peer mode.
77 // The default argument is for backward compatibility 76 // The default argument is for backward compatibility
78 // TODO(ekr@rtfm.com): rename this SetRole to reflect its new function 77 // TODO(ekr@rtfm.com): rename this SetRole to reflect its new function
79 virtual void SetServerRole(SSLRole role = SSL_SERVER) = 0; 78 virtual void SetServerRole(SSLRole role = SSL_SERVER) = 0;
80 79
81 // Do DTLS or TLS 80 // Do DTLS or TLS
82 virtual void SetMode(SSLMode mode) = 0; 81 virtual void SetMode(SSLMode mode) = 0;
83 82
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 178
180 // If true (default), the client is required to provide a certificate during 179 // If true (default), the client is required to provide a certificate during
181 // handshake. If no certificate is given, handshake fails. This applies to 180 // handshake. If no certificate is given, handshake fails. This applies to
182 // server mode only. 181 // server mode only.
183 bool client_auth_enabled_; 182 bool client_auth_enabled_;
184 }; 183 };
185 184
186 } // namespace rtc 185 } // namespace rtc
187 186
188 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ 187 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698