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

[iaik-jce] Digital signature

I wanted to know how fast the signing algorithm works, so I wrote a piece of 
code which signs the same data several times.
According to Java documentation the following cycle should work, there 
wouldn't be the need to init the signing object again, but it usually gives 
an error during the third iteration;

Signature mySig;
KeyPairGenerator keyGen;
mySig = Signature.getInstance("SHA/DSA", "IAIK");
keyGen = KeyPairGenerator.getInstance("DSA", "IAIK");
KeyPair dsakp = keyGen.generateKeyPair();
PrivateKey dsask = dsakp.getPrivate();
byte[] data = new byte[4096];
byte[] firma;
for (k = 0; k < 4096; k++)
  data[k] = (byte) (k % 256);
for (i = 0; i < n; i++) {
  firma = mySig.sign();

on the contrary, the following works correctly:

for (i = 0; i < n; i++) {
  firma = mySig.sign();


Though it's not a real problem, I'd like to know your opinion about it.

Get Your Private, Free Email at http://www.hotmail.com
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

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