Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems creating Elliptic Curve KeyPair

Ricard BouJul 30 2024 — edited Jul 30 2024

I am trying to create a Bitcoin Key Pair using Java Card 3.0.4. Compilation works good, but I have a runtime problem, I think the EC algorithms are not implemented in cref. Let me share some code:

import javacard.framework.Applet;
import javacard.security.KeyPair;
import javacard.security.KeyBuilder;
import javacard.security.CryptoException;
...
public class Wallet extends Applet {
    …
    private static KeyPair keyPair;
    …
    protected Wallet () {
        …
        try {
            keyPair = new KeyPair (KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_256);
        } catch (CryptoException e) {
            reason = (short) e.getReason();
        }
        …
    }
    …
}

The exception is thrown and catched, and I get reason 3:

3: NO_SUCH_ALGORITHM
public static final short NO_SUCH_ALGORITHM
This reason code is used to indicate that the requested algorithm or key type is not supported.

My cref is:

Java Card 3.0.4 C Reference Implementation Simulator
32-bit Address Space implementation - with cryptography support
T=1 / T=CL Dual interface APDU protocol (ISO 7816-4)
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.

Is there any cref version or configuration I can use to make my code work?

Thank you !

Comments
Post Details
Added on Jul 30 2024
14 comments
634 views