Challenge mismatch"));
}
+ return csrf;
}
private PKCS10Attributes buildAtts(ObjectIdentifier[] ekuOIDs, GeneralNameInterface... SANs) throws IOException {
@@ -143,12 +286,12 @@ public class TestCertificateAdd extends ManagedTest {
private String[] fillOutForm(String pem) throws IOException {
HttpURLConnection uc = (HttpURLConnection) ncert.openConnection();
uc.setRequestProperty("Cookie", session);
- String csrf = getCSRF(uc);
- return fillOutForm(csrf, pem);
+ csrf = getCSRF(uc);
+ return fillOutFormDirect(pem);
}
- private String[] fillOutForm(String csrf, String pem) throws IOException {
+ private String[] fillOutFormDirect(String pem) throws IOException {
HttpURLConnection uc = (HttpURLConnection) ncert.openConnection();
uc.setRequestProperty("Cookie", session);
@@ -156,6 +299,10 @@ public class TestCertificateAdd extends ManagedTest {
uc.getOutputStream().write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" + pem).getBytes());
uc.getOutputStream().flush();
+ return extractFormData(uc);
+ }
+
+ private String[] extractFormData(HttpURLConnection uc) throws IOException, Error {
String result = IOUtils.readURL(uc);
if (result.contains("
")) {
String s = fetchStartErrorMessage(result);