Generate public and private keys with OpenSSL under Mac

Source: Internet
Author: User
Tags modulus
Generate public and private keys with OpenSSL under Mac

MAC OS comes with OpenSSL, so you don't have to compile the same source code as shit. You can use OpenSSL directly on the command line.

Open the command-line tool and enter OpenSSL to open OpenSSL, and then just three commands to get it done. The first command generates the private key; the second command converts the RSA private key to the PKCS8 format, and the password is empty; The third command generates the public key.

Sticker Code No Nonsense

wangbindemacbook-pro:~ wangbin$ OpenSSL

Openssl> Genrsa-out Rsa_private_key.pem Here if the number of non-digits is 512 by default

Generating RSA private key, modulus bit long

.. ++++++++++++

.++++++++++++

E is 65537 (0x10001)

openssl> Genrsa-out RSA_PRIVATE_KEY.PEM 1024

Generating RSA private key, 1024x768 bit long modulus

.. ++++++

.......................++++++

E is 65537 (0x10001)

openssl> pkcs8-topk8-inform pem-in rsa_private_key.pem-outform pem-nocrypt Convert to Pkcs8

-----BEGIN PRIVATE KEY-----

Miicdgibadanbgkqhkig9w0baqefaascamawggjcageaaogbanrjczcxjgygmrbz

4xyg8yhyeb/fvchwmay0urxnnbpq1l53rfquglo/zm16o3bxx5ulgrl+wqkbmhpx

Uzazspcng5vzjxitinq8gzms9ogus8ozxbopsxrcfo1evlmfeht4hg0vjq2b6xd3

Kxdj/tr4hisizdai6reb3kvhhv7hagmbaaecgybyq6bkuqoojmdfks14gdpcsswp

Uu37ug+dhko2upps2ulpfpnmh145l7zouclcrczuplvq6xx77odh81upj/cui/t0

Cwnsobecp4qsfncihpkjeezjtcgxcuwhyz2eyeop/szb9rlk6ohjoa3h+xi1i2i2

Tzzjiotmevprlf/uaqjbaplk2vu9msadcook5rrbj57ghzdayurbpuoaaoampyzf

Uhn5srkzkdehmi2ihgxvwqi9ilgsr5ut2q4wogapflecqqdagfrhg2csuusahd48

Bzaxoryz08l2utpoyzttv7c3+e8s2n+xlvsx+ckupt8sfxjvn5mvq8h6xtemosw0

T+urakaxjnjetji+vomobps+chqv4f3hi/z8+jejgex/lhcs/ub+u/cl06nmrhtc

L/llk6w9cmwwjdywlozdoqq7y3hhakaguo5f4alg0b9dsnycuedtumfcatc4eobd

62qu6pefeqqnxhxqqje6n+fspvunfd6qbq63hrmhigyctaukxbxbakeaxdpbfb3b

Mkyjvoxolvijotiny1e78bk4vokr4htlq8cubg1vwukogelhbg24jprgs3krsobk

5pyow+dhtbftyw==

-----END PRIVATE KEY-----

openssl> rsa-in rsa_private_key.pem-pubout-out RSA_PUBLIC_KEY.PEM output Public key

Writing RSA Key

Openssl>

  • 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.