Comments (5)
Please follow the CONTRIBUTING guide and send issues with --debug
flag added to any failing commands
from globalplatformpro.
Dear Martin,
Thanks for the response. I can do one better. Please see the patch below fixing the issue.
Kind regards,
Bradley
diff --git a/src/pro/javacard/gp/GlobalPlatform.java b/src/pro/javacard/gp/GlobalPlatform.java
index 4a389c6..f2e1645 100644
--- a/src/pro/javacard/gp/GlobalPlatform.java
+++ b/src/pro/javacard/gp/GlobalPlatform.java
@@ -942,22 +942,27 @@
// Check if factory keys
List tmpl = getKeyInfoTemplate();
-
if ((tmpl.get(0).getVersion() < 1 || tmpl.get(0).getVersion() > 0x7F) && replace) {
-
printStrictWarning("Trying to replace factory keys, when you need to add new ones? Is this a virgin card? (use --virgin)");
-
}
-
if (tmpl.size() > 0) {
-
// Only do the following if we actually have key info templates.
-
// Feitian eJava cards are shipped without keys using the FF version. No keys, no key info templates.
-
// Check if key types and lengths are the same when replacing
-
if (replace && (keys.get(0).getType() != tmpl.get(0).getType() || keys.get(0).getLength() != tmpl.get(0).getLength())) {
-
throw new IllegalArgumentException("Can not replace keys of different type or size.");
-
}
-
if ((tmpl.get(0).getVersion() < 1 || tmpl.get(0).getVersion() > 0x7F) && replace) {
-
printStrictWarning("Trying to replace factory keys, when you need to add new ones? Is this a virgin card? (use --virgin)");
-
}
-
// Check for matching version numbers if replacing and vice versa
-
if (!replace && (keys.get(0).getVersion() == tmpl.get(0).getVersion())) {
-
throw new IllegalArgumentException("Not adding keys and version matches existing?");
-
}
-
// Check if key types and lengths are the same when replacing
-
if (replace && (keys.get(0).getType() != tmpl.get(0).getType() || keys.get(0).getLength() != tmpl.get(0).getLength())) {
-
throw new IllegalArgumentException("Can not replace keys of different type or size.");
-
}
-
if (replace && (keys.get(0).getVersion() != tmpl.get(0).getVersion())) {
-
throw new IllegalArgumentException("Replacing keys and versions don't match existing?");
-
// Check for matching version numbers if replacing and vice versa
-
if (!replace && (keys.get(0).getVersion() == tmpl.get(0).getVersion())) {
-
throw new IllegalArgumentException("Not adding keys and version matches existing?");
-
}
+ -
if (replace && (keys.get(0).getVersion() != tmpl.get(0).getVersion())) {
-
throw new IllegalArgumentException("Replacing keys and versions don't match existing?");
-
}
}// Construct APDU
Dr Bradley Schatz | Forensic computer scientist
PhD (Digital Forensics), BSc (Computer Science)
Director, Schatz Forensic Pty. Ltd.
p: 1 300 364 101 | f: +61 7 3301 1843 | m: +61 422 949 039 | direct: +61 7 3613 0082
e: [email protected] | p: PO Box 15972, City East, Brisbane, QLD 4002
w: www.schatzforensic.com.au
pgp key id: 0x90CD5BCB
pgp fingerprint:0x04032D097976A32C74709246DC0B21CC90CD5BCB
This email message and any attached files may contain information that is confidential and subject of legal privilege intended only for use by the individual or entity to whom they are addressed. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient be advised that you have received this message in error and that any use, copying, circulation, forwarding, printing or publication of this message or attached files is strictly forbidden, as is the disclosure of the information contained therein. If you have received this message in error, please notify the sender immediately and delete it from your Inbox.
When communicating by email you consent to the monitoring and recording of that correspondence. We employ anti-virus software, however we cannot guarantee that this communication is virus free and recommend you test it before opening. The content expressed in this email is general comment only and is not legally binding until presented in a proper written format with relevant letterhead and other information.
From: Martin Paljak <[email protected]mailto:[email protected]>
Reply-To: martinpaljak/GlobalPlatformPro <[email protected]mailto:[email protected]>
Date: Friday, 31 July 2015 2:53 am
To: martinpaljak/GlobalPlatformPro <[email protected]mailto:[email protected]>
Cc: Bradley Schatz <[email protected]mailto:[email protected]>
Subject: Re: [GlobalPlatformPro] Lock fails for Fetian Java Token (#26)
Please follow the CONTRIBUTING guide and send issues with --debug flag added to any failing commands
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-126400371.
from globalplatformpro.
Please file a proper pull request and mark the "strange" part with XXX. The way I read GP specs those cards are misbehaving - you do authenticate to the card and thus there must be keys (and key templates) on the card.
from globalplatformpro.
Also, I don't have the issue with my eJava token, as that does have key template information. What device exactly are you using ?
from globalplatformpro.
Anyway, the current trunk should work without key tempates (like afresh SSD)
from globalplatformpro.
Related Issues (20)
- CLI 'put-key' option gives error with joptsimple.OptionArgumentConversionException error HOT 2
- Request: add option to not reset card at end of invocation
- Running on m1 mac results in error "jnasmartcardio not bundled" HOT 2
- Deletion not allowed. Some app still active? - is it possible to delete a package or an applet HOT 4
- zsh: command not found: gp HOT 1
- Fix latest release links on the project website https://javacard.pro/globalplatform/ HOT 3
- DAP signature key option
- Creation of SSD fails with 0x6A80 HOT 2
- Installing applet to newly created SSD fails with 0x6985 (Conditions of use not satisfied)
- IllegalArgumentException when using CLI HOT 5
- --set-pre-perso and -set-perso not working because of wrong P1 in storeDGI in Infineon card. HOT 3
- globalplatform PRO tool putkey command usage example with sCp03
- SCP02: extended length APDUs cause an IllegalArgumentException HOT 4
- Relationship between GlobalPlatform and GlobalPlatformPro
- Too long list of installed applets causes IllegalStateException: Length is out of the range (older gppro v0.3.4 works) HOT 5
- GP for Android HOT 1
- Make .exe build conditional with a profile
- [Thales MAV5.0-5.1 Java Card OS] Failed to Open Secure Channel, Card Cryptogram Invalid!
- Proper documentation
- JCOP4 - INSTALL [for install and make selectable] failed: 0xFFD1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from globalplatformpro.