aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/response/Response.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cz/crcs/ectester/reader/response/Response.java')
-rw-r--r--src/cz/crcs/ectester/reader/response/Response.java80
1 files changed, 79 insertions, 1 deletions
diff --git a/src/cz/crcs/ectester/reader/response/Response.java b/src/cz/crcs/ectester/reader/response/Response.java
index 4814e41..235564e 100644
--- a/src/cz/crcs/ectester/reader/response/Response.java
+++ b/src/cz/crcs/ectester/reader/response/Response.java
@@ -79,6 +79,10 @@ public abstract class Response {
return resp;
}
+ public byte[] getData() {
+ return resp.getData();
+ }
+
public long getDuration() {
return time;
}
@@ -304,7 +308,7 @@ public abstract class Response {
if (pair == keyPair && param == mask) {
return index;
}
- if ((parameters & mask) != 0 && (pair & keyPair) != 0) {
+ if ((parameters & mask) != 0 && (pair & this.keyPair) != 0) {
if (mask == EC_Consts.PARAMETER_W) {
if ((key & EC_Consts.KEY_PUBLIC) != 0)
index++;
@@ -424,4 +428,78 @@ public abstract class Response {
parse(1, 0);
}
}
+
+ /**
+ *
+ */
+ public static class GetInfo extends Response {
+ private short base;
+ private short jcVersion;
+ private short cleanupSupport;
+ private short apduBufferLength;
+ private short ramArrayLength;
+ private short ramArray2Length;
+ private short apduArrayLength;
+
+ public GetInfo(ResponseAPDU response, String description, long time) {
+ super(response, description, time);
+
+ parse(1, 1);
+ int offset = 2 + 2 + getParamLength(0);
+ byte[] data = getData();
+ base = ByteUtil.getShort(data, offset);
+ offset += 2;
+ jcVersion = ByteUtil.getShort(data, offset);
+ offset += 2;
+ cleanupSupport = ByteUtil.getShort(data, offset);
+ offset += 2;
+ apduBufferLength = ByteUtil.getShort(data, offset);
+ offset += 2;
+ ramArrayLength = ByteUtil.getShort(data, offset);
+ offset += 2;
+ ramArray2Length = ByteUtil.getShort(data, offset);
+ offset += 2;
+ apduArrayLength = ByteUtil.getShort(data, offset);
+ }
+
+ public String getVersion() {
+ return new String(getParam(0));
+ }
+
+ public short getBase() {
+ return base;
+ }
+
+ public float getJavaCardVersion() {
+ byte major = (byte) (jcVersion >> 8);
+ byte minor = (byte) (jcVersion & 0xff);
+ int minorSize;
+ if (minor == 0) {
+ minorSize = 1;
+ } else {
+ minorSize = (int) Math.ceil(Math.log10(minor));
+ }
+ return (major + ((float) (minor) / (minorSize * 10)));
+ }
+
+ public boolean getCleanupSupport() {
+ return cleanupSupport == 1;
+ }
+
+ public short getApduBufferLength() {
+ return apduBufferLength;
+ }
+
+ public short getRamArrayLength() {
+ return ramArrayLength;
+ }
+
+ public short getRamArray2Length() {
+ return ramArray2Length;
+ }
+
+ public short getApduArrayLength() {
+ return apduArrayLength;
+ }
+ }
}