Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PKCS #1 Type 2 padding

843811Nov 21 2005 — edited Dec 6 2005
I have a question regarding padding types used with RSA as they relate to JCE and Windows CryptoAPI. Someone has an X.508 certificate and they are using Windows CryptoAPI to encrypt some data with the public key. I need to decrypt this data using JCE.

The Windows help for the CryptoAPI CryptEncrypt() method states "encryption uses PKCS #1 Type 2 padding". I'm pretty new to cryptography and I don't know a lot about the different padding methods out there, but I'm not finding much in the Java API to support this type of padding. Or if it's in there they don't refer to it as "PKCS #1 Type 2 padding". Appendix A of the JCE Reference Guide has blurb about the various padding schemes that can be used with the Cipher.getInstance() method. None of them state anything about "PKCS #1" or "Type 2".

After doing a little research it would appear that getInstance("RSA/ECB/PKCS1Padding") may give me the effect I'm looking for. I can use that padding scheme even though it's not documented in the JCE Reference. Does the provider used make a difference? I suppose they could implement getInstance() to use that string passed in however they want.

Does anyone have any thoughts on this?

Thanks,
Dave
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2006
Added on Nov 21 2005
3 comments
1,143 views