macOS Swift程序因为需要,使用了RSA非对称加密。读取公钥的时候一切正常,但读取私钥的时候会报错
Error Domain=NSOSStatusErrorDomain Code=-50 "RSA private key creation from data failed" (paramErr: error in user parameter list) UserInfo={numberOfErrorsDeep=0, NSDescription=RSA private key creation from data failed}
相关代码片段如下
func loadPrivateKey(from string: String) -> SecKey? {
guard let data = Data(base64Encoded: