I made few lines of an appled that allow to generate a rsakey and with that key and the apdu that I send sign it but I'm not sure if the simulator is working right.
I mean, I sent few times the same APDU but it returns me all the time the same answer :S. Yes the data that's is being signed is the same but every time I start the simulator I sent that APDU the private key to sign should be different generating a different signature no?
My code is that:
byte buffer = apdu.getBuffer();
byte retorn = new byte;
KeyPair claus = new KeyPair (KeyPair.ALG_RSA, (short)512) ;
PrivateKey privKey = claus.getPrivate();
Signature signature = Signature.getInstance(Signature.ALG_RSA_SHA_PKCS1 , false);
signature.sign(buffer, ISO7816.OFFSET_CDATA, lc, retorn, (short)0);
apdu.sendBytesLong(retorn, (short) 0, (short) retorn.length);
I understood something wrong?
Thanks guys :)