Android-从密钥库导出单个密钥/别名 [英] Android - export single key/alias from keystore
问题描述
我有一个密钥库(JKS),其中包含许多用于不同应用程序的密钥条目/别名.现在,一个应用程序将移至另一位开发人员,我想为他导出/提取单个密钥/别名.
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
这是我的密钥库的输出,现在我只想导出 Appname2
的密钥.可以将其导入另一个密钥库中.
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.
谢谢!
推荐答案
这比导出证书(可使用 -exportcert
导出证书)省去一些麻烦,因为您需要使用-importkeystore
并使用您要导出"的密钥创建新的密钥库,即
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 -destkeystorekeystore.p12 -deststoretype PKCS12 -srcalias ALIAS -deststorepass PASS-destkeypass通过
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.
您还可以检查 Keystore Explorer 工具
这篇关于Android-从密钥库导出单个密钥/别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!