惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
L
LangChain Blog
Vercel News
Vercel News
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
T
Threatpost
Scott Helme
Scott Helme
T
Tailwind CSS Blog
Latest news
Latest news
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
The Register - Security
The Register - Security
罗磊的独立博客
P
Proofpoint News Feed
腾讯CDC
S
Schneier on Security
雷峰网
雷峰网
A
About on SuperTechFans
T
Tenable Blog
F
Full Disclosure
Cyberwarzone
Cyberwarzone
博客园_首页
有赞技术团队
有赞技术团队
K
Kaspersky official blog

Comments for Tech Journey

Comment on Cannot Connect to CIFS / SMB / Samba Network Shares & Shared Folders in Windows 10 by Jackson De Marco Comment on Install Microsoft .NET Framework 1.1 on Windows 10 / 8 / 7 / Vista (Fix RegSvcs.exe Error) by Kyle Comment on How to Allow Local Network When Using WireGuard VPN Tunnel in Windows 10 by Moohamat Thoiruddin Chrome / Edge Disables .CRX Installed Extensions (Workarounds to Turn On) Remove Disable Developer Mode Extensions Warning Popup in Chrome / Edge How to Convert SRT to Create 3D Subtitles (ASS or SUB/IDX) Unrecognised Disk Label When Creating Partition Fix Windows Not Remember & Save Folder Types or Folder Views Setting (Increase BagMRU Size Cache Memory Size) How to Change the Logo of vBulletin Forum to Custom Image
How to Decrypt an Enrypted SSL RSA Private Key (PEM / KEY)
LK · 2014-11-23 · via Comments for Tech Journey
Skip to content
How to Decrypt an Enrypted SSL RSA Private Key (PEM / KEY)
Private key is normally encrypted and protected with a passphrase or password before the private key is transmitted or sent. When you receive an encrypted private key, you must decrypt the private key in order to use the private key together with the public server certificate to install and set up a working SSL, or to use the private key to decrypt the SSL traffic in a network protocol analyzer such as Wireshark.

To identify whether a private key is encrypted or not, open the private key in any text editor such as Notepad or Notepad++. An encrypted key has the first few lines that similar to the following, with the ENCRYPTED word:

—–BEGIN RSA PRIVATE KEY—–
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,AB8E2B5B2D989271273F6730B6F9C687

……………………………………………….
……………………………………………….
………………………………………
—–END RSA PRIVATE KEY—–

On the other hand, an unecrypted key will have the following format:

—–BEGIN RSA PRIVATE KEY—–
………………………………………..
………………………………………..
…………………………………..
—–END RSA PRIVATE KEY—–

Encrypted key cannot be used directly in applications in most scenario. It must be decrypted first.

OpenSSL in Linux is the easiest way to decrypt an encrypted private key. Use the following command to decrypt an encrypted RSA key:

openssl rsa -in ssl.key.secure -out ssl.key

Make sure to replace the “server.key.secure” with the filename of your encrypted key, and “server.key” with the file name that you want for your encrypted output key file.

If the encrypted key is protected by a passphrase or password, enter the pass phrase when prompted.

Once done, you will notice that the ENCRYPTED wording in the file has gone.

Decrypted Encrypted Private Key

A private key or public certificate can be encoded in X.509 binary DEF form or Base64-encoded. The only way to tell whether it’s in binary or Base64 encoding format is by opening up the file in a text editor, where Base64- encoded will be readable ASCII, and normally have BEGIN and END lines.

If a private key or public certificate is in binary format, you can’t simply just decrypt it. To convert from X.509 DER binary format to PEM format, use the following commands:

For public certificate (replace server.crt and server.crt.pem with the actual file names):

openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem

For private key (replace server.key and server.key.pem with the actual file names):

openssl rsa -inform DER -outform PEM -in server.key -out server.key.pem
Sometimes, a PEM file (not necessary in this extension) may is already in unencrypted format, or contain both the certificate and private key in one file. Use the following command to create non-strict certificate and/or private key in PEM format:

For public certificate (replace server.crt and server.crt.pem with the actual file names):

openssl x509 -inform PEM -in server.crt > server.crt.pem

For private key (replace server.key and server.key.pem with the actual file names):

openssl rsa -in server.key -text > server.key.pem
Go to Top