class BERTLVObject {
private static String tagToString(byte[] tag) {
if (tag.length == 1) {
switch (tag[0] & 0xFF) {
case BOOLEAN_TYPE_TAG: return "BOOLEAN";
case INTEGER_TYPE_TAG: return "INTEGER";
case BIT_STRING_TYPE_TAG: return "BIT_STRING";
case OCTET_STRING_TYPE_TAG: return "OCTET_STRING";
case NULL_TYPE_TAG: return "NULL";
case OBJECT_IDENTIFIER_TYPE_TAG: return "OBJECT_IDENTIFIER";
case REAL_TYPE_TAG: return "REAL";
case ENUMERATED_TYPE_TAG: return "ENUMERATED";
case 0x30:
case SEQUENCE_TYPE_TAG: return "SEQUENCE";
case 0x31:
case SET_TYPE_TAG: return "SET";
case UTF8_STRING_TYPE_TAG: return "UTF_STRING";
case PRINTABLE_STRING_TYPE_TAG: return "PRINTABLE_STRING";
case T61_STRING_TYPE_TAG: return "T61_STRING";
case IA5_STRING_TYPE_TAG: return "IA5_STRING";
case VISIBLE_STRING_TYPE_TAG: return "VISIBLE_STRING";
case GENERAL_STRING_TYPE_TAG: return "GENERAL_STRING";
case UNIVERSAL_STRING_TYPE_TAG: return "UNIVERSAL_STRING";
case BMP_STRING_TYPE_TAG: return "BMP_STRING";
case UTC_TIME_TYPE_TAG: return "UTC_TIME";
case GENERALIZED_TIME_TYPE_TAG: return "GENERAL_TIME";
}
}
return "'0x" + Hex.bytesToHexString(tag) + "'";
}
}