Example usage for org.bouncycastle.asn1.x509 X509Name OIDLookUp

List of usage examples for org.bouncycastle.asn1.x509 X509Name OIDLookUp

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 X509Name OIDLookUp.

Prototype

Hashtable OIDLookUp

To view the source code for org.bouncycastle.asn1.x509 X509Name OIDLookUp.

Click Source Link

Document

look up table translating OID values into their common symbols

Usage

From source file:org.glite.voms.contact.X509NameHelper.java

License:Apache License

private static String toString(ASN1Sequence seq) {
    if (seq == null) {
        return null;
    }/*from   www  .  j  av  a2 s . co m*/

    Enumeration e = seq.getObjects();
    StringBuffer buf = new StringBuffer();
    while (e.hasMoreElements()) {
        ASN1Set set = (ASN1Set) e.nextElement();
        Enumeration ee = set.getObjects();
        buf.append('/');
        while (ee.hasMoreElements()) {
            ASN1Sequence s = (ASN1Sequence) ee.nextElement();
            DERObjectIdentifier oid = (DERObjectIdentifier) s.getObjectAt(0);
            String sym = (String) X509Name.OIDLookUp.get(oid);
            if (sym == null) {
                buf.append(oid.getId());
            } else {
                buf.append(sym);
            }
            buf.append('=');
            buf.append(((ASN1String) s.getObjectAt(1)).getString());
            if (ee.hasMoreElements()) {
                buf.append('+');
            }
        }
    }

    return buf.toString();
}