10

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.

Raj
  • 129
  • 1
  • 1
  • 6

1 Answers1

17

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
Fabian
  • 397
  • 3
  • 17
  • 1
    the app says "use_private_key_file: no start line" - any idea why? – Raj Dec 26 '17 at 01: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