use of com.adaptris.security.certificate.CertificateParameter in project interlok by adaptris.
the class JunitSecurityHelper method getBuilder.
private static CertificateBuilder getBuilder(String commonName) throws Exception {
CertificateBuilder builder = CertificateBuilderFactory.getInstance().createBuilder();
CertificateParameter cp = new CertificateParameter();
X500NameBuilder subject = new X500NameBuilder();
subject.addRDN(X509ObjectIdentifiers.countryName, "GB");
subject.addRDN(X509ObjectIdentifiers.stateOrProvinceName, "Middlesex");
subject.addRDN(X509ObjectIdentifiers.localityName, "Uxbridge");
subject.addRDN(X509ObjectIdentifiers.organization, "Adaptris");
subject.addRDN(X509ObjectIdentifiers.organizationalUnitName, "JUNIT");
subject.addRDN(X509ObjectIdentifiers.commonName, commonName);
subject.addRDN(PKCSObjectIdentifiers.pkcs_9_at_emailAddress, "myname@adaptris.com");
cp.setSignatureAlgorithm("SHA256WithRSAEncryption");
// Changed to 1024 as the key size, otherwise jdk8_66 appears to have a fit
// wrt to java.security limiting the certpath algorithms
// jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024 (it was like this in _40, but doesn't
// apparently break things
cp.setKeyAlgorithm("RSA", 1024);
cp.setSubjectInfo(subject.build());
builder.setCertificateParameters(cp);
return builder;
}
use of com.adaptris.security.certificate.CertificateParameter in project interlok by adaptris.
the class Config method getBuilder.
public CertificateBuilder getBuilder(String commonName) throws Exception {
CertificateBuilder builder = CertificateBuilderFactory.getInstance().createBuilder();
CertificateParameter cp = new CertificateParameter();
X500NameBuilder subject = new X500NameBuilder();
subject.addRDN(X509ObjectIdentifiers.countryName, config.getProperty(CERTIFICATE_C));
subject.addRDN(X509ObjectIdentifiers.stateOrProvinceName, config.getProperty(CERTIFICATE_ST));
subject.addRDN(X509ObjectIdentifiers.localityName, config.getProperty(CERTIFICATE_L));
subject.addRDN(X509ObjectIdentifiers.organization, config.getProperty(CERTIFICATE_O));
subject.addRDN(X509ObjectIdentifiers.organizationalUnitName, config.getProperty(CERTIFICATE_OU));
subject.addRDN(X509ObjectIdentifiers.commonName, commonName);
subject.addRDN(PKCSObjectIdentifiers.pkcs_9_at_emailAddress, config.getProperty(CERTIFICATE_EMAIL));
cp.setSignatureAlgorithm(config.getProperty(CERTIFICATE_SIGALG));
cp.setKeyAlgorithm(config.getProperty(CERTIFICATE_KEYALG), Integer.parseInt(config.getProperty(CERTIFICATE_KEYSIZE)));
cp.setSubjectInfo(subject.build());
builder.setCertificateParameters(cp);
return builder;
}
Aggregations