Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PKCS#1 V2.0 implemented for Java?

I need encrypt data using exactly the PKCS#1 V2.0 encryption method (defined in item 7.2.1 of the PKCS#1V2 specification).

Is it already implemented for Java?

I'm thinking in something like just pass a parameter to javax.crypto.Cipher specifying "PKCS#1V2", I wonder if there is something like this?

like image 628
The Student Avatar asked Jun 01 '10 20:06

The Student


People also ask

What is PKCS format?

PKCS#12 (also known as PKCS12 or PFX) is a binary format for storing a certificate chain and private key in a single, encryptable file. PKCS#12 files are commonly used to import and export certificates and private keys on Windows and macOS computers, and usually have the filename extensions . p12 or . pfx .

Is PKCS12 safe?

PKCS12 (aka PFX) files, on the other hand, are language-neutral and is more secure and has been around long enough that it's supported just about everywhere.

What is a PKCS token?

Within PKCS#11, a token is viewed as a device that stores objects and can perform cryptographic functions. Objects are generally defined in one of four classes: >Data objects, which are defined by an application. >Certificate objects, which are digital certificates such as X.509.

What is the difference between pkcs7 and PKCS12?

Also PKCS#7 format can be used to store one or more certificates without private keys (private keys can be put as a data payload and encrypted this way). PKCS#10 defines format for certificate requests. PKCS#12 provides a container for one or several certificates with private keys. Save this answer.


1 Answers

PKCS#1 v2.0 encryption is usually called OAEP encryption. So:

Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");

The place to look is the Java Cryptography Architecture documents: Standard Algorithm Name Documentation or Sun Providers Documentation.

As you can see the SunJCE provider supports the following variations of OAEP:

  • OAEPWITHMD5ANDMGF1PADDING
  • OAEPWITHSHA1ANDMGF1PADDING
  • (OAEPWITHSHA-1ANDMGF1PADDING)
  • OAEPWITHSHA-256ANDMGF1PADDING
  • OAEPWITHSHA-384ANDMGF1PADDING
  • OAEPWITHSHA-512ANDMGF1PADDING
like image 132
Rasmus Faber Avatar answered Sep 21 '22 12:09

Rasmus Faber