• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A utility that makes OpenKeychain available in your Termux shell

OkcAgent

Build status

A utility that makes OpenKeychain available in your Termux shell.

Features

This tool acts as a bridge/proxy between Termux and OpenKeychain, enabling you to perform crypto operations in Termux using your keys stored in OpenKeychain, like:

  • authenticate SSH connections
  • sign/verify/encrypt/decrypt messages

This tool implements the existing protocols in this field so you can seamlessly integrate it with other command line utilities like ssh and git.

Demonstration

Install

This project consists of two components: the OkcAgent app, and command line utilities to be used in the Termux shell. You need to install both of them to make it work.

The OkcAgent app

Command line utilities

How to use

  1. Install OpenKeychain, Termux and the necessary components mentioned above.
  2. Open the app and configure the keys to be used for crypto operations.
  3. Use the command line utilities.
    • okc-ssh-agent acts as an SSH agent. You can use okc-ssh-agent as ssh-agent, just eval $(okc-ssh-agent), it will set SSH_AUTH_SOCK to that path to inform programs like ssh to connect to it.
    • okc-gpg supports a limited set of GPG options so you can use it to perform some crypto operations. Read GpgArguments.kt for a complete list of supported options.

Starting okc-ssh-agent automatically

Like the normal ssh-agent, okc-ssh-agent needs to be started first to allow SSH clients to connect to it, and it will be handy to have it started automatically. You can put some startup script in ~/.bashrc or ~/.profile to start the agent when you open a new shell.

For v0.1.1 and earlier versions (of the command line tools, not the OkcAgent app), you need to spefify socket path as its first argument. Take a look at this issue for details.

Starting from v0.1.2, okc-ssh-agent supports most command line options of ssh-agent, so you can use the same script for ssh-agent to start okc-ssh-agent. For example, the following script will start okc-ssh-agent if there isn't one already running and then setup environment variables.

if ! pgrep okc-ssh-agent > /dev/null; then
	okc-ssh-agent > "$PREFIX/tmp/okc-ssh-agent.env"
fi
source "$PREFIX/tmp/okc-ssh-agent.env"

Or you can just add the following line to start it:

eval $(okc-ssh-agent)

Notes about the app

This app is available in Play Store at the price of $1. I didn't intend to make profit from this project and simply consider it as a way of donation. If you don't want to pay, you can always download the dev releases for free using the links mentioned above, or even build the app from its source code. However, please note that the APK files from these two sources are signed with different keys, which means that you have to uninstall the existing app first if you want to switch between them.

This app uses Bugsnag for error reporting.