Reputation: 13
Converting hello.jca file to hello.cap file using
./capgen.bat ".\hello.jca" -o ".\hello.cap"
output file is always a.jar even though I'm specifying the output file name.
Upvotes: 1
Views: 367
Reputation: 5025
There is one way you can do that by using the -config params.json
attribute of the capgen.bat
tool.
However, you have to download and use capgen.bat
file of at least 3.1.0
version, as even 3.0.5
doesn't have the mentioned attribute (see below). This can be achieved by download the 3.1.0 version of JavaCard Development Kit Tools namely the java_card_tools-win-bin-b_17-06_jul_2021.zip
file.
Proof (3.0.5
version)
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.
Proof (3.1.0
version)
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.
Now, here is how I set the json
file:
{
"inputConfig": {
"CAP_AID": "01:02:03:04:05:10",
"CAP_name": "helloworld",
"CAP_version": "1.0",
"outputDir": "output",
"debug": true,
"inputPackages": [{
"jcainputfile": "helloworld.jca"
}]
}
}
And here is how I invoked the command:
C:\development\code\java_card_tools-win-bin-b_17-06_jul_2021\bin\capgen.bat -config .\jca-to-cap.json
The helloworld.cap
file appears in the .\output\helloworld\javacard
directory. You can play with outputDir
option in the json file to change the destination folder.
Note: the cap file one gets this way weighs less than if use the "normal" way by using the convert_applet.bat
file.
Upvotes: 0