Example usage for org.bouncycastle.asn1.isismtt.x509 NamingAuthority getNamingAuthorityId

List of usage examples for org.bouncycastle.asn1.isismtt.x509 NamingAuthority getNamingAuthorityId

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.isismtt.x509 NamingAuthority getNamingAuthorityId.

Prototype

public ASN1ObjectIdentifier getNamingAuthorityId() 

Source Link

Usage

From source file:net.sf.keystore_explorer.crypto.x509.X509Ext.java

License:Open Source License

private String getNamingAuthorityStringValue(NamingAuthority namingAuthority, int indentLevel)
        throws IOException {
    // @formatter:off
    /*//from ww w.  j  a v  a  2 s .  co  m
         NamingAuthority ::= SEQUENCE
         {
     namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
     namingAuthorityUrl IA5String OPTIONAL,
     namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
         }
     */
    // @formatter:on

    StringBuilder sb = new StringBuilder();

    ASN1ObjectIdentifier namingAuthorityId = namingAuthority.getNamingAuthorityId();
    String namingAuthorityUrl = namingAuthority.getNamingAuthorityUrl();
    DirectoryString namingAuthorityText = namingAuthority.getNamingAuthorityText();

    if (namingAuthorityId != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(
                MessageFormat.format(res.getString("Admission.NamingAuthorityOID"), namingAuthorityId.getId()));
        sb.append(NEWLINE);
    }

    if (namingAuthorityUrl != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(MessageFormat.format(res.getString("Admission.NamingAuthorityURL"), namingAuthorityUrl));
        sb.append(NEWLINE);
    }

    if (namingAuthorityText != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(MessageFormat.format(res.getString("Admission.NamingAuthorityText"),
                namingAuthorityText.toString()));
        sb.append(NEWLINE);
    }

    return sb.toString();
}