Hi Jakob,
I've run a few more tests and here's what I found:
1. RSA-1024 works fine, it signs within a few milliseconds.
2. RSA-2048 signing almost never returns, hangs almost indefinitely
3. The key is generated (on install) like this:
Code:
MANUFACTURER_KEY = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_2048);
MANUFACTURER_KEY.genKeyPair();
then to sign data, I do this
Code:
Signature sig = Signature.getInstance(Signature.ALG_RSA_SHA_PKCS1, false);
sig.init(MANUFACTURER_KEY.getPrivate(), Signature.MODE_SIGN);
short sl = sig.sign(buf, offs, len, buf, offs);
apdu.setOutgoingAndSend(offs, sl);
break;
I've tested this code on 3 cards - an engineering sample from NXP (running the same OS as the Yubikey, JCOP 2.4.2 R1), a microSD form factor card (running JCOP 2.4.1 R3) and the Yubikey Neo. The code works fine on the other two (signing times like 630737us), but not on the Yubikey.
4. It appears to have nothing to do with the size of the data to sign, even a 3 byte array takes forever.
Again, this is only for RSA 2048, RSA with 1024bit keys appears to work fine, it's very fast and usable.
Any ideas?
Razvan