How to generate RSA-encrypted private and public keys under Mac

Source: Internet
Author: User
Tags modulus openssl openssl rsa

Introduction to RSA encryption algorithm here is not copied paste, the following is how to use the command line under the Mac to generate RSA private key and public key.

Using command to generate a 2048-bit private key

OpenSSL genrsa-out Private_key.pem 2048

The current directory will generate a file named Private_key.pem, if opened with a text editor, you will find this:

These things are the key we just generated, this thing can only be placed on the service side, if this thing leaks, the entire RSA encryption link is exposed.

Next we use the private key to generate the public key (command commands must be executed in the directory just below, otherwise you will not find Private_key.pem)

OpenSSL rsa-inform Pem-modulus-noout < Private_key.pem

By executing this command we can print out the public key:

When using the public key, remember to remove the "modulus=" from the front.

Reference Link: Http://www.ohdave.com/rsa

How to generate RSA-encrypted private and public keys under Mac

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.