Signature ECDSA on JCOP4 P71

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Signature ECDSA on JCOP4 P71

跳至解决方案
1,643 次查看
CuongChu
Contributor I

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?

0 项奖励
回复
1 解答
1,572 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

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?

 

 

Kan_Li_0-1652169512687.png

 

 

 

As mentioned CryptoException has value 0x3 raised by genKeyPair equates to NO_SUCH_ALGORITHM:

 

Kan_Li_1-1652169512710.png

 

 

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.
-------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,631 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

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.
-------------------------------------------------------------------------------

0 项奖励
回复
1,612 次查看
CuongChu
Contributor I

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

 

0 项奖励
回复
1,573 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

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?

 

 

Kan_Li_0-1652169512687.png

 

 

 

As mentioned CryptoException has value 0x3 raised by genKeyPair equates to NO_SUCH_ALGORITHM:

 

Kan_Li_1-1652169512710.png

 

 

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.
-------------------------------------------------------------------------------

0 项奖励
回复
1,549 次查看
CuongChu
Contributor I

I succeeded, thank you very much.

0 项奖励
回复