FileDocCategorySizeDatePackage
X509Principal.javaAPI DocAndroid 1.5 API3934Wed May 06 22:41:06 BST 2009org.bouncycastle.jce

X509Principal

public class X509Principal extends org.bouncycastle.asn1.x509.X509Name implements Principal

Fields Summary
Constructors Summary
public X509Principal(byte[] bytes)
Constructor from an encoded byte array.

        super(readSequence(new ASN1InputStream(bytes)));
    
public X509Principal(org.bouncycastle.asn1.x509.X509Name name)
Constructor from an X509Name object.

        super((ASN1Sequence)name.getDERObject());
    
public X509Principal(Hashtable attributes)
constructor from a table of attributes.

it's is assumed the table contains OID/String pairs.

        super(attributes);
    
public X509Principal(Vector ordering, Hashtable attributes)
constructor from a table of attributes and a vector giving the specific ordering required for encoding or conversion to a string.

it's is assumed the table contains OID/String pairs.

        super(ordering, attributes);
    
public X509Principal(Vector oids, Vector values)
constructor from a vector of attribute values and a vector of OIDs.

        super(oids, values);
    
public X509Principal(String dirName)
takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or some such, converting it into an ordered set of name attributes.

        super(dirName);
    
public X509Principal(boolean reverse, String dirName)
Takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or some such, converting it into an ordered set of name attributes. If reverse is false the dir name will be encoded in the order of the (name, value) pairs presented, otherwise the encoding will start with the last (name, value) pair and work back.

        super(reverse, dirName);
    
public X509Principal(boolean reverse, Hashtable lookUp, String dirName)
Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or some such, converting it into an ordered set of name attributes. lookUp should provide a table of lookups, indexed by lowercase only strings and yielding a DERObjectIdentifier, other than that OID. and numeric oids will be processed automatically.

If reverse is true, create the encoded version of the sequence starting from the last element in the string.

        super(reverse, lookUp, dirName);
    
Methods Summary
public byte[]getEncoded()
return a DER encoded byte array representing this object

        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        DEROutputStream         dOut = new DEROutputStream(bOut);

        try
        {
            dOut.writeObject(this);
        }
        catch (IOException e)
        {
            throw new RuntimeException(e.toString());
        }

        return bOut.toByteArray();
    
public java.lang.StringgetName()

        return this.toString();
    
private static org.bouncycastle.asn1.ASN1SequencereadSequence(org.bouncycastle.asn1.ASN1InputStream aIn)

        try
        {
            return ASN1Sequence.getInstance(aIn.readObject());
        }
        catch (IllegalArgumentException e)
        {
            throw new IOException("not an ASN.1 Sequence: " + e);
        }