Skip to main content

OpenPGP Card X25519 Agent

Socket interface to Curve25519 ECDH from an OpenPGP card, using the SSH agent protocol. It's intended to be used with the OpenPGP Card WireGuard Go client, allowing a WireGuard private key to be stored on an OpenPGP card.

See the OpenPGP Card WireGuard Guide for a complete walkthrough of installation and usage of both agent and client.

Development

Prerequisites

Requires Python 3.8 or newer, and the pcsc-lite daemon.

Install prerequisites on Debian with the following packages:

apt install gcc libpcsclite-dev make pcscd python3-dev python3-venv swig

Or on Fedora:

dnf install findutils gcc make pcsc-lite pcsc-lite-devel python3-devel swig

Set up dev env

Install uv, and from this project root run:

uv python install
uv sync

Dev tasks

Run unit tests:

uv run pytest

Run unit tests in watch mode:

uv run ptw .

Run unit tests with coverage report:

uv run pytest --cov

Run linter and auto-fix where possible:

uv run ruff check --fix

Run formatter:

uv run ruff format

Dev usage

Run agent listening at /var/run/wireguard/agent0:

sudo mkdir -p /var/run/wireguard && sudo chown $USER /var/run/wireguard
uv run openpgpcard-x25519-agent -l -vv

Or run agent listening on test socket:

uv run openpgpcard-x25519-agent -l -s test.socket -vv

Prompt to cache PIN on agent:

uv run openpgpcard-x25519-client -p -t -vv

Clear PIN from agent listening on test socket:

uv run openpgpcard-x25519-client -c -s test.socket -vv

Beware

  • Any client with access to the socket on which the agent is listening has full use of your OpenPGP card's decryption key when the agent has the card's PIN cached. An adversary with access to the socket can easily decrypt your WireGuard traffic, or impersonate your WireGuard identity; she also can decrypt regular OpenPGP messages encrypted for your card's decryption key.
  • Use of the agent requires the OpenPGP card's PIN to be cached in memory. After the card's PIN has been cached, if an adversary is able to dump your computer's memory, she will be able to recover the PIN.
  • Even after you clear the PIN or shut down the agent, there still may be copies of the PIN in memory that an adversary could recover.

Contributing

License

Copyright (c) 2023 Arcem Tene, Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Metadata

Release files for openpgpcard-x25519-agent 1.2.0

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

Source distribution (sdist)

Source distribution for openpgpcard-x25519-agent 1.2.0
File Size Uploaded
openpgpcard_x25519_agent-1.2.0.tar.gz 88.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openpgpcard-x25519-agent 1.2.0
File Interpreter ABI Platform
openpgpcard_x25519_agent-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 134.3 kB

Release files / openpgpcard_x25519_agent-1.2.0.tar.gz

Download URL openpgpcard_x25519_agent-1.2.0.tar.gz
Size 88.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6f45247e25a8a86cb3e8eacbaa3b4302e75257eb3da31daa1c37e487e845c105
BLAKE2b-256 checksum
How to use checksums
57d33d982af9996554cc7a7caf71680a8d480245d84fda3e682b23a96cc3ecde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release files / openpgpcard_x25519_agent-1.2.0-py3-none-any.whl

Download URL openpgpcard_x25519_agent-1.2.0-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1e337b7801abc34efa01d61b1bd05ca2bc25e6b6b95e5f5564c72a2b643f6dd
BLAKE2b-256 checksum
How to use checksums
675a1f3cf5abc1c637adb821d133ef2a357232af9884eb26299d154fd74743d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 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