@Test
public void testSimpleServer() throws IOException, GeneralSecurityException {
PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
- CertificateRequest.OID_KEY_USAGE_SSL_SERVER
+ CertificateRequest.OID_KEY_USAGE_SSL_SERVER
}, new DNSName(uniq + ".tld"));
String pem = generatePEMCSR(kp, "CN=a." + uniq + ".tld", atts);
@Test
public void testSimpleMail() throws IOException, GeneralSecurityException {
PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
- CertificateRequest.OID_KEY_USAGE_EMAIL_PROTECTION
+ CertificateRequest.OID_KEY_USAGE_EMAIL_PROTECTION
}, new DNSName("a." + uniq + ".tld"), new DNSName("b." + uniq + ".tld"), new RFC822Name(email));
String pem = generatePEMCSR(kp, "CN=a b", atts, "SHA384WithRSA");
@Test
public void testSimpleClient() throws IOException, GeneralSecurityException {
PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
- CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
+ CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
}, new RFC822Name(email));
String pem = generatePEMCSR(kp, "CN=a b,email=" + email, atts, "SHA512WithRSA");
@Test
public void testIssue() throws IOException, GeneralSecurityException {
PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
- CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
+ CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
}, new RFC822Name(email));
String pem = generatePEMCSR(kp, "CN=a b,email=" + email, atts, "SHA512WithRSA");
OutputStream out = huc.getOutputStream();
out.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8")).getBytes("UTF-8"));
out.write(("&CN=CAcert+WoT+User&profile=client&SANs=" + URLEncoder.encode("email:" + email + "\n", "UTF-8")).getBytes("UTF-8"));
- out.write(("&hash_alg=SHA512&CCA=y").getBytes("UTF-8"));
+ out.write(("&hash_alg=SHA512&tos_agree=y").getBytes("UTF-8"));
URLConnection uc = authenticate(new URL(huc.getHeaderField("Location") + ".crt"));
String crt = IOUtils.readURL(new InputStreamReader(uc.getInputStream(), "UTF-8"));
private X509Certificate createCertWithValidity(String validity) throws IOException, GeneralSecurityException, UnsupportedEncodingException, MalformedURLException, CertificateException {
PKCS10Attributes atts = buildAtts(new ObjectIdentifier[] {
- CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
+ CertificateRequest.OID_KEY_USAGE_SSL_CLIENT
}, new RFC822Name(email));
String pem = generatePEMCSR(kp, "CN=a b", atts, "SHA512WithRSA");
OutputStream out = huc.getOutputStream();
out.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8")).getBytes("UTF-8"));
out.write(("&profile=client&CN=" + CertificateRequest.DEFAULT_CN + "&SANs=" + URLEncoder.encode("email:" + email + "\n", "UTF-8")).getBytes("UTF-8"));
- out.write(("&hash_alg=SHA512&CCA=y&").getBytes("UTF-8"));
+ out.write(("&hash_alg=SHA512&tos_agree=y&").getBytes("UTF-8"));
out.write(validity.getBytes("UTF-8"));
String certurl = huc.getHeaderField("Location");
}
attributeValue.set("SANs", new SubjectAlternativeNameExtension(names));
PKCS10Attributes atts = new PKCS10Attributes(new PKCS10Attribute[] {
- new PKCS10Attribute(PKCS9Attribute.EXTENSION_REQUEST_OID, attributeValue)
+ new PKCS10Attribute(PKCS9Attribute.EXTENSION_REQUEST_OID, attributeValue)
});
ExtendedKeyUsageExtension eku = new ExtendedKeyUsageExtension(//
new Vector<>(Arrays.<ObjectIdentifier>asList(ekuOIDs)));