OLD | NEW |
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 "webrtc/base/stream.h" | 17 #include "webrtc/base/stream.h" |
18 #include "webrtc/base/sslidentity.h" | 18 #include "webrtc/base/sslidentity.h" |
19 | 19 |
20 namespace rtc { | 20 namespace rtc { |
21 | 21 |
22 // Constants for SSL profile. | 22 // Constants for SSL profile. |
23 const int TLS_NULL_WITH_NULL_NULL = 0; | 23 const int TLS_NULL_WITH_NULL_NULL = 0; |
24 | 24 |
25 // Constants for SRTP profiles. | 25 // Constants for SRTP profiles. |
26 const int SRTP_INVALID_CRYPTO_SUITE = 0; | 26 const int SRTP_INVALID_CRYPTO_SUITE = 0; |
27 const int SRTP_AES128_CM_SHA1_80 = 0x0001; | 27 const int SRTP_AES128_CM_SHA1_80 = 0x0001; |
28 const int SRTP_AES128_CM_SHA1_32 = 0x0002; | 28 const int SRTP_AES128_CM_SHA1_32 = 0x0002; |
| 29 const int SRTP_AEAD_AES_128_GCM = 0x0007; |
| 30 const int SRTP_AEAD_AES_256_GCM = 0x0008; |
29 | 31 |
30 // Cipher suite to use for SRTP. Typically a 80-bit HMAC will be used, except | 32 // Cipher suite to use for SRTP. Typically a 80-bit HMAC will be used, except |
31 // in applications (voice) where the additional bandwidth may be significant. | 33 // in applications (voice) where the additional bandwidth may be significant. |
32 // A 80-bit HMAC is always used for SRTCP. | 34 // A 80-bit HMAC is always used for SRTCP. |
33 // 128-bit AES with 80-bit SHA-1 HMAC. | 35 // 128-bit AES with 80-bit SHA-1 HMAC. |
34 extern const char CS_AES_CM_128_HMAC_SHA1_80[]; | 36 extern const char CS_AES_CM_128_HMAC_SHA1_80[]; |
35 // 128-bit AES with 32-bit SHA-1 HMAC. | 37 // 128-bit AES with 32-bit SHA-1 HMAC. |
36 extern const char CS_AES_CM_128_HMAC_SHA1_32[]; | 38 extern const char CS_AES_CM_128_HMAC_SHA1_32[]; |
| 39 // 128-bit AES GCM with 16 byte AEAD auth tag. |
| 40 extern const char CS_AEAD_AES_128_GCM[]; |
| 41 // 256-bit AES GCM with 16 byte AEAD auth tag. |
| 42 extern const char CS_AEAD_AES_256_GCM[]; |
37 | 43 |
38 // Given the DTLS-SRTP protection profile ID, as defined in | 44 // Given the DTLS-SRTP protection profile ID, as defined in |
39 // https://tools.ietf.org/html/rfc4568#section-6.2 , return the SRTP profile | 45 // https://tools.ietf.org/html/rfc4568#section-6.2 , return the SRTP profile |
40 // name, as defined in https://tools.ietf.org/html/rfc5764#section-4.1.2. | 46 // name, as defined in https://tools.ietf.org/html/rfc5764#section-4.1.2. |
41 std::string SrtpCryptoSuiteToName(int crypto_suite); | 47 std::string SrtpCryptoSuiteToName(int crypto_suite); |
42 | 48 |
43 // The reverse of above conversion. | 49 // The reverse of above conversion. |
44 int SrtpCryptoSuiteFromName(const std::string& crypto_suite); | 50 int SrtpCryptoSuiteFromName(const std::string& crypto_suite); |
45 | 51 |
| 52 // Get key length and salt length for given crypto suite. Returns true for |
| 53 // valid suites, otherwise false. |
| 54 bool SrtpCryptoSuiteParams(int crypto_suite, int *key_length, int *salt_length); |
| 55 |
46 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS. | 56 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS. |
47 // After SSL has been started, the stream will only open on successful | 57 // After SSL has been started, the stream will only open on successful |
48 // SSL verification of certificates, and the communication is | 58 // SSL verification of certificates, and the communication is |
49 // encrypted of course. | 59 // encrypted of course. |
50 // | 60 // |
51 // This class was written with SSLAdapter as a starting point. It | 61 // This class was written with SSLAdapter as a starting point. It |
52 // offers a similar interface, with two differences: there is no | 62 // offers a similar interface, with two differences: there is no |
53 // support for a restartable SSL connection, and this class has a | 63 // support for a restartable SSL connection, and this class has a |
54 // peer-to-peer mode. | 64 // peer-to-peer mode. |
55 // | 65 // |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 218 |
209 // If true (default), the client is required to provide a certificate during | 219 // If true (default), the client is required to provide a certificate during |
210 // handshake. If no certificate is given, handshake fails. This applies to | 220 // handshake. If no certificate is given, handshake fails. This applies to |
211 // server mode only. | 221 // server mode only. |
212 bool client_auth_enabled_; | 222 bool client_auth_enabled_; |
213 }; | 223 }; |
214 | 224 |
215 } // namespace rtc | 225 } // namespace rtc |
216 | 226 |
217 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ | 227 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ |
OLD | NEW |