Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel OpenSSL RSA key generation via command line #3076

Closed
mbigras opened this issue Mar 29, 2017 · 5 comments
Closed

Cancel OpenSSL RSA key generation via command line #3076

mbigras opened this issue Mar 29, 2017 · 5 comments

Comments

@mbigras
Copy link

mbigras commented Mar 29, 2017

When generating an RSA key with the OpenSSL cli you are prompted to enter your passphrase.

With most command-line interfaces pressing C-d or C-c will exit the process; however, with openssl it seems like it's impossible to exit the program once you've started the key generation process.

Shown below is a session where I'm trying C-c and C-d, only after entering foobar twice do I exit:

$ openssl genrsa -aes128 -out fd.key 2048
Generating RSA private key, 2048 bit long modulus
.........+++
.................................................+++
e is 65537 (0x10001)
Enter pass phrase for fd.key:
73496:error:28069065:lib(40):UI_set_result:result too small:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64/src/crypto/ui/ui_lib.c:850:You must type in 4 to 1023 characters
Enter pass phrase for fd.key:
73496:error:28069065:lib(40):UI_set_result:result too small:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64/src/crypto/ui/ui_lib.c:850:You must type in 4 to 1023 characters
Enter pass phrase for fd.key:
Enter pass phrase for fd.key:
Enter pass phrase for fd.key:
Enter pass phrase for fd.key:
Enter pass phrase for fd.key:
Enter pass phrase for fd.key:
Verifying - Enter pass phrase for fd.key:
  • How do I exit the genrsa openssl command?

See this security stackexchange question for more details

@richsalz
Copy link
Contributor

Use SIGQUIT (control-backslash) instead of SIGINT (control-c)?

On the other hand, typing control-c works for me just fine.

@mbigras
Copy link
Author

mbigras commented Mar 29, 2017

I'm running macOS 10.12.1 with OpenSSL 0.9.8zh 14 Jan 2016

It works if quit immediately but if you try to quit after pressing your first enter openssl doesn't seem to respond. Attached is a gif.

@richsalz
Copy link
Contributor

okay, that's a bug in that very old and unsupported openssl version. tty reading has had a number of fixes.

@mbigras
Copy link
Author

mbigras commented Mar 29, 2017

Also confirmed with OpenSSL 1.0.1 14 Mar 2012. Which version was it fixed in?

@richsalz
Copy link
Contributor

I don't know. Maybe read the CHANGES or git log files? But 1.0.1 from five years ago is also buggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants