Signature ECDSA on JCOP4 P71

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Signature ECDSA on JCOP4 P71

Jump to solution
1,640 Views
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 Kudos
Reply
1 Solution
1,569 Views
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
4 Replies
1,628 Views
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 Kudos
Reply
1,609 Views
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 Kudos
Reply
1,570 Views
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 Kudos
Reply
1,546 Views
CuongChu
Contributor I

I succeeded, thank you very much.

0 Kudos
Reply