I am writing an Android app which needs to call an OpenSSH binary. Things get challenging when OpenSSH requires a password or passphrase. When run from something other than a terminal, I understand one can set the SSH_ASKPASS
environment variable to a binary with roughly the following specs:
- Command line arguments, if any, are used as a prompt.
- Exit status reports success if the user clicks OK, failure if the user canceled.
- The passphrase is printed on stdout.
On Android, this is a bigger challenge: basically, you would need to write a native binary which either:
- displays a GUI dialog and processes the result, or
- defers passphrase entry to the calling application, e.g. by sending a broadcast and then waiting for a response containing the passphrase
Are there any examples of this being done by Android apps?