Fields Summary |
---|
public static final int | WRONG_DIR_FILEWrong DIR file status code |
public static final int | SUCCESSSuccess status code |
public static final int | AID_NOT_FOUNDAID is not found status code |
public static final int | ROOT_NOT_SELECTEDRoot is not selected status code |
byte[] | PKCS_AIDThe PKCS15 application AID (according to pkcs15 spec. |
short[] | DIR_FILEThe PKCS15 DIR file name |
public static final int | APPLICATIONASN application specific flag used in types (0x40). |
public static final int | APP_CONSTRUCTED_0ASN application specific constructed flag used in types (0x60). |
public static final int | APP_PRIMITIVE_0ASN application specific primitive flag |
public static final int | APP_CONSTRUCTED_1ASN application specific constructed flag used in types (0x60). |
public static final int | APP_PRIMITIVE_15ASN application specific flag for [APPLICATION 15] (aid) |
public static final int | APP_PRIMITIVE_16ASN application specific flag for [APPLICATION 16] (label) |
public static final int | APP_PRIMITIVE_17ASN application specific flag for [APPLICATION 17] (path) |
public static final int | APP_CONSTRUCTED_19ASN application specific flag for [APPLICATION 19] (ddo) |
private Vector | DIRThis vector contains parsed objects from DIR |
Methods Summary |
---|
private TLV | getApp(byte[] aid)Seeks record in the DIR file according to the pointed AID
TLV root = (TLV) DIR.firstElement();
if (root.type != APP_CONSTRUCTED_1) {
throw new TLVException("The first tag shall be APPLICATION 1");
}
while (root != null) {
TLV t = root.child; /* APP_PRIMITIVE_15 */
if (t.type != APP_PRIMITIVE_15) {
throw new TLVException(
"The first tag shall be APPLICATION 15 (AID)");
}
if (Utils.byteMatch(aid, t.getValue())) {
return root;
}
root = root.next;
}
return null;
|
public void | load()Reads DIR .
DIR = new Vector();
resetLoader(DIR, null, null);
parseDF(DIR_FILE);
|
public int | setPKCSRoot()Sets a root for the PKCS15 application
return setRoot(PKCS_AID);
|
public int | setRoot(byte[] aid)Sets a root for the application with the pointed AID
TLV root;
try {
root = getApp(aid);
} catch (TLVException e) {
return WRONG_DIR_FILE;
}
if (root == null) {
return AID_NOT_FOUND;
}
TLV t = root.child; /* AID */
/* Find the path item */
while ((t != null) && (t.type != APP_PRIMITIVE_17)) {
t = t.next;
}
if (t == null) {
return WRONG_DIR_FILE;
}
byte[] pth = t.getValue();
short[] path = new short[pth.length / 2];
for (int i = 0; i < pth.length; i = i+2) {
path[i/2] = Utils.getShort(pth, i);
}
try {
files.selectRoot(path);
} catch (IOException ie) {
return ROOT_NOT_SELECTED;
}
return SUCCESS;
|