Creating a public and public key OpenSSL

I have the following commands for OpenSSL to generate private and public keys:

openssl genrsaaes-128-cbcout priv.pempassout pass:[privateKeyPass] 2048

and

openssl reqx509newkey priv.pempassin pass:[privateKeyPass] -days 3650 –out cert.cer

... but they do not work. For the first command, I get the following error:

usage: genrsa [args] [numbits]
 -des            encrypt the generated key with DES in cbc mode
 -des3           encrypt the generated key with DES in ede cbc mode (168 bit key)
 -seed
                 encrypt PEM output with cbc seed
 -aes128, -aes192, -aes256
                 encrypt PEM output with cbc aes
 -camellia128, -camellia192, -camellia256
                 encrypt PEM output with cbc camellia
 -out file       output the key to 'file
 -passout arg    output file pass phrase source
 -f4             use F4 (0x10001) for the E value
 -3              use 3 for the E value
 -engine e       use engine e, possibly a hardware device.
 -rand file:file:...
                 load the file (or the files in the directory) into
                 the random number generator

What am I doing wrong?

Change: I solved the first command:

openssl genrsa -aes128 -out privkey.pem 2048

But now I get the error with the second:

unknown option –x509
+10
source share
2 answers

'genrsa' generates only the RSA key.

'req' then uses this key to query the x509 style.

If you just need an rsa key pair, use genrsa.

If you need a key pair and a signed x509 request, you use "genrsa" and then "req".

'req' (.. 'genrsa' ( gendh).

:

 openssl genrsa -aes128 -out privkey.pem 2048
 openssl req -new -x509 -key privkey.pem 

 openssl req -new -x509 -keyout privkey.pem  -newkey rsa:2048

, 'genrsa', 'req' aes128 .

, , .

+15

, . -aes128 -aes-128-cbc?

, -aes-128-cbc openssl enc, , genrsa.

+1

All Articles