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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

Comments for Tech Journey

Storage Spaces Can't Add Drives (Request Is Not Supported Error 0x00000032) - Tech Journey Chrome / Edge Disables .CRX Installed Extensions (Workarounds to Turn On) Remove Disable Developer Mode Extensions Warning Popup in Chrome / Edge How to Allow Local Network When Using WireGuard VPN Tunnel in Windows 10 How to Convert SRT to Create 3D Subtitles (ASS or SUB/IDX) Cannot Connect to CIFS / SMB / Samba Network Shares & Shared Folders in Windows 10 Unrecognised Disk Label When Creating Partition Install Microsoft .NET Framework 1.1 on Windows 10 / 8 / 7 / Vista (Fix RegSvcs.exe Error) 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)

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

You can’t really tell whether a key is encrypted or decrypted through the file extension, which can be set to any of .pem, .cer, .crt, .der or .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

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years. Connect with LK through Tech Journey on Facebook, Twitter or Google+.
Page load link
Go to Top