| JDK 6 |
|---|
| 6-poolResolved |
|
Relates :
|
|
|
Relates :
|
Consider the following code snippet
Cipher rsa = Cipher.getInstance("RSA","SunMSCAPI");
rsa.init(Cipher.ENCRYPT_MODE, privateKey);
The resulting Cipher is the same as if a corresponding publicKey was provided.
At CU's opinion using Cipher API for encryption with private key is not a common case but it is not a misuse of the API. SunJCE provider supports such scenario.
PKCS #7 signed data specification describes encryption with the private key
see http://www.ietf.org/rfc/rfc2315.txt
The request is to initialize Ciphers with the private key if a private key is provided in case of SunMSCAPI - encryption.