keytool and private key

Posted on 2014-04-13
Last Modified: 2014-04-14
On a previous post I wrote

Could some one please post an example of a keytool creating a private key (and please explain what about the command makes the key private instead of public)

Open in new window

I was given an excellent reply

there is no such command. you always generate a keypair, which generates both a private and a public key. the difference is that in the standard sun keytool, there is no way to extract the private key, you can merely export either a certificate or a CSR with the public key. 

Open in new window

But this led me to wonder....   What if I need to export a private key.  How do I do it.  

Also, when I use the keytool to create a certificate, can I assume the certificate contains the public key ?

Question by:Anthony Lucia
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 29

Assisted Solution

becraig earned 500 total points
ID: 39997828
So the comment you got is correct.

Once you have the Key "Pair" public and private you can extract the "public key portion"

You can also export the private key for use with a system that will validate ssl communications.

But this led me to wonder....   What if I need to export a private key.  How do I do it.  
You can use several tools to do this including the mmc in microsoft windows, openssl commands among other things (it will be exported in pkcs / pfx format [password] protected])

Also, when I use the keytool to create a certificate, can I assume the certificate contains the public key ?
Yes once a certificate is created you will have a matching pair public / private since that is what drives the SSL certificate concept key pairs.
LVL 29

Accepted Solution

becraig earned 500 total points
ID: 39997833
LVL 33

Expert Comment

by:Dave Howe
ID: 39998490
easiest is the keytool iui gui tool

Featured Post

Now Available: Firebox Cloud for AWS and FireboxV

Firebox Cloud brings the protection of WatchGuard’s leading Firebox UTM appliances to public cloud environments. It enables organizations to extend their security perimeter to protect business-critical assets in Amazon Web Services (AWS).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which Hash Algorithm (SHA) to use for Certs + NPS + AD? 2 59
android samsung attempts 10 60
Verifying if VA scan's vulnerabilities are false positives 3 52
EFS Setup 9 28
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question