- public String executeBasicWebInteraction(String cookie, String path, String query) throws MalformedURLException, UnsupportedEncodingException, IOException {
+ public static String generatePEMCSR(KeyPair kp, String dn) throws GeneralSecurityException, IOException {
+ return generatePEMCSR(kp, dn, new PKCS10Attributes());
+ }
+
+ public static String generatePEMCSR(KeyPair kp, String dn, PKCS10Attributes atts) throws GeneralSecurityException, IOException {
+ return generatePEMCSR(kp, dn, atts, "SHA256WithRSA");
+ }
+
+ public static String generatePEMCSR(KeyPair kp, String dn, PKCS10Attributes atts, String signature) throws GeneralSecurityException, IOException {
+ PKCS10 p10 = new PKCS10(kp.getPublic(), atts);
+ Signature s = Signature.getInstance(signature);
+ s.initSign(kp.getPrivate());
+ p10.encodeAndSign(new X500Name(dn), s);
+ return PEM.encode("CERTIFICATE REQUEST", p10.getEncoded());
+ }
+
+ public static String executeBasicWebInteraction(String cookie, String path, String query) throws MalformedURLException, UnsupportedEncodingException, IOException {