martinpaljak / GlobalPlatformPro

🌐 🔐 Manage applets and keys on JavaCard-s like a pro
https://javacard.pro/globalplatform
GNU Lesser General Public License v3.0
713 stars 212 forks source link

Error on applet instantiation with parameters #25

Closed jlanza closed 9 years ago

jlanza commented 9 years ago

I'm trying to install an applet that has parameters. The command used is:

gp -d -visa2 -key MY_KEY --package MY_PACKAGE --applet MY_APPLET --create MY_INSTANCE -params MY_PARAMS

The problem is that MY_PARAMS is 23 bytes long. I have set it with C917MY_PARAMS and only MY_PARAMS. Both returns the same error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at pro.javacard.gp.GPTool.getInstParams(GPTool.java:661)
       at pro.javacard.gp.GPTool.main(GPTool.java:507)

Besides, is there any way to set the privileges? Do I have to include them on the params as well?

jlanza commented 9 years ago

I have compile the master and it seems that is working. The former command execution was with the last pre-release. Maybe something weird is there in the exec.

> gp -V
GlobalPlatformPro v0.3.4
Running on Windows 8.1 6.3 amd64, Java 1.8.0_45 by Oracle Corporation

I'm trying to check.

jlanza commented 9 years ago

Error found:

System.arraycopy(newparams, 0, params, 2, params.length);

should be System.arraycopy(params, 0, newparams, 2, params.length);

as you are copying from params to newparams and not the other way around ;)

Actually I think the error has been solved in master branch.

martinpaljak commented 9 years ago

This calls for a release, thanks.