【问题标题】:Encryption used in Multipeer Connectivity framework?多点连接框架中使用的加密?
【发布时间】:2015-11-03 13:33:47
【问题描述】:

嘿,我在 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/

请发表你的建议

【问题讨论】:

    标签: ios bluetooth chat multipeer-connectivity


    【解决方案1】:

    是的,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;
    

    【讨论】:

    • 感谢您的回复。这是什么加密? RSA 还是 AES?
    • 请建议他们遵循什么加密方法?
    【解决方案2】:

    为了回答您的第二个问题,MCSession 使用DTLS 对其数据进行加密。 DTLS 基于 TLS(替换 SSL),并提供相同级别的安全性。

    所以只使用

    MCSession *session = [[MCSession alloc] initWithPeer:localPeerID
                                    securityIdentity:nil
                                encryptionPreference:MCEncryptionRequired];
    

    确保您的通信安全。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多