Skip to content

Commit

Permalink
Clean up for apdu4j (#205)
Browse files Browse the repository at this point in the history
* Clean up for apdu4j

* remove exit
  • Loading branch information
martinpaljak committed Feb 21, 2020
1 parent 2d4bb36 commit 6347f0f
Show file tree
Hide file tree
Showing 9 changed files with 649 additions and 804 deletions.
17 changes: 0 additions & 17 deletions .project

This file was deleted.

66 changes: 0 additions & 66 deletions build.xml

This file was deleted.

4 changes: 0 additions & 4 deletions ext/README.md

This file was deleted.

16 changes: 5 additions & 11 deletions library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,20 @@
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>apdu4j-core</artifactId>
<version>19.05.08</version>
<version>2020b1</version>
</dependency>
<!-- For CAP file parsing -->
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>capfile</artifactId>
<version>19.03.04</version>
<version>20.02.19</version>
</dependency>
<!-- For logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<!-- For JSON handling -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<!-- For crypto in SCP03 -->
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -48,13 +42,13 @@
<dependency>
<groupId>com.payneteasy</groupId>
<artifactId>ber-tlv</artifactId>
<version>1.0-9</version>
<version>1.0-10</version>
</dependency>
<!-- For tests -->
<!-- For tests -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.martinpaljak</groupId>
<artifactId>metacard</artifactId>
<version>20.01.14</version>
<version>20.02.19</version>
</parent>
<version>20.01.23</version>
<artifactId>gppro</artifactId>
Expand All @@ -25,11 +25,16 @@
<url>https://github.com/martinpaljak/GlobalPlatformPro</url>
<developerConnection>scm:git:[email protected]:martinpaljak/globalplatformpro.git</developerConnection>
</scm>
<repositories>
<repository>
<id>javacard-pro</id>
<url>https://javacard.pro/maven/</url>
</repository>
</repositories>
<modules>
<module>tool</module>
<module>library</module>
</modules>

<build>
<resources>
<resource>
Expand Down
40 changes: 17 additions & 23 deletions tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,46 @@
</parent>

<artifactId>gptool</artifactId>
<name>GlobalPlatformPro CLI tool</name>

<dependencies>
<!-- For PC/SC reader access -->
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>apdu4j-pcsc</artifactId>
<version>19.05.08</version>
<version>20.01.01</version>
</dependency>
<!-- Library -->
<!-- Library itself -->
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>globalplatformpro</artifactId>
<version>20.01.23</version>
</dependency>
<!-- For JSON handling -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<!-- For HTTP handling -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
</dependency>
<!-- For logging in the command line tool -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<optional>true</optional>
</dependency>
<!-- For logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<!-- For command line parsing -->
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>5.0.4</version>
</dependency>
<!-- For lazy plugins -->
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc6</version>
<optional>true</optional>
</dependency>
<!-- For tests -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -122,11 +112,15 @@
<minVersion>1.8.0</minVersion>
</jre>
<versionInfo>
<fileVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${parsedVersion.buildNumber}</fileVersion>
<fileVersion>
${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${parsedVersion.buildNumber}
</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>GlobalPlatformPro</fileDescription>
<copyright>(C) 2015 - 2019 Martin Paljak and contributors (LGPL+MIT)</copyright>
<productVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${parsedVersion.buildNumber}</productVersion>
<productVersion>
${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${parsedVersion.buildNumber}
</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>GlobalPlatformPro</productName>
<internalName>gppro</internalName>
Expand Down
41 changes: 41 additions & 0 deletions tool/src/main/java/pro/javacard/gp/GP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* GlobalPlatformPro - GlobalPlatform tool
*
* Copyright (C) 2015-2020 Martin Paljak, [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
package pro.javacard.gp;

import apdu4j.BIBO;
import apdu4j.i.SmartCardApp;
import com.google.auto.service.AutoService;

/**
* Provides an apdu4j compatible SmartCardApp interface
*/
@AutoService(SmartCardApp.class)
public final class GP implements SmartCardApp {

// Public constructor for service initialization
public GP() {
}

@Override
public int run(BIBO bibo, String[] args) {
return new GPTool().run(bibo, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ abstract class GPCommandLineInterface {
protected final static String OPT_DELETE_KEY = "delete-key";
protected final static String OPT_DOMAIN = "domain";
protected final static String OPT_MOVE = "move";
protected final static String OPT_DUMP = "dump";
protected final static String OPT_EMV = "emv";
protected final static String OPT_FORCE = "force";
protected final static String OPT_INFO = "info";
Expand Down Expand Up @@ -79,7 +78,6 @@ abstract class GPCommandLineInterface {
protected final static String OPT_PUT_KEY = "put-key";
protected final static String OPT_READER = "reader";
protected final static String OPT_RENAME_ISD = "rename-isd";
protected final static String OPT_REPLAY = "replay";
protected final static String OPT_SC_MODE = "mode";
protected final static String OPT_SDAID = "sdaid";
protected final static String OPT_SECURE_APDU = "secure-apdu";
Expand All @@ -89,7 +87,6 @@ abstract class GPCommandLineInterface {
protected final static String OPT_SHA256 = "sha256";
protected final static String OPT_STORE_DATA = "store-data";
protected final static String OPT_STORE_DATA_CHUNK = "store-data-chunk";
protected final static String OPT_TERMINALS = "terminals";
protected final static String OPT_TERMINATE = "terminate";
protected final static String OPT_TODAY = "today";
protected final static String OPT_TO = "to";
Expand All @@ -100,6 +97,7 @@ abstract class GPCommandLineInterface {
protected final static String OPT_VERBOSE = "verbose";
protected final static String OPT_VERSION = "version";
protected final static String OPT_VISA2 = "visa2";
// TODO: extract SEAC to a separate utility
protected final static String OPT_ACR_LIST = "acr-list";
protected final static String OPT_ACR_LIST_ARAM = "acr-list-aram";
protected final static String OPT_ACR_ADD = "acr-add";
Expand All @@ -125,11 +123,6 @@ protected static OptionSet parseArguments(String[] argv) throws IOException {
parser.acceptsAll(Arrays.asList("a", OPT_APDU), "Send raw APDU (hex)").withRequiredArg().describedAs("APDU");
parser.acceptsAll(Arrays.asList("s", OPT_SECURE_APDU), "Send raw APDU (hex) via SCP").withRequiredArg().describedAs("APDU");
parser.acceptsAll(Arrays.asList("f", OPT_FORCE), "Force operation");
parser.accepts(OPT_DUMP, "Dump APDU communication to <File>").withRequiredArg().ofType(File.class);
parser.accepts(OPT_REPLAY, "Replay APDU responses from <File>").withRequiredArg().ofType(File.class);

// Special options
parser.accepts(OPT_TERMINALS, "Use PC/SC provider from <jar:class>").withRequiredArg();

// Applet operation options
parser.accepts(OPT_CAP, "Use a CAP file as source").withRequiredArg().ofType(File.class);
Expand Down
Loading

0 comments on commit 6347f0f

Please sign in to comment.