Encryption and decryption of data by RSA for Mac system

Source: Internet
Author: User
Tags decrypt key string openssl rsa openssl x509

Create a key pair

Enter the following script one at a time in the terminal

OpenSSL Genrsa- outPrivate_key. PEM 1024x768OpenSSL Req-new-key Private_key. PEM- outRsacertreq. CSROpenSSL x509-req-days3650-inchRsacertreq. CSR-signkey Private_key. PEM- outRsacert. CRTOpenSSL X509-outform der-inchRsacert. CRT- outPublic_key. DerCreate Public_key. DerFor Iosopenssl Pkcs12-export- outPrivate_key. P12-inkey Private_key. PEM-inchRsacert. CRTCreate Private_key. PFor IOS. This step, please remember the password you entered, iOS code will use the OpenSSL RSA-inchPrivate_key. PEM- outRsa_public_key. PEM-pubout//Create Rsa_public_key. PEMFor Javaopenssl Pkcs8-topk8-inchPrivate_key. PEM- outPkcs8_private_key. PEM-nocrypt//Create Pkcs8_private_key. PEMFor Java

The above seven steps generate a total of 7 files. where Public_key.der and private_key.p12 the public key is for iOS, RSA_PUBLIC_KEY.PEM and Pkcs8_private_key.pem are for Java.

Generate Encrypted files

Install Qmrsa.app under Mac System

Encryption
    1. Open Rsa_public_key.pem and PKCS8_PRIVATE_KEY.PEM get the data inside (remove the tail, line, and space), respectively, into the private key string, the public key string. So we can encrypt and decrypt.
    2. Import unencrypted original files,
    3. On demand is to be able to import directly in the background
Decrypt

As above, first fill in the key pair. To require import, export

Encryption and decryption of data by RSA for Mac system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.