Facing error while creating CSR certificate using Openssl inside a javacode using process builder

1 week ago 10
ARTICLE AD BOX
ProcessBuilder process3 = new ProcessBuilder( "openssl" , "req", "-new", "-key", "-", "-subj", "/C=IN/ST=TamilNadu/L=Chennai/O=Inspoworks Private Ltd/OU=IT solutions/CN=com.radnus.com/[email protected]", "-out","-"); Process p3 = process3.start(); try(BufferedOutputStream bos1 = new BufferedOutputStream(p3.getOutputStream())){ bos1.write(privatekey.getBytes()); bos1.flush(); } String csr1 = readOutput(p3.getInputStream()); System.out.println(csr1); exitcode = p3.waitFor(); if (exitcode != 0) { System.err.println(exitcode); System.err.println(readOutput(p3.getErrorStream())); } System.out.println(csr1); } //general method to read terminal output public static String readOutput(InputStream inputstream) throws IOException { StringBuilder sb = new StringBuilder(); try (InputStreamReader reader = new InputStreamReader(inputstream)) { int ch; while ((ch = reader.read()) != -1) { sb.append((char)ch); } } return sb.toString(); }

Facing error while creating CSR certificate using Open ssl inside a java code using process builder, i can able to create private key , public key but cant able to create CSR using private key

Read Entire Article