Program me a openssl command to create a rsa key
时间: 2024-02-07 17:02:27 浏览: 59
Sure! Here's an OpenSSL command to generate a new RSA private key:
```
openssl genrsa -out private_key.pem 2048
```
This command will generate an RSA private key with a bit length of 2048 and save it to a file named "private_key.pem" in the current directory. Note that the key can be saved in various formats, such as PEM, DER, or PKCS#8, depending on your requirements.
After generating the private key, you can also generate the corresponding public key using the following command:
```
openssl rsa -in private_key.pem -out public_key.pem -pubout
```
This command will read the private key from the "private_key.pem" file, extract the public key, and save it to a file named "public_key.pem" in the current directory. The resulting public key can be used for encryption and verification of digital signatures.
阅读全文