Skip to content

Commit

Permalink
Upgrade apdu4j and include SC code.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Jan 27, 2016
1 parent 8462dab commit a24ac87
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/bcprov-jdk15on-154.jar"/>
<classpathentry kind="lib" path="lib/jopt-simple-4.9.jar"/>
<classpathentry kind="lib" path="lib/bcpkix-jdk15on-154.jar"/>
<classpathentry kind="lib" path="lib/jopt-simple-4.9.jar"/>
<classpathentry kind="lib" path="lib/apdu4j.jar"/>
<classpathentry kind="lib" path="lib/gp.jar"/>
<classpathentry kind="lib" path="lib/vjcre.jar"/>
<classpathentry kind="lib" path="lib/FakeEstEID.jar"/>
Expand Down
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<get src="http://repo2.maven.org/maven2/org/slf4j/slf4j-simple/1.7.13/slf4j-simple-1.7.13.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://downloads.bouncycastle.org/java/bcprov-jdk15on-154.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="http://downloads.bouncycastle.org/java/bcpkix-jdk15on-154.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/apdu4j/releases/download/v0.0.15/apdu4j.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/apdu4j/releases/download/v0.0.27/apdu4j.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/GlobalPlatformPro/releases/download/v0.3.5/gp.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/vJCRE/releases/download/r1/vjcre.jar" dest="lib" verbose="true" skipexisting="true"/>
<get src="https://github.com/martinpaljak/esteid-applets/releases/download/v0.0.2/FakeEstEID.jar" dest="lib" verbose="true" skipexisting="true"/>
Expand All @@ -19,7 +19,7 @@
<checksum algorithm="SHA-256" file="lib/slf4j-simple-1.7.13.jar" property="4709c0b535057c6a9a794da9522b1291de9c72b6d61f41b7ecf63156bc7bee35" verifyProperty="slfjsimpleOK"/>
<checksum algorithm="SHA-256" file="lib/bcprov-jdk15on-154.jar" property="d0ae14598f9c528d2ab7bb8ed00e785a5440f692712cd362d69328aba25efb57" verifyProperty="bouncy1OK"/>
<checksum algorithm="SHA-256" file="lib/bcpkix-jdk15on-154.jar" property="d618dcfbf0337b91015b21d4b398175ae96382a82c7e1d6e8c657fcd236463c7" verifyProperty="bouncy2OK"/>
<checksum algorithm="SHA-256" file="lib/apdu4j.jar" property="d47ccc62324c2fcad1183596d77b2e6478f6136a8bf4c4b631fbc70ec3d659c2" verifyProperty="apduOK"/>
<checksum algorithm="SHA-256" file="lib/apdu4j.jar" property="be34feccb5bb654683e833e8079cb8d3d17925569caed28eeab25bdaa73dbaeb" verifyProperty="apduOK"/>
<checksum algorithm="SHA-256" file="lib/gp.jar" property="cbe9ba8a198b434aa63c5266f3f30302ab0b174d46fc94a35e46a08ed7a9ef9f" verifyProperty="gpOK"/>
<checksum algorithm="SHA-256" file="lib/vjcre.jar" property="20260d4c63d54eba540eb6eee931b9bff9df0ad97823841848126ea36c04e6b4" verifyProperty="vjcreOK"/>
<checksum algorithm="SHA-256" file="lib/FakeEstEID.jar" property="c6387f4750c286e3faf566bfac6acd53f46c327ee60f22e796700939c14bf2f5" verifyProperty="appletOK"/>
Expand Down
21 changes: 9 additions & 12 deletions src/esteidhacker/EstEID.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
Expand All @@ -34,10 +34,7 @@
import java.util.HashMap;
import java.util.Map;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.smartcardio.ATR;
import javax.smartcardio.Card;
import javax.smartcardio.CardChannel;
Expand Down Expand Up @@ -159,19 +156,19 @@ public byte getRec() {
public final static int chunksize = 250;

// original cold
public final static ATR micardo_cold_atr = new ATR(HexUtils.decodeHexString("3bfe9400ff80b1fa451f034573744549442076657220312e3043"));
public final static ATR micardo_cold_atr = new ATR(HexUtils.hex2bin("3bfe9400ff80b1fa451f034573744549442076657220312e3043"));
// original warm
public final static ATR micardo_warm_atr = new ATR(HexUtils.decodeHexString("3b6e00ff4573744549442076657220312e30"));
public final static ATR micardo_warm_atr = new ATR(HexUtils.hex2bin("3b6e00ff4573744549442076657220312e30"));
// 2006 update cold
public final static ATR micardo_2006_cold_atr = new ATR(HexUtils.decodeHexString("3bde18ffc080b1fe451f034573744549442076657220312e302b"));
public final static ATR micardo_2006_cold_atr = new ATR(HexUtils.hex2bin("3bde18ffc080b1fe451f034573744549442076657220312e302b"));
// 2006 update warm
public final static ATR micardo_2006_warm_atr = new ATR(HexUtils.decodeHexString("3b5e11ff4573744549442076657220312e30"));
public final static ATR micardo_2006_warm_atr = new ATR(HexUtils.hex2bin("3b5e11ff4573744549442076657220312e30"));
// DigiID cold. Warm is the same original cold above.
public final static ATR digiid_cold_atr = new ATR(HexUtils.decodeHexString("3b6e00004573744549442076657220312e30"));
public final static ATR digiid_cold_atr = new ATR(HexUtils.hex2bin("3b6e00004573744549442076657220312e30"));
// 2011 cold
public final static ATR javacard_2011_cold_atr = new ATR(HexUtils.decodeHexString("3bfe1800008031fe454573744549442076657220312e30a8"));
public final static ATR javacard_2011_cold_atr = new ATR(HexUtils.hex2bin("3bfe1800008031fe454573744549442076657220312e30a8"));
// 2011 warm
public final static ATR javacard_2011_warm_atr = new ATR(HexUtils.decodeHexString("3bfe1800008031fe45803180664090a4162a00830f9000ef"));
public final static ATR javacard_2011_warm_atr = new ATR(HexUtils.hex2bin("3bfe1800008031fe45803180664090a4162a00830f9000ef"));

// Card identification
// AID of modern JavaCard app (FakeEstEID et al) National prefix of Estonia + "EstEID v3.5"
Expand Down Expand Up @@ -573,7 +570,7 @@ public void crypto_tests(String pin1, String pin2) throws WrongPINException, Car
} else {
System.out.println("ENCRYPT: OK");
}
} catch (InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException e) {
} catch (GeneralSecurityException e) {
System.out.println("FAILURE");
}
}
Expand Down
Loading

0 comments on commit a24ac87

Please sign in to comment.