I am trying to Generate ECC key pair to Sign and Verify using the above program, but with the ALG_EC_FP and KeyBuilder Size LENGTH_EC_FP_256. But it fails during the genKeyPair() call with the return value 1 indicating that its an illegal value. Can you please help me why i am getting this error?
I am using the JCOP 2.4.2 R2 Card.
The Filed,A,B,G,S,R,W,K,N values are as shown below.
// check if signature can be verified
if (!sig2.verify(buf, (short) 0, (short)(buf[ISO7816.OFFSET_LC] & (short)0x00FF), scratch, (short) 0, (short) sLen))
return (short) 0xA000;
I could get all the parameters from certicom except the W value. Hence i have used the same value for W as of G. Can you please tel me whether the parameter values that i am using is correct or not?
If not then what are the parameters i should be using?
Yes i am trying to generate the KeyPair to use the keypair for signing and verifying. I want to generate using ALG_EC_FP. I ding set the W field and tried to generate the KEyPair. I still get the same return value. i.e 01 indicating that its an invalid value. Are there any other changes i need to incorporate?
I am using a Java Card 2.4.2 R2 card. I am told that it supports ECC, Do you think otherwise?
Any help in this regard will be greatly appreciated.
1) Create a blank ECPublicKey, then set its curve parameters. (as noted before, don't set the W value)
2) Create a blank ECPrivateKey, then set its curve parameters. (As noted before, don't set the actual private value - the S value)
3) Create a key pair using the public/private keys above (e.g. use the other constructor for KeyPair)
4) Do a genKeyPair using that key pair.
Make sure you use the same curve parameters for both public and private keys.