Created
July 13, 2018 10:00
-
-
Save benbenbenbenbenben/cfe31b2f6abb38bdf503b4679d783d9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.tsenger.u2f; | |
import javacard.framework.APDU; | |
import javacard.framework.Applet; | |
import javacard.framework.ISO7816; | |
public class AcosJPatch { | |
public static short getOffsetCdata(APDU apdu) { | |
byte[] buffer = apdu.getBuffer(); | |
short offset = apdu.getOffsetCdata(); | |
if (offset == ISO7816.OFFSET_EXT_CDATA) { | |
try { | |
short lc = apdu.getIncomingLength(); | |
short blc = (short)(0x00FF & buffer[ISO7816.OFFSET_LC]); | |
if (lc <= 0xFF) { | |
if (blc == lc) { | |
return ISO7816.OFFSET_CDATA; | |
} | |
} | |
} finally { | |
// nothing to do | |
} | |
return ISO7816.OFFSET_EXT_CDATA; | |
} else { | |
return ISO7816.OFFSET_CDATA; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment