数据安全

2015-07-17  本文已影响108人  zhazha

本文意义

提交用户的隐私数据

加密算法

常见的加密算法

加密算法的选择

MD5

什么是MD5

MD5的特点

MD5的应用

MD5改进

MD5的使用步骤

    NSString *text = @"www.baidu.com";
    NSString *md = [text md5String];

HTTPS

是否同意安全证书实现步骤

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler
{
    // 证书有好几种
    // 如果不是服务器信任类型的证书,直接返回
    if (![challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) return;

    // 如果block不为空,才执行相应代码,如果为空,会报错,所以要加上判断
    if (completionHandler) {

        // 通过调用这个block,来告诉URLSession要不要接收这个证书
        // NSURLSessionAuthChallengeDisposition : 如何处理这个安全证书
        // NSURLCredential :安全证书
        completionHandler(NSURLSessionAuthChallengeUseCredential, challenge.proposedCredential);
    }

}
 NSURLCredential *crdential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
 !completionHandler ? : completionHandler(NSURLSessionAuthChallengeUseCredential, challenge.proposedCredential);
上一篇 下一篇

猜你喜欢

热点阅读