use of org.bouncycastle.asn1.isismtt.x509.ProcurationSyntax in project keystore-explorer by kaikramer.
the class X509Ext method getProcurationStringValue.
private String getProcurationStringValue(byte[] octets) throws IOException {
// @formatter:off
/*
ProcurationSyntax ::= SEQUENCE
{
country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
typeOfSubstitution [2] EXPLICIT DirectoryString(SIZE(1..128)) OPTIONAL,
signingFor [3] EXPLICIT SigningFor
}
SigningFor ::= CHOICE
{
thirdPerson GeneralName,
certRef IssuerSerial
}
*/
// @formatter:on
StringBuilder sb = new StringBuilder();
ProcurationSyntax procurationSyntax = ProcurationSyntax.getInstance(octets);
String country = procurationSyntax.getCountry();
DirectoryString typeOfSubstitution = procurationSyntax.getTypeOfSubstitution();
GeneralName thirdPerson = procurationSyntax.getThirdPerson();
IssuerSerial certRef = procurationSyntax.getCertRef();
if (country != null) {
sb.append(MessageFormat.format(res.getString("Procuration.Country"), country));
sb.append(NEWLINE);
}
if (typeOfSubstitution != null) {
sb.append(MessageFormat.format(res.getString("Procuration.TypeOfSubstitution"), typeOfSubstitution.toString()));
sb.append(NEWLINE);
}
if (thirdPerson != null) {
sb.append(MessageFormat.format(res.getString("Procuration.ThirdPerson"), GeneralNameUtil.toString(thirdPerson)));
sb.append(NEWLINE);
}
if (certRef != null) {
sb.append(res.getString("Procuration.CertRef"));
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(res.getString("Procuration.CertRef.Issuer"));
for (GeneralName generalName : certRef.getIssuer().getNames()) {
sb.append(INDENT);
sb.append(INDENT);
sb.append(GeneralNameUtil.toString(generalName));
sb.append(NEWLINE);
}
sb.append(NEWLINE);
sb.append(INDENT);
sb.append(MessageFormat.format(res.getString("Procuration.CertRef.SN"), HexUtil.getHexString(certRef.getSerial().getValue())));
sb.append(NEWLINE);
}
return sb.toString();
}
Aggregations