Example usage for org.bouncycastle.asn1.x500.style RFC4519Style st

List of usage examples for org.bouncycastle.asn1.x500.style RFC4519Style st

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x500.style RFC4519Style st.

Prototype

ASN1ObjectIdentifier st

To view the source code for org.bouncycastle.asn1.x500.style RFC4519Style st.

Click Source Link

Usage

From source file:mitm.common.security.certificate.X500PrincipalBuilder.java

License:Open Source License

/**
 * Builds the X500Principal with the specified elements
 * /*from   www. j a v  a  2  s . c o m*/
 * Example DNs:
 * 
 * CN=DOD CLASS 3 EMAIL CA-9, OU=PKI, OU=DoD, O=U.S. Government, C=US
 * CN=Thawte Personal Freemail Issuing CA, O=Thawte Consulting (Pty) Ltd., C=ZA
 * CN=Senter Certification Authority SubCA, OU=Certification Authority, O=Senter, L=Den Haag, ST=Zuid-Holland, 
 *          C=NL, EMAILADDRESS=SenterCA@Senter.nl
 * CN=Intel Corporation Basic Enterprise Issuing CA 1, OU=Information Technology Enterprise Business Computing, 
 *      O=Intel Corporation, L=Folsom, ST=CA, C=US, EMAILADDRESS=pki@intel.com
 * 
 */
public X500Principal buildPrincipal() throws IOException {
    X500NameBuilder nameBuilder = new X500NameBuilder(RFC4519Style.INSTANCE);

    add(RFC4519Style.c, countryCode, nameBuilder);
    add(RFC4519Style.st, state, nameBuilder);
    add(RFC4519Style.l, locality, nameBuilder);
    add(RFC4519Style.o, organisation, nameBuilder);
    add(RFC4519Style.ou, organisationalUnit, nameBuilder);
    add(RFC4519Style.cn, commonName, nameBuilder);
    add(RFC4519Style.sn, surname, nameBuilder);
    add(RFC4519Style.givenName, givenName, nameBuilder);
    add(PKCSObjectIdentifiers.pkcs_9_at_emailAddress, email, nameBuilder);

    return X500PrincipalUtils.fromX500Name(nameBuilder.build());
}

From source file:mitm.common.security.certificate.X500PrincipalInspector.java

License:Open Source License

/**
 * Returns a list of all State elements from this principal. 
 * All elements are returned so the list can contain duplicate elements
 * @return//w  w w.j  av  a2 s . c  o  m
 */
public List<String> getState() {
    return asStrings(RFC4519Style.st);
}