Benjamin Wright | a54daf1 | 2018-10-11 15:33:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef API_CRYPTO_CRYPTOOPTIONS_H_ |
| 12 | #define API_CRYPTO_CRYPTOOPTIONS_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | #include "absl/types/optional.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | // CryptoOptions defines advanced cryptographic settings for native WebRTC. |
| 20 | // These settings must be passed into PeerConnectionFactoryInterface::Options |
| 21 | // and are only applicable to native use cases of WebRTC. |
| 22 | struct CryptoOptions { |
| 23 | CryptoOptions(); |
| 24 | CryptoOptions(const CryptoOptions& other); |
| 25 | ~CryptoOptions(); |
| 26 | |
| 27 | // Helper method to return an instance of the CryptoOptions with GCM crypto |
| 28 | // suites disabled. This method should be used instead of depending on current |
| 29 | // default values set by the constructor. |
| 30 | static CryptoOptions NoGcm(); |
| 31 | |
| 32 | // Returns a list of the supported DTLS-SRTP Crypto suites based on this set |
| 33 | // of crypto options. |
| 34 | std::vector<int> GetSupportedDtlsSrtpCryptoSuites() const; |
| 35 | |
Benjamin Wright | a54daf1 | 2018-10-11 15:33:17 -0700 | [diff] [blame] | 36 | // SRTP Related Peer Connection options. |
| 37 | struct Srtp { |
| 38 | // Enable GCM crypto suites from RFC 7714 for SRTP. GCM will only be used |
| 39 | // if both sides enable it. |
| 40 | bool enable_gcm_crypto_suites = false; |
| 41 | |
| 42 | // If set to true, the (potentially insecure) crypto cipher |
| 43 | // SRTP_AES128_CM_SHA1_32 will be included in the list of supported ciphers |
| 44 | // during negotiation. It will only be used if both peers support it and no |
| 45 | // other ciphers get preferred. |
| 46 | bool enable_aes128_sha1_32_crypto_cipher = false; |
| 47 | |
| 48 | // If set to true, encrypted RTP header extensions as defined in RFC 6904 |
| 49 | // will be negotiated. They will only be used if both peers support them. |
| 50 | bool enable_encrypted_rtp_header_extensions = false; |
| 51 | } srtp; |
| 52 | }; |
| 53 | |
| 54 | } // namespace webrtc |
| 55 | |
| 56 | #endif // API_CRYPTO_CRYPTOOPTIONS_H_ |