Multipeer连接框架中使用的加密?
问题描述:
嘿,我在聊天应用程序中使用ios中的多对等连接框架。此框架是否支持任何加密。我想知道在此框架中使用的加密方法,如AES或RSA加密系统吗? 我的发现和研究:
1. https://datatheorem.github.io/documents/BH_MultipeerConnectivity.pdf 2. https://nabla-c0d3.github.io/blog/2014/08/20/multipeer-connectivity-follow-up/Multipeer连接框架中使用的加密?
请发表乌尔建议
答
是的,有在MCSession.h类的加密选项
// Encryption preference.
typedef NS_ENUM (NSInteger, MCEncryptionPreference) {
MCEncryptionOptional = 0, // session preferred encryption but will accept unencrypted connections
MCEncryptionRequired = 1, // session requires encryption
MCEncryptionNone = 2, // session should not be encrypted
} NS_ENUM_AVAILABLE (10_10, 7_0);
调用此方法:
- (instancetype)initWithPeer:(MCPeerID *)myPeerID
securityIdentity:(nullable NSArray *)identity
encryptionPreference:(MCEncryptionPreference)encryptionPreference NS_DESIGNATED_INITIALIZER;
答
要回答你的第二个问题,MCSession
使用DTLS
加密它的数据。 DTLS
基于TLS
(这是SSL
的替代),并提供相同级别的安全性。
所以只使用
MCSession *session = [[MCSession alloc] initWithPeer:localPeerID
securityIdentity:nil
encryptionPreference:MCEncryptionRequired];
,使您的通信安全。
感谢您的回复。这是什么类型的加密? RSA或AES? – user2494227
请建议他们遵循什么加密方法? – user2494227