blob: f0b91d0774740739f129fb6cfee9112f09499b00 [file] [log] [blame]
Benjamin Wrighta54daf12018-10-11 22:33:171/*
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 Anton10542f22019-01-11 17:11:0011#ifndef API_CRYPTO_CRYPTO_OPTIONS_H_
12#define API_CRYPTO_CRYPTO_OPTIONS_H_
Benjamin Wrighta54daf12018-10-11 22:33:1713
14#include <vector>
Benjamin Wrighta54daf12018-10-11 22:33:1715
16namespace 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.
21struct 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 Wrightbfb444c2018-10-15 17:20:2435 bool operator==(const CryptoOptions& other) const;
36 bool operator!=(const CryptoOptions& other) const;
37
Benjamin Wrighta54daf12018-10-11 22:33:1738 // 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 Wrightbfb444c2018-10-15 17:20:2454
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 Wrighta54daf12018-10-11 22:33:1762};
63
64} // namespace webrtc
65
Steve Anton10542f22019-01-11 17:11:0066#endif // API_CRYPTO_CRYPTO_OPTIONS_H_