Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate RSA Public key and Private key pair in openssl

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to generate RSA public key and private key pair in openssl, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

In the Windows environment, open openssl.exe under the bin file in the OPENSSL installation directory. In the Linux environment, run openssl directly in the terminal.

1) generate RSA private key:

Genrsa-out rsa_private_key.pem 1024

This command generates a 1024-bit private key.

At this point we can see the rsa_private_key.pem file under the current path.

2) convert the RSA private key to PKCS8 format, enter the command pkcs8-topk8-inform PEM-in rsa_private_key.pem-outform PEM-nocrypt, and press enter to get a successful result. The result is the private key in PKCS8 format, as shown below:

Https://cache.yisu.com/upload/information/20210524/347/788812.png

Generate RSA public key

Enter the command rsa-in rsa_private_key.pem-pubout-out rsa_public_key.pem, and press enter to get a successful result, as shown below: (https://cache.yisu.com/upload/information/20210524/347/788813.png))

At this point, we can see a file named rsa_public_key.pem. When we open it, we can see that there is no newline string at the beginning of-BEGIN PUBLIC KEY- and at the end of-END PUBLIC KEY-. This is the public key.

The above is how to generate RSA public key and private key pairs in openssl. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report