From bdfe17606f77fa22300057ed212c9e9a8a57e10e Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 14 Apr 2021 18:05:34 +0200 Subject: [PATCH] Fix ACTIVATE FILE when APDU is received over a logical channel. --- src/fr/anssi/smartpgp/Constants.java | 1 + src/fr/anssi/smartpgp/SmartPGPApplet.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fr/anssi/smartpgp/Constants.java b/src/fr/anssi/smartpgp/Constants.java index 2c4c57f..9887a50 100644 --- a/src/fr/anssi/smartpgp/Constants.java +++ b/src/fr/anssi/smartpgp/Constants.java @@ -112,6 +112,7 @@ public final class Constants { protected static final byte CRT_TAG_DECRYPTION_KEY = (byte)0xb8; protected static final byte CLA_MASK_CHAINING = (byte)0x10; + protected static final byte CLA_MASK_CHANNEL = (byte)0xFC; protected static final byte INS_SELECT_DATA = (byte)0xA5; diff --git a/src/fr/anssi/smartpgp/SmartPGPApplet.java b/src/fr/anssi/smartpgp/SmartPGPApplet.java index e1da35a..1a17103 100644 --- a/src/fr/anssi/smartpgp/SmartPGPApplet.java +++ b/src/fr/anssi/smartpgp/SmartPGPApplet.java @@ -1460,7 +1460,7 @@ public final class SmartPGPApplet extends Applet { } if(data.isTerminated) { - if(apdubuf[ISO7816.OFFSET_CLA] != 0) { + if((apdubuf[ISO7816.OFFSET_CLA] & Constants.CLA_MASK_CHANNEL) != 0) { ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); return; }