Skip to content

Instantly share code, notes, and snippets.

@Franzaine
Created October 11, 2015 20:22
Show Gist options
  • Save Franzaine/f6f14361eb4132799bc7 to your computer and use it in GitHub Desktop.
Save Franzaine/f6f14361eb4132799bc7 to your computer and use it in GitHub Desktop.
Fetching APDU for generating TOTP code
protected void communicateWithCard(IsoCard isoCard) {
try {
isoCard.connect();
Apdu.transceiveAndRequireOk(Apdu.select(OTP_AID), isoCard);
setMainMessage("Select OK");
long timeStamp = getTimeStamp();
byte[] totpCodeApdu = Otp.totpCodeApdu(TOTP_CODE_NAME, timeStamp);
isoCard.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment