Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 02-21-2013, 04:35 PM   #1
Registered: Aug 2002
Location: Alexandria
Distribution: ubuntu 12.04.2
Posts: 217

Rep: Reputation: 30
Using openssl to export JUST the public key?

Good evening everyone!

I had to create a new cert due to changes to the cryptography landscape. I do this so infrequently I constantly forget, but I'm in the process of writing a wikiHow article on it. :-)

I've done everything...except figure out a way to generate just my signed public key. I was able to convert my PEM key to a pkcs12 key, but this includes my private key. There must be a way to distribute a public key without e-mailing. I typically like to leave my public key on my website so that people can download it at their leisure instead of waiting on me to send it.

Is there a way to do this?

After hacking through the openssl pkcs12 manpage, here's what I've got:
openssl pkcs12 -export -out sohmc.public_cert.p12 -in CA_signed.public_key.pem -clcerts -nokeys -name "Sohmc - Public Key"
openssl asks for an export password, to which you should leave blank since you WANT people to add them. After generation, I verified this by issuing the following command and got the following output:
$ openssl pkcs12 -info -noout -in sohmc.public_cert.p12
Enter Import Password:
MAC Iteration 2048
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
My original pkcs12 file that contains both my private and public keys has the following output:
$ openssl pkcs12 -info -noout -in sohmc.public_private_certs.p12
Enter Import Password:
MAC Iteration 2048
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
Does this look right?

Last edited by sohmc; 02-21-2013 at 04:50 PM.


cryptography, openssl

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Unable to load Public Key (OpenSSL RSA, Debian Squeeze) gacanepa Linux - Newbie 1 11-29-2012 12:17 PM
SSH skips public key authentication for a key, but works with another key simopal6 Linux - General 1 07-06-2011 08:33 AM
Putty/SSH login failed when using RSA public key: 'Server refused our key' Linux - Server 10 10-04-2010 01:19 PM
OpenSSL Public Key Issue delite Programming 1 07-07-2010 08:46 PM
RSA public key encryption/private key decription koningshoed Linux - Security 1 08-08-2002 07:25 AM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:53 PM.

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