Skip to content

Use JCDK's simulator to run APDU tasks #10

Open
@sigalor

Description

@sigalor

Hi everyone!

First, thanks so much for this astonishing and incredibly useful repository! I recently started getting into JavaCard/SIM development, and without open source projects like this, I would definitely be completely lost.

Currently, I am trying out the examples from your javacard-tutorial repository. The CAP file generation and everything else before it runs perfectly fine, but, as I don't have a physical smart card and reader yet, I'd like to try it out on a simulator. The JavaCard Development Kit by Oracle comes with the cref utility; that should be the simulator, right? Sadly, it comes as a Windows EXE file only, so one will need to use wine to execute it on Mac/Linux (I tried it and it works).

Still, it seems like currently, the Gradle plugin cannot use it yet. When I try something like gradle sendHello in the other repository, I get an error message like:

> Task :jc101-1c:sendHello FAILED
gp [-d, -a, 00A404000A01020304050607080901, -a, 0040000000]
GlobalPlatformPro unknown-development
Running on Linux 4.15.0-38-generic amd64, Java 1.8.0_181 by Oracle Corporation
Exception in thread "main" jnasmartcardio.Smartcardio$EstablishContextException: jnasmartcardio.Smartcardio$JnaPCSCException: SCardEstablishContext got response 0x8010001d (SCARD_E_NO_SERVICE: The Smart card resource manager is not running.)
        at jnasmartcardio.Smartcardio$JnaTerminalFactorySpi.engineTerminals(Smartcardio.java:81)
        at javax.smartcardio.TerminalFactory.terminals(TerminalFactory.java:351)
        at pro.javacard.gp.GPTool.main(GPTool.java:344)
Caused by: jnasmartcardio.Smartcardio$JnaPCSCException: SCardEstablishContext got response 0x8010001d (SCARD_E_NO_SERVICE: The Smart card resource manager is not running.)
        at jnasmartcardio.Smartcardio.check(Smartcardio.java:960)
        at jnasmartcardio.Smartcardio.check(Smartcardio.java:951)
        at jnasmartcardio.Smartcardio.access$000(Smartcardio.java:34)
        at jnasmartcardio.Smartcardio$JnaTerminalFactorySpi.engineTerminals(Smartcardio.java:79)
        ... 2 more

And, well, the message The Smart card resource manager is not running. is a fairly clear indication of what's going on. So, does anyone know how I can use the simulator here?

Regarding my system setup: I'm using Ubuntu 16.04 with OpenJDK 1.8.0_181. My JavaCard Development Kit version is 3.0.5u3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions