aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/Command.java
diff options
context:
space:
mode:
authorpetrs2017-06-16 17:24:48 +0200
committerpetrs2017-06-16 17:24:48 +0200
commit7ab02af142427a996cedf7540ffa3345612fe1bc (patch)
tree058f525742c9af67506bee5a4108c06369c1f3ea /src/cz/crcs/ectester/reader/Command.java
parent359b4bb5be1a822e389e54b9697504f4f0b43d34 (diff)
downloadECTester-7ab02af142427a996cedf7540ffa3345612fe1bc.tar.gz
ECTester-7ab02af142427a996cedf7540ffa3345612fe1bc.tar.zst
ECTester-7ab02af142427a996cedf7540ffa3345612fe1bc.zip
Diffstat (limited to 'src/cz/crcs/ectester/reader/Command.java')
-rw-r--r--src/cz/crcs/ectester/reader/Command.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/reader/Command.java b/src/cz/crcs/ectester/reader/Command.java
index 5b7be01..8cb3a30 100644
--- a/src/cz/crcs/ectester/reader/Command.java
+++ b/src/cz/crcs/ectester/reader/Command.java
@@ -211,6 +211,33 @@ public abstract class Command {
return new Response.Allocate(response, elapsed, keyPair, keyLength, keyClass);
}
}
+
+ public static class AllocateKeyAgreement extends Command {
+
+ private byte kaType;
+
+
+ /**
+ * Creates the INS_ALLOCATE_KA instruction.
+ *
+ * @param cardManager cardManager to send APDU through
+ * @param kaType which type of KeyAgreement to use
+ */
+ protected AllocateKeyAgreement(CardMngr cardManager, byte kaType) {
+ super(cardManager);
+ this.kaType = kaType;
+ byte[] data = new byte[]{kaType};
+ this.cmd = new CommandAPDU(ECTesterApplet.CLA_ECTESTERAPPLET, ECTesterApplet.INS_ALLOCATE_KA, 0x00, 0x00, data);
+ }
+
+ @Override
+ public Response.AllocateKeyAgreement send() throws CardException {
+ long elapsed = -System.nanoTime();
+ ResponseAPDU response = cardManager.send(cmd);
+ elapsed += System.nanoTime();
+ return new Response.AllocateKeyAgreement(response, elapsed, kaType);
+ }
+ }
/**
*