I want sign ECDSA on smartcard jcop 4 p71. But it error when build ECPublicKey and EcPrivateKey. whether JCOP4 P71 does not support ECDSA or do I need to enable it?
解決済! 解決策の投稿を見る。
Hi @CuongChu ,
I have built this code and added some values for the Elliptic curve parameters.
It works fine. I have attached the project. Here are the project settings I used.
Can you check the configuration as well?
As mentioned CryptoException has value 0x3 raised by genKeyPair equates to NO_SUCH_ALGORITHM:
Please also look at the values of TYPE_EC_FP_PRIVATE and TYPE_EC_FP_PUBLIC and confirm that they equate to 0xc and 0xb respectively in the simulator to confirm correct algorithm is configured.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi @CuongChu ,
Is it possible to share a log for this issue?
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Kan
My code:
objECDSAPriKey = (ECPrivateKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KeyBuilder.LENGTH_EC_FP_256, false);
objECDSAPubKey = (ECPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC, KeyBuilder.LENGTH_EC_FP_256, false);
objECDSASign = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
objECDSAPubKey.setFieldFP(SecP256k1_P, (short)0, (short)SecP256k1_P.length);
objECDSAPubKey.setA(SecP256k1_A, (short)0, (short)SecP256k1_A.length);
objECDSAPubKey.setB(SecP256k1_B, (short)0, (short)SecP256k1_B.length);
objECDSAPubKey.setG(SecP256k1_G, (short)0, (short)SecP256k1_G.length);
objECDSAPubKey.setR(SecP256k1_N, (short)0, (short)SecP256k1_N.length);
objECDSAPubKey.setK(SecP256k1_H);
objECDSAPriKey.setFieldFP(SecP256k1_P, (short)0, (short)SecP256k1_P.length);
objECDSAPriKey.setA(SecP256k1_A, (short)0, (short)SecP256k1_A.length);
objECDSAPriKey.setB(SecP256k1_B, (short)0, (short)SecP256k1_B.length);
objECDSAPriKey.setG(SecP256k1_G, (short)0, (short)SecP256k1_G.length);
objECDSAPriKey.setR(SecP256k1_N, (short)0, (short)SecP256k1_N.length);
objECDSAPriKey.setK(SecP256k1_H);
objECDSAKeyPair = new KeyPair(objECDSAPubKey,objECDSAPriKey);
objECDSAKeyPair.genKeyPair();
My result of this code:
0x0003
Hi @CuongChu ,
I have built this code and added some values for the Elliptic curve parameters.
It works fine. I have attached the project. Here are the project settings I used.
Can you check the configuration as well?
As mentioned CryptoException has value 0x3 raised by genKeyPair equates to NO_SUCH_ALGORITHM:
Please also look at the values of TYPE_EC_FP_PRIVATE and TYPE_EC_FP_PUBLIC and confirm that they equate to 0xc and 0xb respectively in the simulator to confirm correct algorithm is configured.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
I succeeded, thank you very much.