Skip to main content

Python client library for the DaMe (Datennetz der Medizin) S/MIME mail exchange used by Austrian healthcare providers

Project description

señora

Python client library for DaMe — the Datennetz der Medizin S/MIME-based messaging network used by Austrian healthcare providers (operated by Telekom Austria / VTG, historically Gesundheitsnetz Vorarlberg).

This library replaces the legacy Java DaMe.jar client with a pure-Python implementation that can be embedded in e.g. Django or used standalone.

What this library does

  • Fetch S/MIME-encrypted mails from a DaMe POP3 mailbox, verify signatures, decrypt content, and expose attachments as plain bytes.
  • Sign and encrypt outgoing documents with your PKCS#12 identity, look up recipient certificates in the esignature.telekom.at LDAP directory, and submit them via the DaMe SMTP relay.
  • Generate and process S/MIME Message Disposition Notifications (MDN, RFC 8098).
  • Apply the DaMe filename policy (prefix-based sequence numbers).

What it deliberately does not do

  • EDIFACT parsing — use pydifact and pydifact-aek for Austrian laboratory findings.
  • DICOM send/receive — a separate tier, use pynetdicom.
  • GUI — this is a library.

Install

uv pip install senora

For local development:

uv venv
uv pip install -e '.[test]'
uv run pytest

Quick start

from pathlib import Path
from senora import Client, Identity, PeerLookup

identity = Identity.from_pkcs12(
    Path("certs/mykey.p12").read_bytes(),
    password="MEXXXXXX",
)

client = Client(
    identity=identity,
    pop3_host="mail.dame.at",
    pop3_port=995,            # POP3S (implicit TLS); default
    pop3_tls="ssl",           # default
    pop3_user="mexxxxxx@dame.at",
    pop3_password="...",
    smtp_host="dsmtp.dame.at",
    smtp_port=587,
    smtp_user="mexxxxxx@dame.at",
    smtp_password="...",
    peer_lookup=PeerLookup(server="ldap://esignature.telekom.at"),
)

# Receive
for msg in client.fetch(delete=False):
    for att in msg.attachments:
        Path("inbox", att.filename).write_bytes(att.content)

# Send
client.send(
    recipient_hv="ME654321",
    attachments=[("befund.edi", edi_bytes, "application/edifact")],
    cipher="AES",
    sign=True,
    request_mdn=True,
)

Security model

  • Private keys: loaded from PKCS#12 into memory only; never written to disk. Store P12 passphrases in an OS keyring, Vault, systemd-credentials, or an equivalent secret manager — never in source or config files.
  • TLS: POP3 fetch uses implicit TLS on port 995 by default (mail.dame.at:995, TLS 1.3, valid cert). SMTP submission uses STARTTLS on port 587. Legacy deployments without POP3S can opt back into plain port 110 by passing pop3_port=110, pop3_tls="none" — a cleartext warning will be logged on every connect.
  • CRL checking: optional, enabled via PeerLookup(check_crl=True).
  • Padding: S/MIME content encryption uses PKCS#7 padding; RSA key transport uses PKCS#1 v1.5 for compatibility with legacy DaMe peers.

Status

Alpha. Core primitives (S/MIME sign/verify/encrypt/decrypt, PKCS#12 loading, POP3/SMTP transport, LDAP peer lookup, filename policy) are implemented and unit-tested. Interop tests against the live mail.dame.at service are pending (see docs/TODO.md).

Project details


Download files

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

Source Distribution

senora-0.4.0.tar.gz (133.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

senora-0.4.0-py3-none-any.whl (61.0 kB view details)

Uploaded Python 3

File details

Details for the file senora-0.4.0.tar.gz.

File metadata

  • Download URL: senora-0.4.0.tar.gz
  • Upload date:
  • Size: 133.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for senora-0.4.0.tar.gz
Algorithm Hash digest
SHA256 83df5663c8d32f29ca5f641e9722621b6ea44da5c74bdeaae33997d076ba2ee3
MD5 87e42fc86d46d0fb27b305dff9b96644
BLAKE2b-256 c2f224c472bf829156b97ffdadf3e50d0b3ab8d626424d10147d2e833446caf6

See more details on using hashes here.

File details

Details for the file senora-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: senora-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 61.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for senora-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f45567ba444f053a4bded7a29961b749b5a66a9eaed3204d594c3ad9df323f9f
MD5 c7dfead085275c74816d18cda1b70549
BLAKE2b-256 48f903fd738fea01e5cb8c32df2b4cfbad20842e80cde8d48fb6a14a653e1a4c

See more details on using hashes here.

Supported by

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