openssl-nodejs
openssl-nodejs copied to clipboard
Can´t convert DER Certificate to PEM
I try to convert a DER formatted certificate to PEM format. i used the command for that from sslshopper. locally over the Console it worked, but when i try it in nodejs i get the following callback: OpenSSL process ends with code 1 x509: Invalid format "openssl/der" for -inform x509: Use -help for summary.
At first i thought its just a problem with the in cert, so i tried to give the command the local Dir of the cert. i also tried to give it the cert as object.
Am i too stupid or is it a real issue?
I believe kind of issue. Probably you give argument 'der' but 'openssl' is concated to the string. Openssl seems to not understand 'openssl/der'. I have the same issue with pem (exactly with 'openssl/pem'). I've removed this 'openssl' concat and now have only 'pem' - works good.
Problem with this code:
if (checkCommandForIO(parameters[i]) && typeof parameters[i + 1] !== 'object') { parameters[i + 1] = dir + parameters[i + 1]; }
to be more exact
const checkCommandForIO = element => element.includes('-in') || element.includes('-out') || element.includes('-keyout') || element.includes('-signkey') || element.includes('-key')
outform param includes out so it adds openssl/ to DER
did you ever figure out the solution? im having the exact same problem but im not sure i understand the issue Driim and Peer are talking about in regarrds to the concat of openssl. Will take a look at the source code, but im wondering if it's an issue with how i am writing the request, but it works fine on terminal