From 1364e2f0ee1fd80972e67f29d08a4fa4fb8c8e17 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Sun, 10 Oct 2021 00:26:39 +0200 Subject: [PATCH 1/3] Use maven-antrun-plugin 3.0.0, to be able to build with more recent jdk versions (jdk 11+ doesn't contain tools.jar). --- pom.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index bb4b3da6..917ba819 100644 --- a/pom.xml +++ b/pom.xml @@ -389,15 +389,8 @@ org.apache.maven.plugins maven-antrun-plugin - 1.8 + 3.0.0 - - com.sun - tools - 1.5.0 - system - ${java.home}/../lib/tools.jar - org.apache.ant ant-junit From 939d060eee3df0292a6fe71ed42f75a7767ec431 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Fri, 15 Oct 2021 11:21:14 +0200 Subject: [PATCH 2/3] Fix indentation --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 917ba819..44ff0e71 100644 --- a/pom.xml +++ b/pom.xml @@ -389,7 +389,7 @@ org.apache.maven.plugins maven-antrun-plugin - 3.0.0 + 3.0.0 org.apache.ant From ff1b4d934b24e635cb56322ec47ec7a19bebb38e Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Sun, 17 Oct 2021 19:38:56 +0200 Subject: [PATCH 3/3] Allow changing of data size in ByteContainer.setBytes(byte[], short, short). The motivation for this patch is https://github.com/ANSSI-FR/SmartPGP/issues/40. However, this workaround avoids looking at the underlying problem: ECKeyImpl(byte, short) should not initialize the DomainParameters (according to its own docs), but does. This leads to problems with NIST P-521 because the default parameter for b has a leading zero bit that gets stripped, leading to a change in data size, when SmartPGP later sets b explicitly with the leading zero bit intact. --- src/main/java/com/licel/jcardsim/crypto/ByteContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/licel/jcardsim/crypto/ByteContainer.java b/src/main/java/com/licel/jcardsim/crypto/ByteContainer.java index 240fb74f..7d4a8ef3 100644 --- a/src/main/java/com/licel/jcardsim/crypto/ByteContainer.java +++ b/src/main/java/com/licel/jcardsim/crypto/ByteContainer.java @@ -106,7 +106,7 @@ public void setBytes(byte[] buff) { * @param length length of data in byte array */ public void setBytes(byte[] buff, short offset, short length) { - if (data == null) { + if (data == null || this.length != length) { switch (memoryType) { case JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT: data = JCSystem.makeTransientByteArray(length, JCSystem.CLEAR_ON_DESELECT);