开发者

Error :RSA_padding_check_PKCS1_type_1:block type is not 01 ..?

开发者 https://www.devze.com 2023-04-10 15:13 出处:网络
hi can any tell me why this error occurs while decrypt the RSA Private key encrypted message. i am Verifying the Signature of the message signed by the Java and verifying the Signature using openssl

hi can any tell me why this error occurs while decrypt the RSA Private key encrypted message.

i am Verifying the Signature of the message signed by the Java and verifying the Signature using openssl 0.9.开发者_JAVA技巧8g


This usually means that the encrypting side and the decrypting side are using different padding scheme. They need to be the same on both sides.

If you use Bouncy Castle in Java, you can specify the padding scheme (in this case, PKCS #1 padding) in the cipher like this:

Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC");

In openssl, you can specify the padding scheme in the encrypt/decrypt command:

openssl rsautl -pkcs -decrypt ...

Here, option "-pkcs" specifies the PKCS #1 padding scheme.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号