From cbd719a487362c2641e73889f5727981249e2d5f Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Thu, 23 Apr 2015 11:38:22 +0200 Subject: Infobox decryption for G4 --- smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'smcc') diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java index 027a5b7a..1e337f50 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java @@ -307,11 +307,19 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu if (box.isEncrypted()) { execSELECT_AID(channel, AID_DF_GS); - - execMSE(channel, 0x41, 0xb8, new byte[] { - (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x03, (byte) 0x00, - (byte) 0x80, (byte) 0x01, (byte) 0x81}); + byte[] tlv; + if (generation < 4) + tlv = new byte[] { + (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x03, (byte) 0x00, + (byte) 0x80, (byte) 0x01, (byte) 0x81}; + else + tlv = new byte[] { + (byte) 0x84, (byte) 0x01, (byte) 0x83, + (byte) 0x95, (byte) 0x01, (byte) 0x40, + (byte) 0x80, (byte) 0x01, (byte) 0x10}; + + execMSE(channel, 0x41, 0xb8, tlv); byte[] plainKey = null; -- cgit v1.2.3