LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2019, 03:29 PM   #1
Latitude
Member
 
Registered: Mar 2009
Posts: 65

Rep: Reputation: 16
Can you generate a new SSL private key from a signed .crt file?


Hey friends. I've been tasked to update the SSL Cert on one of our RHEL 7.6 VMs that runs httpd (Apache web server) for an internally used web app. The CA verified and signed the cert before I took over for the previous engineer who had my job and I've looked at a lot of tutorials to deploy SSL/TLS on RHEL 7, but I've got a messy situation and I haven't quite figured it out how to handle this issue...

My manager gave me a .crt file and after I swapped it out for the old .crt file, httpd wouldn't start due to a key mismatch. I can see by the message in the ssl error log that mod_ssl won't start and therefore prevents httpd from starting. I know the private that was generated when the CSR was generated should be on the system but I can't locate it. Is there a way to regenerate a (missing) private key from a .crt file? Thanks.

Last edited by Latitude; 06-05-2019 at 03:31 PM.
 
Old 06-05-2019, 03:33 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Several links here that might be useful.
 
Old 06-05-2019, 03:42 PM   #3
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, EndeavourOS, OpenSUSE, KDE Neon
Posts: 4,006
Blog Entries: 26

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Can you regenerate the original key from a .crt, generally no. .crt files USUALLY have JUST the certificate in them which includes the PUBLIC key. The private key is usually in a keyfile (as you know).

To my knowledge, you're only real option if you can't find it is to create a NEW keypair and create a new CSR using that keypair to rekey the cert, that's the only thing I'm aware of that you'd be able to do if you can't find the existing key.
 
1 members found this post helpful.
Old 06-05-2019, 03:49 PM   #4
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
No, cannot reproduce a private key - this is by design. Sorry...

EDIT - if you have a pkcs12 file which is a binary file and has the public and private, yes, you can extract the private if you know the password to the file, but if you only have the base64 encoded public key and original request but not the private, I am afraid not.

Last edited by sevendogsbsd; 06-05-2019 at 03:52 PM.
 
1 members found this post helpful.
Old 06-06-2019, 07:15 AM   #5
Latitude
Member
 
Registered: Mar 2009
Posts: 65

Original Poster
Rep: Reputation: 16
Thanks for all the helpful information!
 
  


Reply

Tags
red hat linux, ssl authentication, tls



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Generate a Self-Signed SSL Certificate on Linux LXer Syndicated Linux News 0 11-09-2018 07:20 AM
SSL - Signed vs non-Signed wh33t Linux - Security 8 06-20-2014 12:59 PM
[OpenSSL] Why CRT key, which is self-signed, size is different? mahao_boy Linux - Software 1 03-15-2012 04:48 PM
[SOLVED] Send HTTP request signed using private key steven.c.banks Linux - General 1 09-22-2011 09:18 AM
Problem with sending a signed int to another signed int. Almost random number given. RHLinuxGUY Programming 8 08-15-2006 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration