I know that this is unsafe, but is there any easy way to pass passphrase to the jarsigner.exe:
jrsigner.exe -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ...
Enter Passphrase for keystore:
I am running it in batch file.
Well, why do you not simply use the corresponding parameters?
jarsigner -keystore my-keystore -storetype jceks -storepass "test" -keypass "test" my-archive.jar xander
Broken down into separate lines for better readability (but you have to put all parameters on one line, of course):
jarsigner
-keystore my-keystore # keystore path name
-storetype jceks # keystore type (whatever format yours is in)
-storepass "test" # keystore password
-keypass "test" # private key password
my-archive.jar # JAR path name
xander # key name (alias)
Update: Please note with regard to passwords that
My scenario was the Google plugin for Unity stopped passing the password to the jarsigner.
In the Sign() method, on file
\Assets\GooglePlayPlugins\com.google.android.appbundle\Editor\Scripts\Internal\BuildTools\JarSigner.cs
Change this:
var arguments = string.Format(
"-J-Duser.language=en -keystore {0} {1} {2}",
CommandLine.QuotePath(_keystoreName),
CommandLine.QuotePath(zipFilePath),
CommandLine.QuotePath(_keyaliasName));
to this:
var arguments = string.Format(
"-J-Duser.language=en " +
"-keystore {0} " + // keystore path name
"-storepass {1} " + // keystore password
"-keypass {2} " + // private key password
"{3} " + // JAR/ZIP/Bundle path name
"{4} ", // key name (alias)
CommandLine.QuotePath(_keystoreName),
_keystorePass,
_keyaliasPass,
CommandLine.QuotePath(zipFilePath),
CommandLine.QuotePath(_keyaliasName));