pyas2lib
Python library for building and parsing AS2 Messages
What it is and what it does
pyas2lib is a pure-Python library for constructing and parsing AS2 protocol messages used in B2B secure file exchange. It handles the full message lifecycle: compression, signing, encryption, MIME construction on the sender side, and decompression, decryption, signature verification on the receiver side. It also manages MDN (Message Disposition Notification) responses, which confirm delivery and processing status. The library decouples message handling from HTTP transport, so you manage the network layer yourself.
The package depends on three cryptographic libraries: asn1crypto for ASN.1 parsing, oscrypto for low-level crypto operations, and pyOpenSSL for certificate and key management. It targets Python 3.7–3.10 and is classified as Beta. The library is suitable for applications that need to exchange EDI or other structured data with trading partners over HTTP using the AS2 standard (RFC 4130).
Use it for:
- Build and send encrypted, signed AS2 messages to trading partners and parse their MDN responses to confirm delivery.
- Receive and validate incoming AS2 messages from partners, verify signatures, decrypt payloads, and generate synchronous or asynchronous MDN receipts.
- Integrate AS2 message handling into a custom HTTP server or client without relying on a full EDI platform.
- Parse MIME-encoded AS2 payloads to extract and verify the integrity of transmitted EDI documents or files.
- Manage organization and partner credentials (signing keys, encryption certificates) for multi-partner B2B workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Builds and parses AS2 protocol messages with compression, signing, encryption, and MDN (Message Disposition Notification) handling for secure B2B file exchange.
Yes, if you need AS2 protocol support and can accept a copyleft GPL v2.0 license. The library is stable (Beta, no known vulnerabilities), has low install friction, and remains maintained. The 510-day release cycle suggests slow evolution rather than abandonment; check whether the feature set matches your AS2 requirements before committing. Not suitable for proprietary closed-source applications without a separate commercial license.
Install
pyas2lib on PyPI
pip
pip install pyas2libuv
uv add pyas2libpoetry
poetry add pyas2libInstalling pyas2lib
Before you install
Low install friction with three lightweight cryptographic dependencies (asn1crypto, oscrypto, pyOpenSSL). Maintenance is aging—last release 510 days ago—but the repository remains active with a recent commit on 2025-03-22 and no archived status.
License in practice
Licensed under GNU GPL v2.0 (copyleft). Any derivative work or distribution must also be open-source under GPL v2.0; proprietary applications cannot use this library without obtaining a different license.
Quickstart
from pyas2lib.as2 import Organization, Partner, Message
my_org = Organization(as2_name='my_id', sign_key=b'key', decrypt_key=b'key')
partner = Partner(as2_name='partner_id', sign=True, encrypt=True)
msg = Message(sender=my_org, receiver=partner)
msg.build(b'data_to_transmit')
Verify before relying
- Whether the library supports AS2 version 1.2 features beyond RFC 4130 baseline (e.g., newer compression or signing algorithms).
- Performance characteristics when processing large payloads or high-volume message streams.
- Whether the aging maintenance status (510 days since last release) indicates active development or dormancy.
Package facts
| License | GNU GPL v2.0 (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — asn1crypto, oscrypto, pyOpenSSL |
| Maintenance | aging — 510 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 119,745/month — #12,057 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyas2lib-1.4.4-py3-none-any.whl
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
pemParses and splits PEM files (Base64-encoded DER…
permissive · top 5,000 on PyPI
endesiveEndesive signs and verifies digital signatures…
unclear · top 15,000 on PyPI
securesystemslibSecuresystemslib provides a cryptography…
permissive · top 5,000 on PyPI
asn1cryptoA pure Python library for parsing and…
permissive · top 1,000 on PyPI
eip712Provides Python message classes for EIP-712…
permissive · top 15,000 on PyPI
PGPy13PGPy13 is a Python library for OpenPGP…
permissive · top 15,000 on PyPI
mail-parserParses raw email messages into structured…
permissive · top 5,000 on PyPI
pysequoiaPySequoia provides OpenPGP encryption,…
permissive · top 15,000 on PyPI
ed25519-blake2b-forkProvides Python bindings to Ed25519 digital…
permissive · top 15,000 on PyPI