Java 密钥库更改密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2889238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Keystore change passwords
提问by user313724
I currently have a keystore, with a particular password that only I should know. I now need to give access to that keystore to someone else, so I would like to either:
我目前有一个密钥库,有一个只有我应该知道的特定密码。我现在需要将该密钥库的访问权限授予其他人,因此我想:
1) Change the password, so I can share it with others and let them sign
2) Create a different password and allow them to sign with it.
1) 更改密码,以便我可以与他人共享并让他们签名
2) 创建一个不同的密码并允许他们使用它进行签名。
Is this possible? and - if yes - how?
这可能吗?和 - 如果是 - 如何?
采纳答案by ZZ Coder
Keystore only has one password. You can change it using keytool:
Keystore 只有一个密码。您可以使用 keytool 更改它:
keytool -storepasswd -keystore my.keystore
To change the key's password:
要更改密钥的密码:
keytool -keypasswd -alias <key_name> -keystore my.keystore
回答by Pascal Thivent
[How can I] Change the password, so I can share it with others and let them sign
[我该如何]更改密码,以便我可以与他人共享并让他们签名
Using keytool:
使用密钥工具:
keytool -storepasswd -keystore /path/to/keystore
Enter keystore password: changeit
New keystore password: new-password
Re-enter new keystore password: new-password
回答by OriolJ
To change the password for a key myalias
inside of the keystore mykeyfile
:
要更改myalias
密钥库中密钥的密码mykeyfile
:
keytool -keystore mykeyfile -keypasswd -alias myalias
回答by user98239820
Changing keystore password
更改密钥库密码
$ keytool -storepasswd -keystore keystorename
Enter keystore password: <old password>
New keystore password: <new password>
Re-enter new keystore password: <new password>
Changing keystore alias password
更改密钥库别名密码
$keytool -keypasswd -keystore keystorename -alias aliasname
Enter keystore password:
New key password for <aliasname>:
Re-enter new key password for <aliasname>:
Note:
笔记:
**Keystorename**: name of your keystore(with path if you are indifferent folder)
**aliasname**: alias name you used when creating (if name has space you can use \)
for example: $keytool -keypasswd -keystore keystorename -alias stop\ watch
回答by Ishan Liyanage
If the keystore contains other key-entries with different password you have to change them also or you can isolate your key to different keystore using below command,
如果密钥库包含其他具有不同密码的密钥条目,您也必须更改它们,或者您可以使用以下命令将您的密钥隔离到不同的密钥库,
keytool -importkeystore -srckeystore mystore.jck -destkeystore myotherstore.jks -srcstoretype jceks
-deststoretype jks -srcstorepass mystorepass -deststorepass myotherstorepass -srcalias myserverkey
-destalias myotherserverkey -srckeypass mykeypass -destkeypass myotherkeypass
回答by whyoz
There are so many answers here, but if you're trying to change the jks password on a Mac in Android Studio. Here are the easiest steps I could find
这里有很多答案,但是如果您尝试在 Android Studio 中的 Mac 上更改 jks 密码。这是我能找到的最简单的步骤
1) Open Terminal and cd to where your .jks is located
1) 打开终端并 cd 到 .jks 所在的位置
2) keytool -storepasswd -new NEWPASSWORD -keystore YOURKEYSTORE.jks
2) keytool -storepasswd -new NEWPASSWORD -keystore YOURKEYSTORE.jks
3) enter your current password
3) 输入您当前的密码
回答by Rafael Membrives
KeyStore Exploreris an open source GUI replacement for the Java command-line utilities keytool and jarsigner. KeyStore Explorer presents their functionality, and more, via an intuitive graphical user interface.
KeyStore Explorer是 Java 命令行实用程序 keytool 和 jarsigner 的开源 GUI 替代品。KeyStore Explorer 通过直观的图形用户界面展示其功能以及更多功能。
- Open an existing KeyStore
- Tools -> Set KeyStore password
- 打开现有的 KeyStore
- 工具 -> 设置 KeyStore 密码
回答by Alexander Pogrebnyak
For a full programmatic change (e.g. install program) and no prompting
对于完整的程序更改(例如安装程序)并且没有提示
#!/bin/bash -eu
NEWPASSWORD=
OLDPASSWORD=
keytool -storepasswd -new "${NEWPASSWORD}" \
-storepass "${OLDPASSWORD}" \
-keystore /path/to/keystore
Full disclosure: I DO NOT recommend running this command line in a shell, as the old and new passwords will be saved in the shell's history, and visible in console.
完全披露:我不建议在 shell 中运行此命令行,因为旧密码和新密码将保存在 shell 的历史记录中,并在控制台中可见。