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

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

Introduction

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

Prototype

ASN1ObjectIdentifier c

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

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   w  ww  . ja  va2s.  co  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 country code elements from this principal. 
 * Country codes are two letter codes (see ISO 3166)
 * All elements are returned so the list can contain duplicate elements
 * @return//from   w  w w  .ja v a 2  s .  c om
 */
public List<String> getCountryCode() {
    return asStrings(RFC4519Style.c);
}