RSA SHA256 signing in iOS and verification on Java

后端 未结 1 1372
你的背包
你的背包 2021-02-06 19:23
  1. I generated an RSA key pair with SecKeyGeneratePair. The key size in bits is 2048.

    NSDictionary *privateAttributes = @{(NSString *)kSecAttrIsPermanent:          
    
    
            
相关标签:
1条回答
  • 2021-02-06 20:00

    Digital signature API for iOS and Java is different but the result is the same.

    iOS SecKeyRawSign with kSecPaddingPKCS1SHA256 uses a SHA256 digest, but in Java Signature.sign requires the raw data and it makes digest+pkcs1. Use

    instance.update(rawString.toString().getBytes("UTF-8"));
    
    0 讨论(0)
提交回复
热议问题