Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Generate private key encrypted with password using openssl

Writer Emily Wong

I'm using openssl to sign files, it works but I would like the private key file is encrypted with a password. These are the commands I'm using, I would like to know the equivalent commands using a password:

----- EDITED -----

I put here the updated commands with password:

- Use the following command to generate your private key using the RSA algorithm:
$ openssl genrsa -aes256 -passout pass:foobar -out private.key 2048
- Use the following command to extract your public key:
$ openssl rsa -in private.key -passin pass:foobar -pubout -out public.key
- Use the following command to sign the file:
$ openssl dgst -sha512 -sign private.key -passin pass:foobar -out signature.bin file.txt
- To verify the signature:
$ openssl dgst -sha512 -verify public.key -signature signature.bin file.txt

1 Answer

You can add the "passout" flag, for the "foobar" password it would be: -passout pass:foobar

In your first example it become openssl genrsa -passout pass:foobar -out private.key 2048

You can also use: openssl genrsa -aes256 -out private.key 2048This will ask you to enter a passphrase.

You can read more here:

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy