Step 1: Generate a private key, here we specify the length of the private key as 2048
openssl genrsa -out rsa_private_key.pem 2048
Step 2: Generate the corresponding public key according to the private key:
openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key_2048.pub
Step 3: Convert the private key to pkcs8 format, [this step is not necessary, but the program is easy to parse], the angle brackets mean: write the converted private key into the rsa_private_key_pkcs8.pem file
openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt > rsa_private_key_pkcs8.pem