Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -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 | #import <Foundation/Foundation.h> |
| 12 | |
| 13 | #import "RTCMacros.h" |
| 14 | |
| 15 | NS_ASSUME_NONNULL_BEGIN |
| 16 | |
| 17 | /** |
| 18 | * Objective-C bindings for webrtc::CryptoOptions. This API had to be flattened |
| 19 | * as Objective-C doesn't support nested structures. |
| 20 | */ |
| 21 | RTC_OBJC_EXPORT |
| 22 | @interface RTCCryptoOptions : NSObject |
| 23 | |
| 24 | /** |
| 25 | * Enable GCM crypto suites from RFC 7714 for SRTP. GCM will only be used |
| 26 | * if both sides enable it |
| 27 | */ |
| 28 | @property(nonatomic, assign) BOOL srtpEnableGcmCryptoSuites; |
| 29 | /** |
| 30 | * If set to true, the (potentially insecure) crypto cipher |
| 31 | * SRTP_AES128_CM_SHA1_32 will be included in the list of supported ciphers |
| 32 | * during negotiation. It will only be used if both peers support it and no |
| 33 | * other ciphers get preferred. |
| 34 | */ |
| 35 | @property(nonatomic, assign) BOOL srtpEnableAes128Sha1_32CryptoCipher; |
| 36 | /** |
| 37 | * If set to true, encrypted RTP header extensions as defined in RFC 6904 |
| 38 | * will be negotiated. They will only be used if both peers support them. |
| 39 | */ |
| 40 | @property(nonatomic, assign) BOOL srtpEnableEncryptedRtpHeaderExtensions; |
| 41 | |
| 42 | /** |
| 43 | * If set all RtpSenders must have an FrameEncryptor attached to them before |
| 44 | * they are allowed to send packets. All RtpReceivers must have a |
| 45 | * FrameDecryptor attached to them before they are able to receive packets. |
| 46 | */ |
| 47 | @property(nonatomic, assign) BOOL sframeRequireFrameEncryption; |
| 48 | |
| 49 | /** |
| 50 | * Initializes CryptoOptions with all possible options set explicitly. This |
| 51 | * is done when converting from a native RTCConfiguration.crypto_options. |
| 52 | */ |
| 53 | - (instancetype)initWithSrtpEnableGcmCryptoSuites:(BOOL)srtpEnableGcmCryptoSuites |
| 54 | srtpEnableAes128Sha1_32CryptoCipher:(BOOL)srtpEnableAes128Sha1_32CryptoCipher |
| 55 | srtpEnableEncryptedRtpHeaderExtensions:(BOOL)srtpEnableEncryptedRtpHeaderExtensions |
| 56 | sframeRequireFrameEncryption:(BOOL)sframeRequireFrameEncryption |
| 57 | NS_DESIGNATED_INITIALIZER; |
| 58 | |
| 59 | - (instancetype)init NS_UNAVAILABLE; |
| 60 | |
| 61 | @end |
| 62 | |
| 63 | NS_ASSUME_NONNULL_END |