Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

How to use Java Card API 2.2.2 to implement for ECC p-192 ?

JavaCard Applet Development Related Questions and Answers.
Harten
Posts: 12
Joined: Tue Nov 17, 2015 7:41 am
Points :96
Contact:

How to use Java Card API 2.2.2 to implement for ECC p-192 ?

Post by Harten » Sat Jan 23, 2016 5:09 am

I would like to use Java Card API 2.2.2 to implement for Curve P-192.
In Curve P-192, we have

Code: Select all

p = 62771017353866807638357894232076664160839087\
00390324961279
r = 62771017353866807638357894231760590137671947\
73182842284081
s = 3045ae6f c8422f64 ed579528 d38120ea e12196d5
c = 3099d2bb
bfcb2538 542dcd5f b078b6ef 5f3d6fe2 c745de65
b = 64210519
e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1
G x = 188da80e
b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012
G y = 07192b95
ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811


Then, does anyone tell me how to set Gx, Gy using setG method. which is supported from ECKey.

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: How to use Java Card API 2.2.2 to implement for ECC p-192 ?

Post by UNKNwYSHSA » Sun Jan 24, 2016 11:14 pm

The interface ECPrivateKey and ECPublicKey both extens interface ECKey. So you can set Gx uses ECPrivateKey or ECPublicKey. Code as following:

Code: Select all

ECPrivateKey priKey = KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, LENGTH_EC_FP_192, false);
ECPublicKey pubKey = KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PUBLIC, LENGTH_EC_FP_192, false);
pubKey.setA(...);
pubKey.setB(...);
pubKey.setG(...); // Set Gx, Gy here;
pubKey.setXXX(...);
KeyPair kp = new KeyPair(pubKey, priKey);
kp.genKeyPair();
// Next: Use priKey and pubKey ...;

Notice:
1 You shall set EC parameters before genKeyPair;
2 (From description: JavaCard v2.2.2 API javacard.security.KeyPair.genKeyPair)
For the EC case, if the Field, A, B, G and R parameters of the public key object are pre-initialized, then they will be retained. Otherwise default pre-specified values MAY be used (e.g. WAP predefined curves), since computation of random generic EC keys is infeasible on the smart card platform.
(From this description, it seems that it is useful-less to set private key parameters.)
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 20 guests

JavaCard OS : Disclaimer