【问题标题】:Java Card JCA file to CAP file nameJava Card JCA 文件到 CAP 文件名
【发布时间】:2021-11-30 17:23:30
【问题描述】:

使用

将 hello.jca 文件转换为 hello.cap 文件
./capgen.bat ".\hello.jca" -o ".\hello.cap"

即使我指定了输出文件名,输出文件也始终是 a.jar。

【问题讨论】:

  • 你试过把".\hello.jca"放在最后吗?它是选项,然后是文件名。
  • 是的,我试过了,但它仍然是一个.jar

标签: java applet smartcard javacard apdu


【解决方案1】:

您可以通过使用capgen.bat 工具的-config params.json 属性来做到这一点。

但是,您必须下载和使用至少3.1.0 版本的capgen.bat 文件,因为即使3.0.5 没有提到的属性(见下文)。这可以通过下载3.1.0 version of JavaCard Development Kit Toolsjava_card_tools-win-bin-b_17-06_jul_2021.zip文件来实现。

证明(3.0.5 版本)

PS C:\Users\pc> capgen.bat -version
CapGen [v3.0.5]
    Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.

PS C:\Users\pc> capgen.bat -help

usage: capgen [-options] filename
where options include:

-help           Print this message and exit.
-nobanner       Do not display informational messages.
-o <filename>   Output filename. default: a.jar
-version        Print version number and exit.

证明(3.1.0 版本)

PS C:\Users\pc> C:\development\code\java_card_tools-win-bin-b_17-06_jul_2021\bin\capgen.bat -version
CapGen [v3.1.0]
    Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.

PS C:\Users\pc> C:\development\code\java_card_tools-win-bin-b_17-06_jul_2021\bin\capgen.bat -help

usage: capgen [-options] filename
where options include:
-help           Print this message and exit.
-nobanner       Do not display informational messages.
-o <filename>   Output filename. default: a.jar
-version        Print version number and exit.
-config         Run capgen in extended mode. In this case the filename must have .json extension.

现在,这是我设置json 文件的方法:

{
    "inputConfig": {
        "CAP_AID": "01:02:03:04:05:10",
        "CAP_name": "helloworld",
        "CAP_version": "1.0",
        "outputDir": "output",
        "debug": true,
        "inputPackages": [{
            "jcainputfile": "helloworld.jca"
        }]
    }
}

这是我调用命令的方式:

C:\development\code\java_card_tools-win-bin-b_17-06_jul_2021\bin\capgen.bat -config .\jca-to-cap.json

helloworld.cap 文件出现在.\output\helloworld\javacard 目录中。您可以使用 json 文件中的outputDir 选项来更改目标文件夹。

注意:通过这种方式获得的 cap 文件比使用 convert_applet.bat 文件的“正常”方式更轻。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    • 1970-01-01
    相关资源
    最近更新 更多