use of com.mindbright.asn1.ASN1CharString in project SpringRemote by HaleyWang.
the class AttributeTypeAndValue method valueAsString.
private String valueAsString() {
ASN1Object vo = value.getValue();
String vs = "<unknown>";
if (vo instanceof DirectoryString) {
vs = ((DirectoryString) vo).getString();
} else if (vo instanceof ASN1CharString) {
vs = ((ASN1CharString) vo).getValue();
} else if (vo instanceof ASN1PrintableString) {
vs = ((ASN1PrintableString) vo).getValue();
} else if (vo instanceof ASN1BitString) {
vs = ((ASN1BitString) vo).toPrintableString();
}
return vs;
}
use of com.mindbright.asn1.ASN1CharString in project SpringRemote by HaleyWang.
the class PKCS12KeyStore method getAttribute.
private String getAttribute(SafeBag safeBag, String attrType) {
int cnt = safeBag.bagAttributes.getCount();
String value = null;
for (int i = 0; i < cnt; i++) {
Attribute a = (Attribute) safeBag.bagAttributes.getComponent(i);
if (attrType.equals(a.type.getString())) {
ASN1Object v = a.values.getComponent(0);
if (v instanceof ASN1CharString) {
value = ((ASN1CharString) v).getValue();
} else if (v instanceof ASN1OctetString) {
value = HexDump.toString(((ASN1OctetString) v).getRaw());
} else {
value = v.toString();
}
}
}
return value;
}
Aggregations