A third-party app I have requires a *.pem certificate to be able to open a wss connection. How can I generate a *.pem file, keeping in mind that I need that only for testing, therefore I want an easy, not necessarily a really secure way to do so.

I'm on Arch Linux.

  • What exactly does that application require from the certificate?
    – kasperd
    Dec 26 '17 at 6:21

first generate CSR and KEY:

openssl req -new -newkey rsa:4096 -nodes -keyout snakeoil.key -out snakeoil.csr

then generate PEM and self-sign with KEY:

openssl x509 -req -sha256 -days 365 -in snakeoil.csr -signkey snakeoil.key -out snakeoil.pem
  • 1
    the app says "use_private_key_file: no start line" - any idea why?
    – Raj
    Dec 26 '17 at 1:52
  • 1
    it seems your app can a) not find or read the key file (check path/permissions) or b) the key is not starting with "-----BEGIN PRIVATE KEY-----"
    – Fabian
    Dec 26 '17 at 12:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.