JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

Valid parameters when generate ECKeyPair

Algorithm School

Moderator: UNKNwYSHSA

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

Valid parameters when generate ECKeyPair

Post by UNKNwYSHSA » Wed Aug 26, 2015 5:28 am

Code like this:

Code: Select all

         KeyPair keyPair = new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_160);
         ECPublicKey publicKey = (ECPublicKey) keyPair.getPublic();
         ECPrivateKey privateKey = (ECPrivateKey) keyPair.getPrivate();
         byte[] a1 = {};
         byte[] b1 = {};
         byte[] a2 = {};
         byte[] b2 = {};
         publicKey.setA(a1, (short) 0, (short) a1.length);
         publicKey.setB(b1, (short) 0, (short) b1.length);
         // ...;
         privateKey.setA(a2, (short) 0, (short) a2.length);
         privateKey.setB(b2, (short) 0, (short) b2.length);
         // ...;
         keyPair.genKeyPair();
         break;

when key pair generated, Which parameters play a role? publicKey's or privateKey's???
I'll have a test on the jcop card, wait the result.
sense and simplicity

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

Re: Valid parameters when generate ECKeyPair

Post by UNKNwYSHSA » Thu Nov 05, 2015 11:32 pm

I found that.
class javacard.security.KeyPair
method public final void 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.

The parameters of public key is used.
sense and simplicity

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

Re: Valid parameters when generate ECKeyPair

Post by UNKNwYSHSA » Thu Nov 05, 2015 11:34 pm

The usual practice is use the public key parameters to generate keypair. (algorithm is EC, RSA or DSA)
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 56 guests

JavaCard OS : Disclaimer