skillfed

pyas2lib

Python library for building and parsing AS2 Messages

pyas2lib v1.4.4 119.7K downloads/30d#12,057 on PyPI48
Copyleft license GNU GPL v2.0 AGING released

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 pyas2lib

uv

uv add pyas2lib

poetry

poetry add pyas2lib

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License v3 (GPLv3)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: CommunicationsTopic :: Security :: Cryptography

Tags

AS2 message protocol libraryEDI AS2 messagingsecure file transfer AS2AS2 encryption signingB2B message protocolMIME message AS2MDN message disposition
b2b-messagingedi-protocolas2-standard

More Cryptography packages