use of com.android.internal.telephony.uicc.UiccCarrierPrivilegeRules.TLV in project android_frameworks_opt_telephony by LineageOS.
the class UiccPkcs15 method parseAcrf.
// parse ACRF file to get file id for ACCF file
// data is hex string, return file id if parse success, null otherwise
private String parseAcrf(String data) {
String ret = null;
String acRules = data;
while (!acRules.isEmpty()) {
TLV tlvRule = new TLV(TAG_ASN_SEQUENCE);
try {
acRules = tlvRule.parse(acRules, false);
String ruleString = tlvRule.getValue();
if (ruleString.startsWith(TAG_TARGET_AID)) {
// rule string consists of target AID + path, example:
// [A0] 08 [04] 06 FF FF FF FF FF FF [30] 04 [04] 02 43 10
// bytes in [] are tags for the data
// A0
TLV tlvTarget = new TLV(TAG_TARGET_AID);
// 04
TLV tlvAid = new TLV(TAG_ASN_OCTET_STRING);
// 30
TLV tlvAsnPath = new TLV(TAG_ASN_SEQUENCE);
// 04
TLV tlvPath = new TLV(TAG_ASN_OCTET_STRING);
// populate tlvTarget.value with aid data,
// ruleString has remaining data for path
ruleString = tlvTarget.parse(ruleString, false);
// parse tlvTarget.value to get actual strings for AID.
// no other tags expected so shouldConsumeAll is true.
tlvAid.parse(tlvTarget.getValue(), true);
if (CARRIER_RULE_AID.equals(tlvAid.getValue())) {
tlvAsnPath.parse(ruleString, true);
tlvPath.parse(tlvAsnPath.getValue(), true);
ret = tlvPath.getValue();
}
}
// skip current rule as it doesn't have expected TAG
continue;
} catch (IllegalArgumentException | IndexOutOfBoundsException ex) {
log("Error: " + ex);
// Bad data, ignore all remaining ACRules
break;
}
}
return ret;
}
use of com.android.internal.telephony.uicc.UiccCarrierPrivilegeRules.TLV in project android_frameworks_opt_telephony by LineageOS.
the class UiccPkcs15 method parseAccf.
// parse ACCF and add to mRules
private void parseAccf(String data) {
String acCondition = data;
while (!acCondition.isEmpty()) {
TLV tlvCondition = new TLV(TAG_ASN_SEQUENCE);
TLV tlvCert = new TLV(TAG_ASN_OCTET_STRING);
try {
acCondition = tlvCondition.parse(acCondition, false);
tlvCert.parse(tlvCondition.getValue(), true);
if (!tlvCert.getValue().isEmpty()) {
mRules.add(tlvCert.getValue());
}
} catch (IllegalArgumentException | IndexOutOfBoundsException ex) {
log("Error: " + ex);
// Bad data, ignore all remaining acCondition data
break;
}
}
}
Aggregations