About RSA encryption and decryption problem, nothing to get a bit, first the main process to save, for Exchange or later use.
First make sure that you have the OpenSSL installed on your PC, and that your Mac system will install automatically after installation! How to install?? ..... Please Baidu ...
The installation commands are as follows:
sudo apt-get install OpenSSL
Create a folder anywhere in your location to save your public key and key,
Open the Terminal TERMINAL,CD command to enter the folder you created, such as Create a new "RSA Public Key" folder on the desktop, enter this directory, command
Next we start generating the public key and the key:
1. Generate the RSA private key:
Enter the following command in terminal (the command generates a 1024-bit private key):
OpenSSL genrsa-out Rsa_private_key.pem 1024
After carriage return as shown:
At this point you can see the Rsa_private_key.pem file under the RSA public key private keys folder.
2. Convert RSA private key to PKCS8 format
OpenSSL pkcs8-topk8-inform pem-in rsa_private_key.pem-outform pem–nocrypt
Enter the password and confirm the password after the return, the following will be displayed after the return:
The result of a successful life is the private key in the PKCS8 format.
3. Generate the Public key:
OpenSSL rsa-in rsa_private_key.pem-out rsa_public_key.pem-pubout
After carriage return
At this point, we can see a file named Rsa_public_key.pem, which is the public key.
Here, there will be two files under the folder "RSA public Key": Rsa_private_key.pem and Rsa_public_key.pem, which is the public key and private key we need!
Use generate RSA public key and key on Mac