Benjamin Wright | a54daf1 | 2018-10-11 22:33:17 | [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 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #ifndef API_CRYPTO_CRYPTO_OPTIONS_H_ |
| 12 | #define API_CRYPTO_CRYPTO_OPTIONS_H_ |
Benjamin Wright | a54daf1 | 2018-10-11 22:33:17 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
Benjamin Wright | a54daf1 | 2018-10-11 22:33:17 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | // CryptoOptions defines advanced cryptographic settings for native WebRTC. |
| 19 | // These settings must be passed into PeerConnectionFactoryInterface::Options |
| 20 | // and are only applicable to native use cases of WebRTC. |
| 21 | struct CryptoOptions { |
| 22 | CryptoOptions(); |
| 23 | CryptoOptions(const CryptoOptions& other); |
| 24 | ~CryptoOptions(); |
| 25 | |
| 26 | // Helper method to return an instance of the CryptoOptions with GCM crypto |
| 27 | // suites disabled. This method should be used instead of depending on current |
| 28 | // default values set by the constructor. |
| 29 | static CryptoOptions NoGcm(); |
| 30 | |
| 31 | // Returns a list of the supported DTLS-SRTP Crypto suites based on this set |
| 32 | // of crypto options. |
| 33 | std::vector<int> GetSupportedDtlsSrtpCryptoSuites() const; |
| 34 | |
Benjamin Wright | bfb444c | 2018-10-15 17:20:24 | [diff] [blame] | 35 | bool operator==(const CryptoOptions& other) const; |
| 36 | bool operator!=(const CryptoOptions& other) const; |
| 37 | |
Benjamin Wright | a54daf1 | 2018-10-11 22:33:17 | [diff] [blame] | 38 | // SRTP Related Peer Connection options. |
| 39 | struct Srtp { |
| 40 | // Enable GCM crypto suites from RFC 7714 for SRTP. GCM will only be used |
| 41 | // if both sides enable it. |
| 42 | bool enable_gcm_crypto_suites = false; |
| 43 | |
| 44 | // If set to true, the (potentially insecure) crypto cipher |
| 45 | // SRTP_AES128_CM_SHA1_32 will be included in the list of supported ciphers |
| 46 | // during negotiation. It will only be used if both peers support it and no |
| 47 | // other ciphers get preferred. |
| 48 | bool enable_aes128_sha1_32_crypto_cipher = false; |
| 49 | |
| 50 | // If set to true, encrypted RTP header extensions as defined in RFC 6904 |
| 51 | // will be negotiated. They will only be used if both peers support them. |
| 52 | bool enable_encrypted_rtp_header_extensions = false; |
| 53 | } srtp; |
Benjamin Wright | bfb444c | 2018-10-15 17:20:24 | [diff] [blame] | 54 | |
| 55 | // Options to be used when the FrameEncryptor / FrameDecryptor APIs are used. |
| 56 | struct SFrame { |
| 57 | // If set all RtpSenders must have an FrameEncryptor attached to them before |
| 58 | // they are allowed to send packets. All RtpReceivers must have a |
| 59 | // FrameDecryptor attached to them before they are able to receive packets. |
| 60 | bool require_frame_encryption = false; |
| 61 | } sframe; |
Benjamin Wright | a54daf1 | 2018-10-11 22:33:17 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace webrtc |
| 65 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 66 | #endif // API_CRYPTO_CRYPTO_OPTIONS_H_ |