How to extract Private key from keystore entry using keytool ?
How may I extract just the private key from the keystore entry of a public/private key pair originally generated by keytool -genkey ?I know how to extract the certificate (-export), but my understanding is that is only the public key.Thanks for help.
# 1
What do you mean "extract"? to which format?As I know, the best you can do is to use the new JDK 6 function "keytool -importkeystore" to export a whole privateKeyEntry to another keystore (can be another store type, say, pkcs12).
# 3
Well, yes, exporting a PrivateKeyEntry to a PKCS12 keystore does save (or, backup) your keypair as a copy on your disk, and it's quite a standard format. In fact, quite a lot of people get their keypair this way, and they can run -importkeystore to import (for you, restore) it into their JKS keystore.