diff options
| author | petrs | 2016-09-09 13:29:40 +0200 |
|---|---|---|
| committer | petrs | 2016-09-09 13:29:40 +0200 |
| commit | d6facb0862b34233ea820eb72a30d4905c06115a (patch) | |
| tree | 4f9b3bb2fe65b180900db41eda26dc5fa96d7d5b | |
| parent | fbb105bee9c6a298e4a2f03a67524a2515b6a310 (diff) | |
| download | ECTester-d6facb0862b34233ea820eb72a30d4905c06115a.tar.gz ECTester-d6facb0862b34233ea820eb72a30d4905c06115a.tar.zst ECTester-d6facb0862b34233ea820eb72a30d4905c06115a.zip | |
| -rw-r--r-- | !uploader/simpleECC.cap | bin | 8240 -> 8364 bytes | |||
| -rw-r--r-- | dist/SimpleAPDU.jar | bin | 19404 -> 40209 bytes | |||
| -rw-r--r-- | src/applets/SimpleECCApplet.java | 27 | ||||
| -rw-r--r-- | src/simpleapdu/SimpleAPDU.java | 9 |
4 files changed, 28 insertions, 8 deletions
diff --git a/!uploader/simpleECC.cap b/!uploader/simpleECC.cap Binary files differindex d347378..151531f 100644 --- a/!uploader/simpleECC.cap +++ b/!uploader/simpleECC.cap diff --git a/dist/SimpleAPDU.jar b/dist/SimpleAPDU.jar Binary files differindex 075aed2..2d0df98 100644 --- a/dist/SimpleAPDU.jar +++ b/dist/SimpleAPDU.jar diff --git a/src/applets/SimpleECCApplet.java b/src/applets/SimpleECCApplet.java index b9fd347..bdda52f 100644 --- a/src/applets/SimpleECCApplet.java +++ b/src/applets/SimpleECCApplet.java @@ -20,7 +20,8 @@ public class SimpleECCApplet extends javacard.framework.Applet final static byte INS_ALLOCATEKEYPAIR = (byte) 0x5c; final static byte INS_DERIVEECDHSECRET = (byte) 0x5d; - final static byte INS_TESTECSUPPORTALL = (byte) 0x5e; + final static byte INS_TESTECSUPPORTALL_FP = (byte) 0x5e; + final static byte INS_TESTECSUPPORTALL_F2M = (byte) 0x5f; @@ -135,8 +136,11 @@ public class SimpleECCApplet extends javacard.framework.Applet if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEECCAPPLET) { switch ( apduBuffer[ISO7816.OFFSET_INS] ) { - case INS_TESTECSUPPORTALL: - TestECSupportAllLengths(apdu); + case INS_TESTECSUPPORTALL_FP: + TestEC_FP_SupportAllLengths(apdu); + break; + case INS_TESTECSUPPORTALL_F2M: + TestEC_F2M_SupportAllLengths(apdu); break; case INS_ALLOCATEKEYPAIR: AllocateKeyPairReturnDefCourve(apdu); @@ -453,12 +457,12 @@ public class SimpleECCApplet extends javacard.framework.Applet return (short) (bufferOffset - baseOffset); } - void TestECSupportAllLengths(APDU apdu) { + void TestEC_FP_SupportAllLengths(APDU apdu) { byte[] apdubuf = apdu.getBuffer(); short len = apdu.setIncomingAndReceive(); short dataOffset = 0; - // FP - + // FP dataOffset += TestECSupport(KeyPair.ALG_EC_FP, (short) 128, apdubuf, dataOffset); dataOffset += TestECSupport(KeyPair.ALG_EC_FP, (short) 160, apdubuf, dataOffset); dataOffset += TestECSupport(KeyPair.ALG_EC_FP, (short) 192, apdubuf, dataOffset); @@ -469,6 +473,19 @@ public class SimpleECCApplet extends javacard.framework.Applet apdu.setOutgoingAndSend((short) 0, dataOffset); } + void TestEC_F2M_SupportAllLengths(APDU apdu) { + byte[] apdubuf = apdu.getBuffer(); + short len = apdu.setIncomingAndReceive(); + + short dataOffset = 0; + // F2M + dataOffset += TestECSupport(KeyPair.ALG_EC_F2M, (short) 113, apdubuf, dataOffset); + dataOffset += TestECSupport(KeyPair.ALG_EC_F2M, (short) 131, apdubuf, dataOffset); + dataOffset += TestECSupport(KeyPair.ALG_EC_F2M, (short) 163, apdubuf, dataOffset); + dataOffset += TestECSupport(KeyPair.ALG_EC_F2M, (short) 193, apdubuf, dataOffset); + + apdu.setOutgoingAndSend((short) 0, dataOffset); + } diff --git a/src/simpleapdu/SimpleAPDU.java b/src/simpleapdu/SimpleAPDU.java index 428d4f4..72abcf9 100644 --- a/src/simpleapdu/SimpleAPDU.java +++ b/src/simpleapdu/SimpleAPDU.java @@ -27,7 +27,8 @@ public class SimpleAPDU { private static byte GENERATEKEY[] = {(byte) 0xB0, (byte) 0x5A, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00}; private static byte RESPONDDATA[] = {(byte) 0xB0, (byte) 0x5B, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x30}; - private static byte TESTECSUPPORTALL[] = {(byte) 0xB0, (byte) 0x5E, (byte) 0x00, (byte) 0x00, (byte) 0x00}; + private static byte TESTECSUPPORTALL_FP[] = {(byte) 0xB0, (byte) 0x5E, (byte) 0x00, (byte) 0x00, (byte) 0x00}; + private static byte TESTECSUPPORTALL_F2M[] = {(byte) 0xB0, (byte) 0x5F, (byte) 0x00, (byte) 0x00, (byte) 0x00}; static short getShort(byte[] array, int offset) { return (short) (((array[offset] & 0xFF) << 8) | (array[offset + 1] & 0xFF)); @@ -71,8 +72,10 @@ public class SimpleAPDU { // Select our application on card cardManager.sendAPDU(SELECT_SIMPLEAPPLET); - ResponseAPDU resp = cardManager.sendAPDU(TESTECSUPPORTALL); - PrintECSupport(resp); + ResponseAPDU resp_fp = cardManager.sendAPDU(TESTECSUPPORTALL_FP); + ResponseAPDU resp_f2m = cardManager.sendAPDU(TESTECSUPPORTALL_F2M); + PrintECSupport(resp_fp); + PrintECSupport(resp_f2m); cardManager.DisconnectFromCard(); } else { |
