Mamsaac
Mamsaac

Reputation: 6273

PKCS#12 (.pfx .p12) generation with node.js on the fly?

I have a certain need to generate them on the fly. While I guess I could use openssl commands to generate files, then read them and delete them, it would be nice if there was a way to do it inside of node.js.

Any suggestions? I checked out certgen but it doesn't have what I'm looking for (plus, it is just calling command line commands and generating files...).

Upvotes: 1

Views: 5351

Answers (2)

dlongley
dlongley

Reputation: 2096

You can use Forge to generate PKCS#12 files in node.js:

https://github.com/digitalbazaar/forge#pkcs12

Upvotes: 3

Golo Roden
Golo Roden

Reputation: 150832

I had the same demand.

If you know C++ you can write a module to link against OpenSSL directly.

If not (like me) then you're essentially stuck to CLI calls.

PS: I'd definitely avoid writing code to do certificate generation on my own. For highly security related code IMHO it's always better to re-use a trusted and well-established product such as OpenSSL.

Upvotes: 1

Related Questions