Example usage for org.bouncycastle.asn1 DERPrintableString DERPrintableString

List of usage examples for org.bouncycastle.asn1 DERPrintableString DERPrintableString

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 DERPrintableString DERPrintableString.

Prototype

public DERPrintableString(String string, boolean validate) 

Source Link

Document

Constructor with optional validation.

Usage

From source file:org.cesecore.certificates.certificate.certextensions.BasicCertificateExtension.java

License:Open Source License

private ASN1Encodable parseDERPrintableString(String value) throws CertificateExtensionException {
    try {/*from  w  ww .  jav a  2s.  co  m*/
        return new DERPrintableString(value, true);
    } catch (IllegalArgumentException e) {
        throw new CertificateExtensionException(intres.getLocalizedMessage("certext.basic.illegalvalue", value,
                Integer.valueOf(getId()), getOID()));
    }
}

From source file:org.ejbca.core.model.ca.certextensions.BasicCertificateExtension.java

License:Open Source License

private DEREncodable parseDERPrintableString(String value) throws CertificateExtentionConfigurationException {
    try {/* ww w .ja v  a2 s . c om*/
        return new DERPrintableString(value, true);
    } catch (java.lang.IllegalArgumentException e) {
        throw new CertificateExtentionConfigurationException(intres
                .getLocalizedMessage("certext.basic.illegalvalue", value, Integer.valueOf(getId()), getOID()));
    }
}

From source file:org.signserver.module.mrtdsodsigner.jmrtd.SODFile.java

License:Open Source License

private static ContentInfo createContentInfo(String digestAlgorithm, Map<Integer, byte[]> dataGroupHashes,
        String ldsVersion, String unicodeVersion) throws NoSuchAlgorithmException, IOException {
    DataGroupHash[] dataGroupHashesArray = new DataGroupHash[dataGroupHashes.size()];
    int i = 0;/*ww  w  . j  a  v  a  2s  .c o m*/
    for (int dataGroupNumber : dataGroupHashes.keySet()) {
        byte[] hashBytes = dataGroupHashes.get(dataGroupNumber);
        DataGroupHash hash = new DataGroupHash(dataGroupNumber, new DEROctetString(hashBytes));
        dataGroupHashesArray[i++] = hash;
    }
    AlgorithmIdentifier digestAlgorithmIdentifier = new AlgorithmIdentifier(
            lookupOIDByMnemonic(digestAlgorithm));
    LDSVersionInfo ldsVersionInfo;
    if (ldsVersion == null) {
        ldsVersionInfo = null;
    } else {
        ldsVersionInfo = new LDSVersionInfo(new DERPrintableString(ldsVersion, true),
                new DERPrintableString(unicodeVersion, true));
    }
    LDSSecurityObject sObject2 = new LDSSecurityObject(digestAlgorithmIdentifier, dataGroupHashesArray,
            ldsVersionInfo);
    return new ContentInfo(ICAO_SOD_OID, new DEROctetString(sObject2));
}

From source file:org.usrz.libs.crypto.cert.X500PrincipalBuilder.java

License:Apache License

/**
 * Specifiy the <em>country</em> <small>(OID 2.5.4.6)</small>.
 *//*from   www.  ja  v a 2s .co m*/
public X500PrincipalBuilder withCountry(String country) {
    if (country == null)
        throw new NullPointerException("Null country");
    if (country.length() == 0)
        throw new IllegalArgumentException("Empty country");
    if (country.length() != 2)
        throw new IllegalArgumentException("Country must be 2 characters long");
    attributes.put(COUNTRY, new DERPrintableString(country, true));
    return this;
}