Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know this has been asked before but almost only workarounds have been provided. None that solved my problem just yet.

I'm trying to create my own .sh file which will generate an apk. After using jarsigner it asks for a password of my keystore. Now the security on this part doesn't play a role a.t.m. so I was just wondering, how can I (either remove the password of my .keystore file or enter the password as plain text) achieve this?

The full command:

jarsigner -sigalg SHA1withRSA -digestalg SHA1 -verbose -keystore keyForApk.keystore 
  apk/android-release-unsigned.apk alias_name

Where it then prompts me the following:

Enter Passphrase for keystore:

Now via which command can I enter this dynamically after the jarsigner command?

share|improve this question
    
I'm not familiar with jarsigner, but it's possible that it's trying to directly read your terminal; test it out with echo | jarsigner -sigalg .... rest of it – Jeff Schaller Oct 17 at 13:44
    
for testing you can provide passwords in the command line with options -storepass and -keypass. see man jarsigner. – meuh Oct 17 at 13:51

You could use expect utility to automate your passphrase input. Create launcher script auto-jar.sh:

#! /usr/bin/expect

spawn jarsigner ... # actual command here
expect "Enter Passphrase for keystore: "
send "jar_password\r"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.