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

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

Introduction

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

Prototype

public ASN1Primitive toASN1Primitive() 

Source Link

Usage

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

License:Apache License

/**
 * Creates an instance using existing {@link X509Name X509Name} object. This
 * behaves like a copy constructor.//  w  ww.  j  av a  2  s .c  o  m
 *
 * @param name existing <code>X509Name</code>
 */
public X509NameHelper(X509Name name) {
    try {
        this.seq = (ASN1Sequence) duplicate(name.toASN1Primitive());
    } catch (IOException e) {
        throw new RuntimeException(e.getMessage());
    }
}

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

License:Apache License

/**
 * Gets the last name component from the {@link X509Name X509Name} name.
 *
 * @return the last name component. Null if there is none.
 *//*ww w.jav  a  2s.c om*/
public static ASN1Set getLastNameEntry(X509Name name) {
    ASN1Sequence seq = (ASN1Sequence) name.toASN1Primitive();
    int size = seq.size();
    return (size > 0) ? (ASN1Set) seq.getObjectAt(size - 1) : null;
}

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

License:Apache License

/**
 * Returns Globus format representation of the name. It handles names with
 * multiple AVAs./* w w  w  .  ja  v a 2 s .  co m*/
 *
 * @param name the name to get the Globus format of.
 * @return the Globus format of the name
 */
public static String toString(X509Name name) {
    if (name == null) {
        return null;
    }
    return toString((ASN1Sequence) name.toASN1Primitive());
}

From source file:org.globus.gsi.bc.X509NameHelper.java

License:Apache License

/**
 * Creates an instance using existing {@link X509Name X509Name}
 * object./*w  ww.  j  a v a2s .  c o m*/
 * This behaves like a copy constructor.
 *
 * @param name existing <code>X509Name</code>
 */
public X509NameHelper(X509Name name) {
    try {
        this.seq = (ASN1Sequence) BouncyCastleUtil.duplicate(name.toASN1Primitive());
    } catch (IOException e) {
        throw new RuntimeException(e.getMessage());
    }
}

From source file:org.globus.gsi.util.CertificateIOUtil.java

License:Apache License

public static byte[] encodePrincipal(X509Name subject) throws IOException {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    DEROutputStream der = new DEROutputStream(bout);
    der.writeObject(subject.toASN1Primitive());
    return bout.toByteArray();
}