Skip to content

Commit

Permalink
Make .exe build with a profile
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Apr 3, 2024
1 parent ff126fe commit f0531ff
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
2 changes: 1 addition & 1 deletion library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>capfile</artifactId>
<version>23.08.29</version>
<version>24.03.15</version>
</dependency>
<!-- For logging -->
<dependency>
Expand Down
10 changes: 7 additions & 3 deletions library/src/main/java/pro/javacard/gp/GPCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
// Middle layer between GPTool (CLI) and GlobalPlatform (session)
public class GPCommands {

private GPCommands() {}
private GPCommands() {
}

private static void storeDGI(GPSession gp, byte[] payload) throws GPException, IOException {
// Single DGI. 0x90 should work as well but 0x80 is actually respected by cards.
CommandAPDU cmd = new CommandAPDU(GPSession.CLA_GP, GPSession.INS_STORE_DATA, 0x80, 0x00, payload);
Expand Down Expand Up @@ -135,12 +137,14 @@ public static void load(GPSession gp, CAPFile cap, AID to, AID dapAID, LFDBH has

final byte[] dap;
if (dapRequired) {
if (1 == 1) throw new IllegalArgumentException("Broken code, see #304");
// FIXME: see #304
switch (lfdbh) {
case SHA1:
dap = cap.getMetaInfEntry(CAPFile.DAP_RSA_V1_SHA1_FILE);
dap = new byte[128]; //cap.getMetaInfEntry(CAPFile.DAP_RSA_V1_SHA1_FILE);
break;
case SHA256:
dap = cap.getMetaInfEntry(CAPFile.DAP_RSA_V1_SHA256_FILE);
dap = new byte[128]; // cap.getMetaInfEntry(CAPFile.DAP_RSA_V1_SHA256_FILE);
break;
default:
throw new IllegalArgumentException("Unsupported DAP hash algorithm: " + hash);
Expand Down
2 changes: 1 addition & 1 deletion 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>23.09.14</version>
<version>24.03.29</version>
</parent>
<version>23.08.10-SNAPSHOT</version>
<artifactId>gppro</artifactId>
Expand Down
3 changes: 3 additions & 0 deletions spotbugs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<Match>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
</Match>
<Match>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
<Match>
<Class name="pro.javacard.gp.HexBytes"/>
<Bug pattern="EI_EXPOSE_REP"/>
Expand Down
107 changes: 59 additions & 48 deletions tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,67 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.15.2</version>
<version>2.17.0</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>exe</id>
<build>
<plugins>
<!-- Call windows version number mangler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<!-- Package for Windows -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>gp-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/gp.exe</outfile>
<jar>target/gp.jar</jar>
<errTitle>GlobalPlatformPro</errTitle>
<classPath>
<mainClass>pro.javacard.gptool.GPTool</mainClass>
</classPath>
<jre>
<path>./</path>
<minVersion>11</minVersion>
</jre>
<versionInfo>
<fileVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>GlobalPlatformPro</fileDescription>
<copyright>(C) 2015 - 2023 Martin Paljak and contributors (LGPL+MIT)</copyright>
<productVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>GlobalPlatformPro</productName>
<internalName>gppro</internalName>
<originalFilename>gp.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -102,53 +160,6 @@
</execution>
</executions>
</plugin>
<!-- Call windows version number mangler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<!-- Package for Windows -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>gp-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/gp.exe</outfile>
<jar>target/gp.jar</jar>
<errTitle>GlobalPlatformPro</errTitle>
<classPath>
<mainClass>pro.javacard.gptool.GPTool</mainClass>
</classPath>
<jre>
<path>./</path>
<minVersion>11</minVersion>
</jre>
<versionInfo>
<fileVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>GlobalPlatformPro</fileDescription>
<copyright>(C) 2015 - 2023 Martin Paljak and contributors (LGPL+MIT)</copyright>
<productVersion>
${windowsVersion.majorVersion}.${windowsVersion.minorVersion}.${windowsVersion.incrementalVersion}.${windowsVersion.buildNumber}
</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>GlobalPlatformPro</productName>
<internalName>gppro</internalName>
<originalFilename>gp.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<!-- Reproducible -->
<plugin>
<groupId>io.github.zlika</groupId>
Expand Down

0 comments on commit f0531ff

Please sign in to comment.