Skip to content

Commit

Permalink
#153: Add tag '9E' before Delete Token
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjohannson committed Mar 27, 2019
1 parent 53b9781 commit 8f2788e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/pro/javacard/gp/DMTokenGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.security.PrivateKey;
import java.security.Signature;

import static pro.javacard.gp.GlobalPlatform.INS_DELETE;

public class DMTokenGenerator {
private static final Logger logger = LoggerFactory.getLogger(DMTokenGenerator.class);
private static final String acceptedSignatureAlgorithm = "SHA1withRSA";
Expand All @@ -23,6 +25,11 @@ public CommandAPDU applyToken(CommandAPDU apdu) {

try {
newData.write(apdu.getData());
if (apdu.getINS() == INS_DELETE || apdu.getINS() == (INS_DELETE & 255)) {
// See GP 2.3.1 Table 11-23
logger.debug("Adding tag 0x9E before Delete Token");
newData.write(0x9E);
}
if (key == null) {
logger.debug("No private key for token generation provided");
newData.write(0); //Token length
Expand Down

0 comments on commit 8f2788e

Please sign in to comment.