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

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

Issue 1774583002: Add IsAcceptableCipher, use instead of GetDefaultCipher. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address feedback Created 4 years, 9 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 | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.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 /* 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 // Retrieves the peer's X.509 certificate, if a connection has been 155 // Retrieves the peer's X.509 certificate, if a connection has been
156 // established. It returns the transmitted over SSL, including the entire 156 // established. It returns the transmitted over SSL, including the entire
157 // chain. The returned certificate is owned by the caller. 157 // chain. The returned certificate is owned by the caller.
158 virtual bool GetPeerCertificate(SSLCertificate** cert) const = 0; 158 virtual bool GetPeerCertificate(SSLCertificate** cert) const = 0;
159 159
160 // Retrieves the IANA registration id of the cipher suite used for the 160 // Retrieves the IANA registration id of the cipher suite used for the
161 // connection (e.g. 0x2F for "TLS_RSA_WITH_AES_128_CBC_SHA"). 161 // connection (e.g. 0x2F for "TLS_RSA_WITH_AES_128_CBC_SHA").
162 virtual bool GetSslCipherSuite(int* cipher_suite); 162 virtual bool GetSslCipherSuite(int* cipher_suite);
163 163
164 virtual int GetSslVersion() const = 0;
165
164 // Key Exporter interface from RFC 5705 166 // Key Exporter interface from RFC 5705
165 // Arguments are: 167 // Arguments are:
166 // label -- the exporter label. 168 // label -- the exporter label.
167 // part of the RFC defining each exporter 169 // part of the RFC defining each exporter
168 // usage (IN) 170 // usage (IN)
169 // context/context_len -- a context to bind to for this connection; 171 // context/context_len -- a context to bind to for this connection;
170 // optional, can be NULL, 0 (IN) 172 // optional, can be NULL, 0 (IN)
171 // use_context -- whether to use the context value 173 // use_context -- whether to use the context value
172 // (needed to distinguish no context from 174 // (needed to distinguish no context from
173 // zero-length ones). 175 // zero-length ones).
174 // result -- where to put the computed value 176 // result -- where to put the computed value
175 // result_len -- the length of the computed value 177 // result_len -- the length of the computed value
176 virtual bool ExportKeyingMaterial(const std::string& label, 178 virtual bool ExportKeyingMaterial(const std::string& label,
177 const uint8_t* context, 179 const uint8_t* context,
178 size_t context_len, 180 size_t context_len,
179 bool use_context, 181 bool use_context,
180 uint8_t* result, 182 uint8_t* result,
181 size_t result_len); 183 size_t result_len);
182 184
183 // DTLS-SRTP interface 185 // DTLS-SRTP interface
184 virtual bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites); 186 virtual bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites);
185 virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite); 187 virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite);
186 188
187 // Capabilities testing 189 // Capabilities testing
188 static bool HaveDtls(); 190 static bool HaveDtls();
189 static bool HaveDtlsSrtp(); 191 static bool HaveDtlsSrtp();
190 static bool HaveExporter(); 192 static bool HaveExporter();
191 193
192 // Returns the default Ssl cipher used between streams of this class 194 // Returns true iff the supplied cipher is deemed to be strong.
193 // for the given protocol version. This is used by the unit tests. 195 // TODO(torbjorng): Consider removing the KeyType argument.
194 // TODO(guoweis): Move this away from a static class method. 196 static bool IsAcceptableCipher(int cipher, KeyType key_type);
195 static int GetDefaultSslCipherForTest(SSLProtocolVersion version, 197 static bool IsAcceptableCipher(const std::string& cipher, KeyType key_type);
196 KeyType key_type);
197 198
198 // TODO(guoweis): Move this away from a static class method. Currently this is 199 // TODO(guoweis): Move this away from a static class method. Currently this is
199 // introduced such that any caller could depend on sslstreamadapter.h without 200 // introduced such that any caller could depend on sslstreamadapter.h without
200 // depending on specific SSL implementation. 201 // depending on specific SSL implementation.
201 static std::string SslCipherSuiteToName(int cipher_suite); 202 static std::string SslCipherSuiteToName(int cipher_suite);
202 203
203 private: 204 private:
204 // If true, the server certificate need not match the configured 205 // If true, the server certificate need not match the configured
205 // server_name, and in fact missing certificate authority and other 206 // server_name, and in fact missing certificate authority and other
206 // verification errors are ignored. 207 // verification errors are ignored.
207 bool ignore_bad_cert_; 208 bool ignore_bad_cert_;
208 209
209 // If true (default), the client is required to provide a certificate during 210 // If true (default), the client is required to provide a certificate during
210 // handshake. If no certificate is given, handshake fails. This applies to 211 // handshake. If no certificate is given, handshake fails. This applies to
211 // server mode only. 212 // server mode only.
212 bool client_auth_enabled_; 213 bool client_auth_enabled_;
213 }; 214 };
214 215
215 } // namespace rtc 216 } // namespace rtc
216 217
217 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ 218 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_
OLDNEW
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698