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.

Implementing Elliptic Curve Cryptography on javacard

JavaCard Applet Development Related Questions and Answers.
choimillen
Posts: 30
Joined: Wed Aug 19, 2015 2:55 am
Points :213
Contact:

Implementing Elliptic Curve Cryptography on javacard

Post by choimillen » Mon Jan 25, 2016 1:37 am

I would like to implement Elliptic curve cryptography on my java card? Does java card support Elliptic curve cryptography?
If yes, can someone provide me some sample code on how to encrypt and decrypt the data using the same mechanism.

User avatar
horse dream
Posts: 76
Joined: Thu May 21, 2015 11:48 pm
Points :140
Contact:

Re: Implementing Elliptic Curve Cryptography on javacard

Post by horse dream » Tue Jan 26, 2016 3:10 am

Firstly, you should check whether your card supports EC cryptography.

ECC is rather dedicated to sign/verify operation on java card.
Here is part of sample code which maybe helpful to you.

Code: Select all

        byte[] dataToSend = new byte[64];
        KeyPair ecKeyPair = new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_128);
        ecKeyPair.genKeyPair();
        ECPrivateKey ecPrivateKey = (ECPrivateKey) ecKeyPair.getPrivate();
        ECPublicKey ecPublicKey = (ECPublicKey) ecKeyPair.getPublic();
   
        Signature sig = Signature.getInstance(Signature.ALG_ECDSA_SHA, false);
        sig.init(ecPrivateKey, Signature.MODE_SIGN);
        short resLen = sig.sign(new byte[]{0,1,2,3}, (short)0, (short)4, dataToSend, (short)0);
   
        sig.init(ecPublicKey, Signature.MODE_VERIFY);
        if (!sig.verify(new byte[]{0,1,2,3}, (short)0, (short)4, dataToSend, (short)0, resLen))
            ISOException.throwIt(ISO7816.SW_WRONG_DATA);

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 32 guests

JavaCard OS : Disclaimer