Tag: 公钥

如何在iOS中使用RSA公钥解密密码

我有一个像标题所示的问题。 在应用程序中,首先我生成一个随机数并将其发布到server.Server使用自己的RSA私钥来encryption随机数并将encryption数字返回给我。我有服务器的RSA公钥保留在我的本地作为Base64string。问题是如何使用服务器的RSA公钥(我有一个Base64 string.no PEM或DERtypes的文件)来解密从服务器的密码。 需要你的帮助!

在canAuthenticateAgainstProtectionSpace中检查一个公钥

我被要求在canAuthenticateAgainstProtectionSpace ( NSURLConnection的委托callback)中检查公钥, 这是我迄今为止: – (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { SecKeyRef publicKey = SecTrustCopyPublicKey([protectionSpace serverTrust]); NSLog(@"%@",SecTrustCopyPublicKey([protectionSpace serverTrust])); return YES; } 我怎样才能比较公钥与已知的价值? NSLog产生: <SecKeyRef: 0x687c000>这是不会有用的。