BDEW AS4 Guide

Configure makod for BDEW AS4-Profil 1.2 on asx 0.21: one identity per MP-ID, the SM-PKI trust anchor, partners, the sender policy, and testing.

View as Markdown

On this page 10 sections

AS4 has been the mandatory BDEW MaKo transport since 1 April 2024 (Strom, BK6-22-024) and 1 April 2025 (Gas, BK7-22-023). This guide covers operating makod on it.

makod speaks AS4 through asx 0.21 and its Profile::bdew() preset, which fixes every security and wire setting of BDEW AS4-Profil 1.2. Nothing in a makod configuration can relax it; what an operator configures is who the parties are and which PKI they belong to.


What the profile fixes

AspectValueBDEW AS4-Profil 1.2
SigningECDSA-SHA256 on BrainpoolP256r1, BinarySecurityToken X509PKIPathv1Kap. 2.2.6.2.1, Kap. 2.3.4.3
Signature scopeeb:Messaging (wsu:Id="as4-messaging"), the Body and every attachmentKap. 2.2.6.2.1
EncryptionECDH-ES + ConcatKDF + AES-128-GCM, key reference X509SKI — mandatoryKap. 2.2.6.2.2, Kap. 2.3.4.3
Ordergzip, then sign, then encryptKap. 2.2.6.2.2
PayloadSOAP-with-Attachments, empty SOAP Body, application/octet-stream partKap. 2.2.3.2
Compressiongzip, alwaysKap. 2.2.3.3
Serviceone of https://www.bdew.de/as4/communication/services/{MP,FP,RD,KW,SO}Kap. 2.3.1.2.1
Actionhttp://docs.oasis-open.org/ebxml-msg/as4/200902/action (fixed)Kap. 2.3.1.2.2
Roles…/200704/initiator / …/200704/responder (fixed)Kap. 2.3.1.2.3
ConversationIdemptyKap. 2.3.1.2.4
AgreementRefhttps://www.bdew.de/as4/communication/agreement, no pmode/typeKap. 2.3.2
Sendera signer whose SM-PKI certificate carries the eb:From MP-ID in its OU and exactly one URI subject alternative name, else EBMS:0101Kap. 2.3.2, Kap. 2.3.4.4; Regelungen zum Übertragungsweg für AS4 2.6 Kap. 5.2
Transportmutual TLS under BSI TR-03116-3 (TLS 1.2, TLS 1.3 from OpenSSL 3.2; ECDHE-ECDSA, Brainpool groups first), the SM-PKI root as the only TLS root, the server chain CRL-checked before a request is written, SNI for every host nameKap. 2.2.6.1; Regelungen zum Übertragungsweg für AS4 2.6 Kap. 3
RevocationCRL at every certificate's distribution point; a CA without a current CRL for 3 days is distrustedRegelungen zum Übertragungsweg für AS4 2.6 Kap. 5.4
Test servicereceipted, never deliveredKap. 2.3.6
Path switchrequestSwitch / confirmSwitch acceptedKap. 2.3.7

ConcatKDF uses the SP 800-56A raw-concatenation form, which is what BSI TR-03116-3 §9.2 requires. On receive, the eb:Messaging block the parser consumes is the block the signature verified, which closes XML Signature Wrapping.


One identity per MP-ID

BDEW AS4-Profil 1.2 Kap. 2.3.4.4 (S. 17): „Für die Signatur, die Verschlüsselung und den Aufbau der TLS-Verbindung MÜSSEN unterschiedliche Schlüsselpaare verwendet werden. Die Schlüsselpaare MÜSSEN EC-basiert sein. … Die MP-ID MUSS Teil des Zertifikatsgegenstandsnamens sein und mit der PartyId übereinstimmen". Regelungen zum Übertragungsweg für AS4 2.6 Kap. 5.2 (S. 6) places it: „Das Feld Organisational Unit („OU") des Subject muss die MP-ID enthalten", and allows one web-service address per certificate.

A receiving MSH therefore checks the signing certificate's OU against eb:From, and makod holds one AS4 client per [[party]], each with its own three key pairs. A Lieferant in Strom and Gas holds two:

[deployment]
tenant = "stadtwerke-musterstadt"
rollen = ["lf-strom", "lf-gas"]

# Strom identity: BDEW-Codenummer (99…)
[[party]]
mp_id   = "9900357000004"
primary = true
roles   = ["LF"]

[party.as4]
signing_cert_pem_file    = "/etc/makod/9900357000004/signing.cert.pem"   # EMT.MAK leaf, then intermediates
signing_key_pem_file     = "/etc/makod/9900357000004/signing.key.pem"
encryption_cert_pem_file = "/etc/makod/9900357000004/encryption.cert.pem"
encryption_key_pem_file  = "/etc/makod/9900357000004/encryption.key.pem"
tls_cert_pem_file        = "/etc/makod/9900357000004/tls.cert.pem"
tls_key_pem_file         = "/etc/makod/9900357000004/tls.key.pem"

# Gas identity: DVGW-Codenummer (98…)
[[party]]
mp_id = "9800357000005"
roles = ["LFG"]

[party.as4]
signing_cert_pem_file    = "/etc/makod/9800357000005/signing.cert.pem"
signing_key_pem_file     = "/etc/makod/9800357000005/signing.key.pem"
encryption_cert_pem_file = "/etc/makod/9800357000005/encryption.cert.pem"
encryption_key_pem_file  = "/etc/makod/9800357000005/encryption.key.pem"
tls_cert_pem_file        = "/etc/makod/9800357000005/tls.cert.pem"
tls_key_pem_file         = "/etc/makod/9800357000005/tls.key.pem"

[as4]
addr                  = "0.0.0.0:4080"
message_id_domain     = "as4.company.example"
trust_anchor_pem_file = "/etc/makod/sm-pki-root.pem"
crl_signer_pem_file   = "/etc/makod/sm-pki-ccrl-s-root.pem"

Each MP-ID is served at its own path, so each certificate's SAN names one address:

Company X
  MP-ID Strom  9900357000004 ─► https://as4.company.example/as4/inbox/9900357000004
  MP-ID Gas    9800357000005 ─► https://as4.company.example/as4/inbox/9800357000005

An inbox answers only for its own eb:To. Outbound, the client of the interchange's sender (UNB DE0004, the same MP-ID as NAD+MS) signs — so the certificate a partner checks is the one issued to the MP-ID it reads in eb:From.

Mutual TLS

Every party loads its TLS key pair, a party that only receives included: tls_cert_pem_file / tls_key_pem_file become the party's LocalParty::tls_identity, an EC key, and asx's built-in client (OpenSSL) presents it on every connection to a partner MSH. BDEW AS4-Profil 1.2 Kap. 2.2.6.1 (S. 10) states „Client-Authentifizierung ist ERFORDERLICH.", and the TLS certificate is the third of the Zertifikatstripel (Regelungen zum Übertragungsweg für AS4 2.6 Kap. 1.3, S. 3), so a [party.as4] without the pair stops the boot naming both. The client trusts the SM-PKI root alone, checks the server chain against the CRLs before it writes a request, and names the partner's host by Server Name Indication, which Kap. 3 (S. 5) requires — so a partner address is a DNS name, never an IP address. A TLS refusal — an unknown CA, a host the certificate does not name, a revoked server certificate — is a transport error with nothing written: the outbox retries the same message.

asx owns no listener. Inbound, --as4-addr binds a plain HTTP listener, and the server side of mutual TLS belongs to the terminator in front of it. BDEW AS4-Profil 1.2 Kap. 2.2.6.1 binds that component as it binds the MSH: „Wenn die TLS-Verbindung nicht im AS4 Message-Handler, sondern in einer anderen Komponente beendet wird, dann MUSS diese andere Komponente die Anforderungen erfüllen." So the terminator

  • speaks TLS 1.2 or 1.3 with the cipher suites BSI TR-03116-3 recommends, Brainpool groups included, and serves the SM-PKI TLS certificate whose URI subject alternative name is the inbox's address;
  • answers by SNI for each inbox host;
  • requires a client certificate and verifies it against the SM-PKI root (and its CRLs) — a connection without one is refused before it reaches makod.

The repository ships no AS4 terminator configuration (desk/deploy/ serves the Desk, not the AS4 port); whichever proxy an operator puts in front of --as4-addr carries these settings. It must pass the request through unaltered: asx refuses a request with a repeated Content-Type header, and a MIME part with a repeated Content-ID or Content-Type, as malformed, so a proxy that adds its own Content-Type beside the sender's makes every message fail. makod's own AS4 route adds no header to the request.

Trust: the SM-PKI root and the CRL signer

as4.trust_anchor_pem_file is the SM-PKI root and the only trust anchor — every partner signer and every local signer must chain to it; the operator's own certificate is never an anchor. as4.crl_signer_pem_file is the SM-PKI CCRL-S(Root), which signs the indirect CRL of the Root-CA (BSI TR-03109-4 §4.2.1); asx checks that it chains to the root and asserts cRLSign. Outbound HTTP must reach the SM-PKI CRL distribution points (plain http is allowed for CRLs).

Startup checks

makod runs As4::builder(Profile::bdew())…build() for every [[party]] in its preflight, so --check reports what the boot would refuse:

RefusedWhy
A [[party]] without [party.as4] beside one with it, or --as4-addr with noneEach MP-ID needs its own key pairs
No trust_anchor_pem_file, crl_signer_pem_file or message_id_domainNo verification, no revocation check, no message id
A signer that does not chain to the root, an expired certificate, a missing decrypter, a TLS key that is not ECThe asx Config refusal names the setting and the section
A [party.as4] without tls_cert_pem_file / tls_key_pem_fileBDEW AS4-Profil 1.2 Kap. 2.2.6.1 (S. 10); Regelungen zum Übertragungsweg für AS4 2.6 Kap. 1.3 (S. 3)
A [party.as4] signing, encryption or TLS certificate, or a partner signing or encryption certificate, whose subject OU is not that party's MP-ID, or that names no URI subject alternative name or severalRegelungen zum Übertragungsweg für AS4 2.6 Kap. 5.2 (S. 6)
Two of a party's three certificates certifying one key pair, or a partner whose signing certificate certifies its encryption keyKap. 2.3.4.4 — compared by key value, so a re-issued certificate over the same key is the same key pair
A partner endpoint on http:// or without an encryption certificateKap. 2.2.6.2.2
A partner endpoint other than its encryption certificate's addressKap. 2 (S. 4)
A partner address on an IP addressSNI carries a host name (Kap. 3, S. 5)
as4.zertifikat_warnfenster_tage below 14Ten Werktage are never fewer than 14 days; a shorter window reports an own certificate after its successor was due (Kap. 5.3, S. 6)
A [[as4.partner]] naming one of the deployment's own MP-IDsA self-addressed message is delivered in-process
[[as4.partner]] quirks, as4.lenient_receipts or MAKOD_AS4_LENIENT_RECEIPTSNo receipt relaxation exists — see Receipts

The asx refusals name the rule by its short form, RzÜ AS4 2.6 Kap. n; the finding in GET /admin/einrichtung and --check-config carries the full source. Each de0004_ausnahme entry is a startup warning there.


Partners

Every counterparty is one [[as4.partner]]:

[[as4.partner]]
mp_id                    = "9900000000001"
encryption_cert_pem_file = "/etc/makod/partners/9900000000001.enc.pem"
signing_cert_pem_files   = ["/etc/makod/partners/9900000000001.sig.pem"]

# The same NB in its Gas role is a second partner — its own MP-ID and
# certificates, its own address in them. `endpoint` is optional and, when
# set, must be the address the encryption certificate names.
[[as4.partner]]
mp_id                    = "9800000000002"
endpoint                 = "https://netzbetreiber-a.example/as4/inbox/9800000000002"
encryption_cert_pem_file = "/etc/makod/partners/9800000000002.enc.pem"
KeyMeaning
endpointOptional. The partner's inbox is the URI subject alternative name of its encryption certificate (Regelungen zum Übertragungsweg für AS4 2.6 Kap. 2, S. 4); omitted, it is taken from there. Set, it must be that address — scheme and host case and the default port do not count — over https on a host name
encryption_cert_pem_fileWhat makod encrypts to, its OU the partner's MP-ID; with it the partner is deliverable. Omit it for a partner makod only receives from
signing_cert_pem_filesPins: the partner's messages must be signed by one of these (list both for a rollover, Regelungen zum Übertragungsweg für AS4 2.6 Kap. 5.3). Without pins the SM-PKI chain and the OU decide
agencyNAD DE3055 agency of the MP-ID; derived from its prefix when omitted
de0004_ausnahmeMP-IDs this partner may name in UNB DE0004; see The interchange envelope

The party type in eb:PartyId/@type follows the agency — …iso6523:0088 (GLN), …unregistered:BDEW, …unregistered:DVGW, …unregistered:BAHN (Kap. 2.3.1.1) — the same agency the EDIFACT layer writes into NAD DE3055, so the two vocabularies cannot disagree for one MP-ID. A message for an MP-ID that is not a partner with an encryption certificate is dead-lettered as PartnerUnknown.

Configured endpoints are seeded into the durable partner store, alongside the PARTIN Kommunikationsdaten (PIDs 37000–37006 Strom, 37008–37014 Gas).

Who may send

asx accepts a sender only when its signature verifies under the SM-PKI root and its certificate's OU carries the claimed MP-ID (and, for a partner with pins, the signer is one of them). [policy.as4] unbekannte_absender decides about a sender that is not a [[as4.partner]]:

ValueBehaviourSource
nur_konfigurierte (default)Refused before dispatch, answered EBMS:0202 (retryable — once configured, the sender's next retry is served)BDEW AS4-Profil 1.2 Kap. 2.3.7 (S. 19): certificates „KÖNNEN … auf der Grundlage der MP-ID im OU-Feld abgelehnt werden (Whitelist)"
bdew_ou_zulassenServedBDEW AS4-Profil 1.2 Kap. 2.3.2 (S. 16): any eb:From is accepted „sofern sie mit den entsprechenden Betreff-Feldern im vorgelegten Zertifikat übereinstimmen"

The interchange envelope

Inside a verified message, the EDIFACT UNB is bound to the AS4 layer before anything is dispatched. Each refusal is dead-lettered, then answered EBMS:0004:

CheckRefused whenSource
RecipientDE0010 is none of this deployment's MP-IDs (a combined-role instance passes under each of them)Allgemeine Festlegungen 6.1d Kap. 2.13 (S. 17)
SenderDE0004 is not the authenticated eb:FromKap. 2.13 (S. 17): „Die im UNB- und NAD-Segment für den Absender / Empfänger verwendeten MP-ID sind identisch."; BDEW AS4-Profil 1.2 Kap. 2.3.4.4 (S. 17): the MP-ID in the certificate matches the PartyId

A payload whose UNB does not parse reaches neither check; it is dead-lettered as unparseable and refused the same way.

A Dienstleister that authenticates as itself and sends for another market participant is admitted only by name, per partner, and every entry is a startup warning (as4.partner[i].de0004_ausnahme):

[[as4.partner]]
mp_id           = "9900000000001"
de0004_ausnahme = ["9900000000002"]

Receipts

Every synchronous receipt is verified: signed by the partner, referring to the sent message id, and echoing the signed digests as NonRepudiationInformation. A receipt without NonRepudiationInformation is no delivery, for every partner: Regelungen zum Übertragungsweg für AS4 2.6 Kap. 7.3 (S. 8): „Ohne eine NRR gilt die Übertragung als gescheitert." No setting relaxes it; a [[as4.partner]] quirks key or as4.lenient_receipts stops the boot, naming that rule.


Message flow

Inbound

sequenceDiagram
    autonumber
    participant P as Partner MSH
    participant TLS as TLS terminator
    participant RL as makod rate limits
    participant ASX as asx Inbound
    participant H as makod handler
    participant D as Dedup store

    P->>TLS: HTTPS POST /as4/inbox/MP-ID
    TLS->>RL: plain HTTP
    Note over RL: per peer address, per claimed eb:From
    RL->>ASX: request (64 MiB, 120 s body limit)
    Note over ASX: signature, SM-PKI chain, OU = eb:From, pins,<br/>CRL check, decryption, eb:To = this inbox
    ASX->>D: claim
    alt duplicate
        ASX-->>P: fresh signed receipt
    else in flight
        ASX-->>P: 503
    else first seen
        ASX->>H: Verified UserMessage
        Note over H: sender policy, UNB checks, payload validation
        alt Ok
            ASX->>H: signed receipt and audit leg
            H->>H: retain receipt and dispatch routed EDIFACT at its signed time
            ASX->>D: accept
            ASX-->>P: signed receipt (NRR)
        else refused after its dead letter
            ASX->>D: abandon
            ASX-->>P: EBMS:0004 (not retried)
        else nothing recorded
            ASX->>D: abandon
            ASX-->>P: EBMS:0202 (retryable)
        end
    end

An unsigned message is answered EBMS:0103, a signature that does not verify EBMS:0101, a decryption failure EBMS:0102. Accepted dedup keys are kept for 8 days: asx 0.21 accepts an eb:Timestamp up to 7 days old and requires the store to remember accepted keys at least that long.

Each local MP-ID retains the signed receipt for every accepted delivery and retransmission. The first accepted leg supplies the timestamp for all routed EDIFACT messages in the interchange. Compare its receipt ID and timestamp with the partner’s copy. A duplicate can have a different receipt ID and time. GPKE Teil 1, chapter 7, p. 27 uses the positive Zustellquittung for ÜT and ÜZ.

A Lieferbeginn confirmation with an open incumbent inquiry uses native AS4, including delivery to a hosted applicant. Configure the applicant as a partner so the sender can obtain and retain its signed receipt. If that receipt is missing, the dependent 55037 stays held. The NB case keeps the first retained evidence for each leg. A completed internal delivery is labeled local. GPKE Teil 2, chapter 2.1.2 step 10, pp. 23–24

One limit, mako_as4::constants::MAX_MESSAGE_BYTES (64 MiB), bounds both the request an inbox reads and what its payloads decompress to: gzip expanding the whole message beyond it is refused with EBMS:0303 before the handler sees anything. A message carries exactly one payload part — Regelungen zum Übertragungsweg für AS4 2.6 Kap. 7.2 (S. 8): „Es wird genau eine Übertragungsdatei übermittelt." — and its eb:PartProperties are recorded on the receive log line. They are not checked: BDEW AS4-Profil 1.2 Kap. 2.3.5 (S. 18) says a receiving party „KANN die durch diese Eigenschaften gegebenen Informationen nutzen" and gives it no duty.

A refused message is dead-lettered before its claim is released, with the write awaited, and the refusal is permanent (EBMS:0004); check-as4-controls keeps every permanent refusal behind its dead letter. When the dead letter itself cannot be written, the refusal is the retryable EBMS:0202, so the message comes round again.

Outbound

sequenceDiagram
    autonumber
    participant OB as Outbox worker
    participant S as makod sender
    participant ASX as asx As4
    participant P as Partner MSH

    OB->>OB: record first_attempt_at once, durably
    OB->>S: outbox entry
    S->>S: render, AHB gate, pick the client of UNB DE0004
    S->>ASX: Message to partner, Service MP, id outbox-id at domain, timestamp first_attempt_at
    ASX->>P: gzip, sign, encrypt, POST
    alt verified receipt
        P-->>ASX: signed eb:Receipt
        ASX-->>S: Verified Receipt
        S->>S: keep receipt evidence
        S->>OB: acknowledge
    else eb:Error, unverifiable receipt, transport or TLS failure
        ASX-->>S: error, retryable
        S->>OB: back off and resend the same message
    end

Every attempt of one outbox entry is the same AS4 message: the eb:MessageId is <outbox id>@<message_id_domain> (RFC 2822 §3.6.4) and the eb:Timestamp is the first attempt, which the worker records durably before the first send. gzip and the Content-IDs are deterministic, so a retry reproduces every digest the partner's NRR covers, and a receiver already holding the message answers it as a duplicate. The retry window is 72 hours (mako_as4::constants::MAX_RETRY_DURATION_SECS); a configuration refusal is permanent.

The payload part is named after Allgemeine Festlegungen V6.1d Kap. 2.12 (Nachrichtentyp_Anwendungsreferenz_von_an_yyyymmdd_DAR.txt, the Anwendungsreferenz from UNB DE0026) and carries the eb:PartProperties of Regelungen zum Übertragungsweg für AS4 2.6 Kap. 6 (S. 7), read from the interchange's envelope by mako_as4::PartProperties:

PropertyValue
BDEWDocumentTypeUNH DE0065, e.g. UTILMD
BDEWApplicationReferenceUNB DE0026, only when the interchange carries one
BDEWDocumentDatethe interchange's creation date, UNB DE0017, as YYYY-MM-DD
BDEWDocumentNoUNB DE0020, the Datenaustauschreferenz

BDEWFulfillmentDate, BDEWSubjectPartyID and BDEWSubjectPartyRole are not used (Kap. 6), and one AS4 message carries one Übertragungsdatei (Kap. 7.2). The send runs in a span parented on the outbox entry's trace context; no traceparent header goes to the partner.


Testing with a test SM-PKI

The tests use asx::testkit (the test-util feature of asx, a dev-dependency only): TestCa::sm_pki() plays the SM-PKI root and bdew_party_at(mp_id, url) issues separate BrainpoolP256r1 signing, encryption and TLS key pairs with the MP-ID as OU and url as the one URI subject alternative name (bdew_party(mp_id) issues at https://mp<mp_id>.testkit.example/as4); Loopback carries requests between two real clients with no socket and serves each test CA's CRL; tls::TlsMsh is a real MSH on 127.0.0.1 that requires a client certificate, reached by Builder::resolve(host, msh.addr()), with pki::CRL_HOST pinned to msh.crl_addr().

[dev-dependencies]
asx = { version = "0.21", features = ["test-util"] }
#[tokio::test]
async fn a_push_is_receipted() {
    let ca = asx::testkit::pki::TestCa::sm_pki();
    let url = "https://lf.test/as4/inbox/9900357000005";
    let nb = ca.bdew_party("9900357000004");
    let lf = ca.bdew_party_at("9900357000005", url);
    let loopback = asx::testkit::loopback::Loopback::new();

    let lf_client = asx::as4::As4::builder(asx::Profile::bdew())
        .local(lf.local())
        .trust_anchor(ca.anchor())
        .http_client(loopback.clone())
        .build()
        .unwrap();
    loopback.mount(
        url,
        lf_client.inbound(
            asx::MemoryDedup::default(),
            |_msg: asx::Verified<asx::as4::UserMessage>| async { Ok(()) },
        ),
    );

    let nb_client = asx::as4::As4::builder(asx::Profile::bdew())
        .local(nb.local())
        .trust_anchor(ca.anchor())
        .partner(lf.partner(url))
        .http_client(loopback.clone())
        .build()
        .unwrap();
    let message = asx::as4::Message::to(&lf.partner(url))
        .service(mako_as4::Service::Marktprozesse.uri())
        .payload(asx::Payload::new(b"UNB+...".to_vec(), "application/octet-stream"));
    nb_client.send(message).await.unwrap();
}

services/makod/tests/it/as4_security.rs drives makod's own clients, sender and inbox this way.

Certificate expiry and rotation

makod re-reads every [party.as4] and [[as4.partner]] certificate while it runs. GET /admin/einrichtung reports one that expires inside as4.zertifikat_warnfenster_tage (default 30, at least 14) and an expired one as blocking, and /metrics exports makod_certificate_expiry_days{pfad}. The successor is due at least 10 Werktage before a certificate becomes invalid (Regelungen zum Übertragungsweg für AS4 2.6 Kap. 5.3, S. 6).

Requesting a certificate from the Sub-CA, renewing it, installing it and keeping its private key are the operator's, in its own key store: makod reads the key material from the configured files, reports its expiry and picks up a replaced file. It holds no HSM integration and talks to no CA.

Replace the files in place to rotate. Every five minutes makod rebuilds the AS4 clients and inboxes from changed key material, with no restart:

Key pairFrom the swap
SigningThe new key signs at once; its certificate travels in every message (Kap. 5.3)
EncryptionThe new key decrypts, and the replaced one keeps decrypting until its certificate expires, because partners may encrypt to either inside the overlap
TLSThe new identity opens the next connection
Partner pinsSeveral signing_cert_pem_files admit a partner's rollover

Material that does not build is logged and the running clients stay.

What Regelungen zum Übertragungsweg für AS4 2.6 binds

RuleKap., S.In makod
Signing, encryption and TLS certificate form one Zertifikatstripel1.3, S. 3Three key pairs per [party.as4], distinct by key value (asx build()); no party without its TLS pair
The AS4 address is taken from the certificate's URI alternative name2, S. 4Omitted, endpoint is taken from it; set, it must equal it
Exchange and enter communication data within 3 Werktage, keep a path 3 years, announce a change 10 Werktage ahead2, S. 4The operator's
A partner's expired or revoked certificate is replaced from the CA2.2, S. 5The monitor reports partner certificates too; the replacement is the operator's
TLS uses SNI3, S. 5asx sends the host name; a partner address on an IP address is refused
One path with one endpoint between two MP-IDs4, S. 5One [[as4.partner]] per MP-ID, one inbox per [[party]]
Messages under any valid published certificate of an MP-ID are processed4, S. 5Several signing_cert_pem_files; retired decryption keys
A failed delivery is repeated within the process Fristen4, S. 5The outbox retries the same message for 72 hours
SM-PKI, Sub-CA per its CP5, 5.1, S. 6trust_anchor_pem_file is the SM-PKI root, the only anchor
OU carries the MP-ID; one URI alternative name5.2, S. 6Refused at startup by build() for own and partner certificates; an inbound signer without one URI is EBMS:0101
Successor 10 Werktage before expiry; both generations processed in the overlap5.3, S. 6Warning window ≥ 14 days; restart-free rotation keeps the replaced decryption key
CRL revocation; a CA without a CRL for 3 days is distrusted5.4, S. 7Profile::bdew(); crl_signer_pem_file
PartProperties BDEWDocumentType, BDEWApplicationReference, BDEWDocumentDate, BDEWDocumentNo; three not used6, S. 7Set on every outbound payload from the EDIFACT envelope; recorded inbound
Test service before the first exchange7.1, S. 7Received and receipted by asx; sending one is the operator's
Service MP and the fixed Action; no pre-compressed file; one file per message7.2, S. 8BdewAction::service; gzip by asx only; one payload
Success only on a synchronous NRR7.3, S. 8The outbox acknowledges a receipt with verified NonRepudiationInformation only; no setting relaxes it
Processing stops for a revoked or invalid certificate8, S. 8asx chain, validity and CRL check
EBMS:0101, EBMS:0102, EBMS:01039, S. 10asx answers each

What the general Regelungen zum Übertragungsweg 1.11 binds

Nothing in makod. Version 1.11 (anzuwenden ab 01.04.2027, BNetzA Mitteilung Nr. 58) is the document for E-Mail, AS2, SFTP and REST, and every change it makes over 1.10 (Kap. 18, Änd-ID 12498–12503, S. 41–43) is in one of those channels:

Änd-IDKap., S.ChangeIn makod
124987, S. 13AS2-Steckbrief Version 4No AS2 channel
124997.4, S. 14AS2 over https on port 443 becomes a MUSSNo AS2 channel
12500–1250210.2, S. 19–20REST: one TLS server certificate per MP-ID; the client certificate needs the TLS-Clientauthentifizierung EKU and may be the server certificate or the S/MIME certificate of Kap. 5No REST (/data, /comtest) channel, and no S/MIME certificate anywhere
1250313, S. 31BSI TR-02102-4 (SSH) Stand 27.01.2026No SFTP channel

AS4 takes its certificates from Regelungen zum Übertragungsweg für AS4 2.6 — the SM-PKI Zertifikatstripel of signing, encryption and TLS certificate (Kap. 1.3, S. 3) — and the API-Webdienste from Regelungen zum Übertragungsweg für API-Webdienste 1.2 (Kap. 3.2, S. 4; Kap. 4, S. 4–6). Neither refers to the general document, so the S/MIME-for-mTLS option of Kap. 10.2 reaches no makod connection.

Certificate requests with OpenSSL

Production certificates are EMT.MAK certificates of an SM-PKI CA. The requests carry the MP-ID as the subject OU (Regelungen zum Übertragungsweg für AS4 2.6 Kap. 5.2).

Each also names the inbox address as its one URI subject alternative name (Kap. 5.2); the TLS certificate names the host as a DNS name besides:

url=https://as4.company.example/as4/inbox/9900357000004
for use in signing encryption tls; do
  san="URI:$url"
  [ "$use" = tls ] && san="$san,DNS:as4.company.example"
  openssl ecparam -name brainpoolP256r1 -genkey -noout -out "$use.key.pem"
  openssl req -new -key "$use.key.pem" -out "$use.csr.pem" \
    -subj "/CN=Test NB $use/OU=9900357000004/O=Test NB/C=DE" \
    -addext "subjectAltName=$san"
done

# Check the curve and the OU
openssl ec -in signing.key.pem -text -noout | grep "ASN1 OID"
openssl req -in signing.csr.pem -noout -subject

Supported EDIFACT message types (BdewAction)

mako_as4::BdewAction names the 16 standard BDEW EDIFACT message types; any other is BdewAction::Custom with its UNH DE0065 name. Under BDEW AS4-Profil 1.2 the type travels in the payload and its file name — the AS4 Action is the profile's fixed value — and every type is sent under the Marktprozesse service (BdewAction::service, Kap. 2.3.1.2.1).

VariantEDIFACT typeUsed in
UtilmdUTILMDGPKE, WiM, GeLi Gas, WiM Gas
AperakAPERAKAll processes
ContrlCONTRLAll processes
MsconsMSCONSMeter readings / time series
InvoicINVOICGPKE NNE, WiM MSB, GeLi Gas AWH, MABIS
RemadvREMADVGPKE, MABIS billing
IftstaIFTSTAGPKE Sperrung / Entsperrung
OrdrspORDRSPGPKE Konfiguration, WiM Geräteübernahme
OrdersORDERSWiM Geräteübernahme, GPKE Sperrung
OrdchgORDCHGWiM Stornierung, GeLi Gas AWH Stornierung
ReqoteREQOTEWiM Preisanfrage MSB
InsrptINSRPTWiM Ablesesteuerung / Gerätebefund
PricatPRICATWiM Preisliste MSB
QuotesQUOTESWiM Preisanfrage MSB response
PartinPARTINGPKE Kommunikationsdaten (PIDs 37000–37006), GeLi Gas (PIDs 37008–37014)
UtiltsUTILTSBerechnungsformel, Zählzeit- und Schaltzeitdefinitionen
use mako_as4::{BdewAction, Service, bdew_action_from_str};

assert_eq!(BdewAction::Partin.to_string(), "PARTIN");
assert_eq!(bdew_action_from_str("UTILTS"), BdewAction::Utilts);
assert!(matches!(bdew_action_from_str("SLSFCT"), BdewAction::Custom(_)));
assert_eq!(BdewAction::Mscons.service(), Service::Marktprozesse);

BDEW Verzeichnisdienst — API-Webdienste endpoint discovery

The BDEW Verzeichnisdienst (Regelungen zum Verzeichnisdienst 1.1) is a registry for API-Webdienste Strom endpoints (SM-PKI certificate class EMT.API). It is not used for AS4 EDIFACT delivery — AS4 inbox endpoints are configured per [[as4.partner]] and exchanged via PARTIN Kommunikationsdaten (PIDs 37000–37006 Strom, 37008–37014 Gas).

makod uses the Verzeichnisdienst exclusively to discover MaLo-Identifikation callback URLs (API-Kennung maloIdV1, stored as CommunicationChannel { qualifier: "AW" } in the partner store):

--verzeichnisdienst-url https://<verzeichnisdienst-host>/api/directory/v1

At startup and every 5 minutes, makod queries GET <base-url>/record/<lf_mp_id>/maloIdV1/1/v1 for each known LF and refuses a record whose signature does not verify against the provider's EMT.API certificate in [maloid] verzeichnisdienst_signing_certs, which must chain to verzeichnisdienst_trust_anchor_pem_file. Static --maloid-partner GLN=URL entries always take priority.


Troubleshooting

SymptomLikely causeFix
Startup refuses an identity "does not build"The asx message names the settingA signer outside trust_anchor_pem_file, a certificate without the MP-ID in its OU or without exactly one URI subject alternative name, a partner endpoint other than its certificate's address, an expired certificate
Sends fail with a transport error naming TLSThe handshake was refused before anything was writtenThe partner's server certificate does not chain to the SM-PKI root, does not name the host, or is revoked; the outbox retries for 72 hours
Every inbound message refused as malformed behind a proxyA repeated Content-TypeThe terminator in front of --as4-addr must pass the request through unaltered
Counterparty rejects our signatureIts OU check failsThe signing certificate of the MP-ID in UNB DE0004 must carry that MP-ID as OU
Counterparty cannot decryptWrong encryption certificate on our side[[as4.partner]] encryption_cert_pem_file is the partner's encryption certificate
Every inbound message EBMS:0101Trust or revocationtrust_anchor_pem_file is the SM-PKI root, crl_signer_pem_file the CCRL-S(Root), the CDPs are reachable (WARN events ca.fingerprint)
Inbound EBMS:0202 "not a configured partner"unbekannte_absender = nur_konfigurierteAdd the [[as4.partner]], or choose bdew_ou_zulassen
Inbound EBMS:0004The message was refused and dead-letteredThe dead letter names the reason (makod_dead_letter_recorded_total)
PartnerUnknown dead lettersThe recipient is no [[as4.partner]] with an encryption certificateAdd it; a Gas MP-ID is its own partner
AS4 dedup does not survive a restartNo --data-dirmakod refuses to start without one unless --allow-volatile is given

Test coverage

services/makod/tests/it/as4_security.rs:

TestVerifies
slatedb_dedup_conformsasx::testkit::dedup::conformance over SlateDbDedup — atomic claim, token-fenced settlement
an_outbound_message_is_delivered_with_its_receipt_evidenceService MP, <outbox id>@<domain>, Kap. 2.12 file name, receipt evidence kept
a_retry_resends_the_first_attempts_message_id_and_timestampSame eb:MessageId, eb:Timestamp and digests on the retry
a_partner_refusal_is_retried_and_a_receipt_failure_is_not_acknowledgedAn unverifiable receipt is no delivery
an_interchange_from_a_configured_partner_is_routedVerified, dispatched, receipted; the retransmission is a duplicate
a_refusal_is_dead_lettered_before_the_claim_is_released_for_goodDead letter before settlement, EBMS:0004 not retried
an_unrecorded_refusal_is_retryableA failed dead-letter write answers EBMS:0202 and the retry is reprocessed
an_accepted_interchange_settles_after_its_dead_lettersDead letters before accept
an_unconfigured_sender_is_refused_under_nur_konfigurierteThe default sender policy
an_unconfigured_sender_is_served_under_bdew_ou_zulassenKap. 2.3.2
a_tampered_request_is_refused_ebms_0101Signature integrity, no claim taken
the_part_properties_travel_with_the_messageKap. 6 eb:PartProperties on the outbound payload
an_expansion_beyond_the_message_limit_is_refused_ebms_0303gzip expands to at most MAX_MESSAGE_BYTES per message
the_tls_identity_reaches_the_handshakeA send to a TLS MSH requiring a client certificate presents the [party.as4] TLS certificate, SNI the endpoint's host
a_tls_refusal_is_a_retryable_transport_errorA server outside the SM-PKI root: ErrorKind::Transport, nothing written, the outbox retries

Run with: cargo test -p makod --test it -- as4_security

The Regelungen zum Übertragungsweg für AS4 2.6 checks:

TestVerifies
mako-as4 identity::tests::a_certificate_of_another_mp_id_does_not_buildOwn certificates carry the MP-ID in their OU (Kap. 5.2)
mako-as4 identity::tests::a_certificate_without_a_uri_does_not_buildExactly one URI subject alternative name (Kap. 5.2)
mako-as4 partner_directory::tests::a_partner_without_an_endpoint_is_reached_at_its_certificates_addressThe address is taken from the certificate (Kap. 2)
mako-as4 partner_directory::tests::an_endpoint_other_than_the_certificates_address_does_not_buildendpoint equals the certificate's address; no IP address (Kap. 2, 3)
mako-as4 partner_directory::tests::an_encryption_certificate_of_another_mp_id_does_not_buildThe partner encryption certificate's OU (Kap. 5.2)
mako-as4 part_properties::tests::*The Kap. 6 mapping from UNB/UNH
makod core::preflight::tests::the_as4_2_6_certificate_and_endpoint_rules_stop_the_bootThe refusals reach the boot
makod core::preflight::tests::a_party_without_its_tls_key_pair_is_rejectedNo identity without its TLS pair (Kap. 1.3; AS4-Profil Kap. 2.2.6.1)
makod core::preflight::tests::a_configured_quirks_key_is_refusedNo receipt relaxation (Kap. 7.3)
makod core::einrichtung::tests::a_warning_window_shorter_than_ten_werktage_blocksKap. 5.3

Further reading

ResourceDescription
BDEW AS4-Profil 1.2AS4 specification (01.04.2026)
Regelungen zum Übertragungsweg für AS4 2.6Certificates, rollover, revocation (01.10.2026)
BSI TR-03116-3Cryptographic requirements
RFC 5639BrainpoolP256r1
makod operator guideFull makod configuration reference
ERP integration guideCloudEvents, Command API, HMAC

Edit this page ↗