我目前有一个密钥存储库,其中有一个只有我应该知道的特定密码。我现在需要将对密钥库的访问权授予其他人,因此我希望:

1)修改密码,这样我就可以和其他人分享,让他们签名 2)创建一个不同的密码,并允许他们使用该密码签名。

这可能吗?如果是,怎么做?


密钥存储库只有一个密码。你可以使用keytool更改它:

keytool -storepasswd -keystore my.keystore

修改密钥密码。

keytool -keypasswd  -alias <key_name> -keystore my.keystore

修改密码,这样我就可以与他人共享密码,并让他们签名

使用keytool:

keytool -storepasswd -keystore /path/to/keystore
Enter keystore password:  changeit
New keystore password:  new-password
Re-enter new keystore password:  new-password

使用实例修改密钥库mykeyfile中的密钥myalias的密码:

keytool -keystore mykeyfile -keypasswd -alias myalias

修改密钥库密码

$ keytool -storepasswd -keystore keystorename
Enter keystore password:  <old password>
New keystore password: <new password>
Re-enter new keystore password: <new password>

更改密钥库别名密码

$keytool -keypasswd -keystore keystorename -alias aliasname
Enter keystore password:  
New key password for <aliasname>: 
Re-enter new key password for <aliasname>:

注意:

**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

如果密钥存储库包含其他密码不同的密钥条目,您也必须更改它们,或者您可以使用以下命令将您的密钥隔离到不同的密钥存储库,

keytool -importkeystore  -srckeystore mystore.jck -destkeystore myotherstore.jks -srcstoretype jceks
-deststoretype jks -srcstorepass mystorepass -deststorepass myotherstorepass -srcalias myserverkey
-destalias myotherserverkey -srckeypass mykeypass -destkeypass myotherkeypass

这里有很多答案,但如果你试图在Android Studio中更改Mac上的jks密码。以下是我能找到的最简单的步骤

1)打开Terminal并cd到。jks所在的位置

2) keytool -storepasswd -new NEWPASSWORD -keystore YOURKEYSTORE.jks

3)输入当前密码

KeyStore Explorer是Java命令行实用程序keytool和jarsigner的开源GUI替代品。KeyStore Explorer通过直观的图形用户界面展示了它们的功能。

打开现有的KeyStore Tools ->设置“KeyStore密码”

用于完全的编程更改(例如安装程序),没有提示

#!/bin/bash -eu

NEWPASSWORD=${1}
OLDPASSWORD=${2}

keytool -storepasswd -new "${NEWPASSWORD}" \
  -storepass "${OLDPASSWORD}" \
  -keystore /path/to/keystore

完全披露:我不建议在shell中运行此命令行,因为旧密码和新密码将保存在shell的历史记录中,并且在控制台中可见。