I have a single keystore (JKS) with a lot of key entries / aliases for different apps in it. Now one app will be moved to another developer and I want to export / extract the single key / alias for him.
> keytool.exe -list -keystore Keystorefile
Keystore-type: JKS
Keystore-provider: SUN
Keystore contains 6 entries
Appname1, 01.07.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
Appname2, 29.05.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
Appname3, 30.09.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
Appname4, 18.02.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
Appname5, 09.08.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
Appname6, 11.02.20XX, PrivateKeyEntry,
certificate-Fingerprint (SHA1): AA:BB:CC:DD:EE:FF:GG:HH:II:JJ:KK:LL:MM:NN:OO:PP:Q
Q:RR:SS:TT
This is the output of my Keystore, now I want to export only the Key for Appname2
. That this can be imported in another Keystore if possible.
Thanks!
This is bit less strigforward than exporting certificates (which can be exported with -exportcert
) as you need to use -importkeystore
and create new keystore with the key you want to "export", i.e.
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12 -srcalias ALIAS -deststorepass PASS -destkeypass PASS
Alternatively you can just copy your current keystore file and then remove all keys from it but the one you want to export.
You can also check Keystore Explorer tool
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With