Skip to main content

Symmetric encryption using the ssh-agent

Project description


Yet another implementation of the idea, to use the SSH agent for symmetric encryption. This time for Python (2+3).

Load a key and make an SSH connection with agent-forwarding:

local-machine ~ % ssh-add
local-machine ~ % ssh -A remote-machine

Create some agentcrypt enabled scripts on the remote host:

remote-machine ~ % cat << '_EOF_' >
import sys
from import Container
with Container.create(sys.stdout) as cntr:
  for line in sys.stdin:

remote-machine ~ % cat << '_EOF_' >
import sys
from import Container
with Container.load(sys.stdin) as cntr:

Use the newly created scripts with keys from the local ssh-agent:

remote-machine ~ % echo "secret data" |python > hushhush.dat
remote-machine ~ % python < hushhush.dat
secret data

Or via the main guard of the package:

remote-machine ~ % echo "secret data" |python enc > hushhush.dat
remote-machine ~ % python dec < hushhush.dat
secret data


  • Provide a convenient (passwordless) way of encrypting sensitive data for Python.

  • Profit from the fact that agent-forwarding makes SSH keys available on remote servers.


Why another implementation?

The ones I found on GitHub are either not Python or they rely on calls to external programs. I wanted a pure Python library, that runs with Versions 2.7 and 3.x.


API Documentation

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentcrypt-0.5.tar.gz (13.1 kB view hashes)

Uploaded source

Built Distributions

agentcrypt-0.5-py3-none-any.whl (15.7 kB view hashes)

Uploaded py3

agentcrypt-0.5-py2-none-any.whl (12.3 kB view hashes)

Uploaded py2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page