Skip to main content

Abstract

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_' > encryptor.py
import sys
from agentcrypt.io import Container
with Container.create(sys.stdout) as cntr:
  for line in sys.stdin:
    cntr.write(line)
_EOF_

remote-machine ~ % cat << '_EOF_' > decryptor.py
import sys
from agentcrypt.io import Container
with Container.load(sys.stdin) as cntr:
    print(cntr.getvalue().decode())
_EOF_

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

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

Or via the main guard of the package:

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

Motivation

  • 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.

Alternatives

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.

Documentation

API Documentation

Release files for agentcrypt 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentcrypt 0.5
File Size Uploaded
agentcrypt-0.5.tar.gz 13.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for agentcrypt 0.5
File Interpreter ABI Platform
agentcrypt-0.5-py3-none-any.whl Python 3 none any Details
agentcrypt-0.5-py2-none-any.whl Python 2 none any Details

Total release size: 41.2 kB

Release files / agentcrypt-0.5.tar.gz

Download URL agentcrypt-0.5.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e9000d95c169d71083112b0cd43b89345642c095d2ad03e0fa8ff7a9f27ff87f
BLAKE2b-256 checksum
How to use checksums
1cd1ee380716f59738af96ba1e13f53dbb27bdd89a1cd2bdbd6de46891b2d848
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.3

Release files / agentcrypt-0.5-py3-none-any.whl

Download URL agentcrypt-0.5-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abf06f2c77377b5aaadd38de845c5abd61241909d52dd02a5aae85bc953155c8
BLAKE2b-256 checksum
How to use checksums
e68e679b31be0d21f05dfcd9e8d85858bb84b3512811abb383faaeba327fa11b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.3

Release files / agentcrypt-0.5-py2-none-any.whl

Download URL agentcrypt-0.5-py2-none-any.whl
Size 12.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
e6c4b53c3322ff799f9db0c832d8a3d805d23102f505e8b1f0508f7ad14a0354
BLAKE2b-256 checksum
How to use checksums
679f6128ce6729049a3990ad78ff5d31ca40f36b52bdd04804b316f152dfc122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.3

Release history Release notifications | RSS feed

This release

0.5 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page