[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Another RSA question



Hi,

another question arises when working with the RSACipher class.
What is is the "block_type" parameter about? The documentation says:

"To en/decrypt data without any padding (encryption block formatting) as
defined in PKCS#1, 
specify "RSA" as algorithm in method Cipher.getInstance(String algorithm) .
If you want ot use
padding according to PKCS#1 create the algorithm string according to the
following rules: 
'RSA/block_type/PKCS1Padding', where block_type can be 0, 1 or 2.
If a private-key operation has to be done, the block type shall be 0 or 1,
e.g:
  Cipher rsa = Cipher.getInstance("RSA/1/PKCS1Padding");
  rsa.init(Cipher.ENCRYPT_MODE, RSAPrivateKey);
  crypted = rsa.doFinal(data);
...."

So if I use the getInstance() method just with "RSA" I'll get a mode without
any padding?
How will this work at all? And what is a encryption with the private key
good for?
Normally I do a signing operation with the private key, encryption with the
public key
(of another entity), or am I wrong here? So the "block_type" leaves me with
just the
option 2 in my case, because I normally do no encryption with private keys.
I did some measurement as well, and it turns out that the encrypt operation
with specified
"block_type" and "PKCS1Padding" takes about 250 times longer than the same
operation
with no padding specified (5.1 seconds compared to 20 milliseconds in my
case)!
A lot of questions, I know. I would be very glad if you were able to answer
some of them.
Especially the meaning of the block_type parameter is not clear to me from
the documentation.

Tanks, A. Gottschol


****************************************************
Andreas Gottschol - STZ Softwaretechnik

DaimlerChrysler AG
Abt. Information and Technology Management SP&D/B
HPC 0813
D-70546 Stuttgart / Germany
Tel.: +49-711-17-49579
email: andreas.a.gottschol@daimlerchrysler.com
****************************************************


--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce