Giter VIP home page Giter VIP logo

Comments (5)

martinpaljak avatar martinpaljak commented on May 29, 2024

Please follow the CONTRIBUTING guide and send issues with --debug flag added to any failing commands

from globalplatformpro.

blschatz avatar blschatz commented on May 29, 2024

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.

martinpaljak avatar martinpaljak commented on May 29, 2024

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.

martinpaljak avatar martinpaljak commented on May 29, 2024

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.

martinpaljak avatar martinpaljak commented on May 29, 2024

Anyway, the current trunk should work without key tempates (like afresh SSD)

from globalplatformpro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.