0

I have a problème when I try to generate a Ssh Key as requested in the instructions of this Symfony Bundle : LexikJWTAuthenticationBundle

When I use this command :

openssl genrsa -out config/jwt/private.pem -aes256 4096

The process doesn't finish, here is what I have : openssl genrsa with AES

But it works perfectly without the use of AES (either: -aes256 or 128 or other ..)

Do you know why ?

(Then, do you think I can continue without using AES ?)

Thank you.

Mohamed 19
  • 7
  • 1
  • 9

3 Answers3

3

I had the same problem, when I was using openssl from my Git Bash (command line installed with git on Windows, and openssl is coming by default with it). Later on, I installed OpenSSL on windows itself, you can can download it from here, add it in path variables in your pc, then you would be able to use it from your CMD anywhere and it works the same way as it's described in JWT docs.

Hope it could help you and someone else.

ahmadzai
  • 44
  • 5
  • it works perfectly !! Thank you very much, because I must admit that after many attempts and this same on other PC (Windows Pro) I couldn't do it .. – Mohamed 19 Jan 31 '19 at 11:34
2

You are probably using OpenSSL on Windows in a Linux like subsystem like MinGW.

There seems to be an issue in displaying the passphrase prompt in this setup. You can bypass the prompt by specifying the password using the -passout option of OpenSSL:

openssl genrsa -out config/jwt/private.pem -aes256 -passout pass:PASSWORD 4096

You can however not generate a key with one of the encryption switches like -aes256 and not specify a password. Or you will get errors like this as a passphrase is obviously needed for the encryption:

$  openssl genrsa -aes256 -out ca-key.pem -passout pass: 4096
Generating RSA private key, 4096 bit long modulus
........++++
..................................................................................++++
e is 65537 (0x10001)
5588:error:0906906F:PEM routines:PEM_ASN1_write_bio:read key:pem_lib.c:373:
dpr
  • 10,591
  • 3
  • 41
  • 71
  • Thank you very much, it worked ! Unfortunately, now the public key generation that doesn't work :/ Would you have an idea to divert that too ? – Mohamed 19 Dec 10 '18 at 10:37
  • @Mohamed19 perhaps you can go a little bit more into detail? Perhaps open another question with this new problem. – dpr Dec 10 '18 at 12:11
0

In this answer there is a working solution: In Git-Bash-Windows `openssl pkcs12` does not prompt for password

put "winpty" before your command

winpty bash script.sh ......

winpty openssl .....

Paolo Biavati
  • 609
  • 10
  • 19