TestApplet: include object deletion test

This commit is contained in:
Arnaud Fontaine
2021-12-20 15:02:15 +01:00
parent 1720a3494b
commit c2d7070f2d
3 changed files with 25 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ public final class Data {
public static final byte INS_TEST_RSA_CRT = (byte)0x02;
public static final byte INS_TEST_EC = (byte)0x03;
public static final byte INS_TEST_PIN = (byte)0x04;
public static final byte INS_TEST_DELETION = (byte)0x05;
public static final short SW_FAILED_TO_BUILD_PRIV_KEY = (short)0x6500;
public static final short SW_FAILED_TO_BUILD_PUB_KEY = (short)0x6501;
@@ -15,6 +16,7 @@ public final class Data {
public static final short SW_PUB_KEY_NOT_INITIALIZED = (short)0x6503;
public static final short SW_PIN_INVALID = (short)0x6504;
public static final short SW_PIN_EMPTY = (short)0x6505;
public static final short SW_DELETION_NOT_SUPPORTED = (short)0x6506;
public static final short BUFFER_RED_LENGTH = (short)0x200;
public static final short BUFFER_BLACK_LENGTH = (short)0x200;

View File

@@ -341,6 +341,13 @@ public final class TestApplet extends Applet {
}
}
private final void processDeletion() {
if(!JCSystem.isObjectDeletionSupported()) {
ISOException.throwIt(Data.SW_DELETION_NOT_SUPPORTED);
}
JCSystem.requestObjectDeletion();
}
public final void process(final APDU apdu) {
final byte[] apdubuf = apdu.getBuffer();
@@ -376,6 +383,10 @@ public final class TestApplet extends Applet {
}
break;
case Data.INS_TEST_DELETION:
processDeletion();
break;
default:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
return;