B2B communication protocols
AS2: secure, receipted EDI over the internet
AS2 is the most widely used way to send EDI documents directly to trading partners over the internet. It encrypts and signs each message and returns a signed receipt, so both sides can prove what was sent and received. ECOM's communication team sets up, tests and monitors AS2 connections with every partner.
- Specification
- IETF RFC 4130 (EDIINT AS2)
- Transport
- HTTP or HTTPS (HTTP POST)
- Message security
- S/MIME encryption and digital signatures
- Proof of delivery
- MDN receipts, signed and with a MIC
Each partner connects directly to the gateway by AS2. Documents are protected in transit and at rest, and every transfer is receipted.
Overview
What AS2 is
AS2 (Applicability Statement 2) defines how to send a business document, such as an X12 or EDIFACT file, from one company's AS2 software to another's over HTTP. Each message is packaged with S/MIME, the same standard used for secure email, so it can be encrypted for the receiver and signed by the sender.
When the receiver gets a message, it returns a Message Disposition Notification (MDN). A signed MDN includes a digest of the message as received, called the MIC. If it matches the sender's own calculation, the sender has evidence that the exact document arrived intact and was accepted for processing.
Where businesses use it
Retail and consumer goods
Large retailers commonly require suppliers to connect by AS2 for orders, ship notices and invoices.
Manufacturing and distribution
Direct connections between manufacturers, distributors and their partners without a third-party network.
Healthcare, energy and finance
Any exchange that needs encryption, proof of delivery and a direct connection.
How it works
How an AS2 transfer works
The sender compresses the document if agreed, signs it with its private key, encrypts it with the receiver's public certificate, and posts it over HTTP or HTTPS to the receiver's AS2 URL. HTTP headers carry the AS2-From and AS2-To identifiers, a unique Message-ID, and the receipt the sender wants.
The receiver decrypts the message with its private key, checks the signature with the sender's certificate, decompresses it, and returns an MDN. A synchronous MDN comes back on the same HTTP connection; an asynchronous MDN is posted later to a URL the sender provided, which suits large files and slow processing.
These headers travel with every AS2 message. They name the parties, identify the message and say what kind of receipt the sender wants.
The message is protected before it leaves the sender. The signed MDN, with the MIC, proves what the receiver got.
In depth
AS2 security, receipts and operations in depth
AS2 has several security layers that are often confused. Each one protects something different.
Encryption (S/MIME)
The document is encrypted with the receiver's public certificate, so only the holder of the matching private key can read it. It stays protected end to end, including while it waits on any server in between. Current setups use AES; 3DES is an older algorithm still met with some partners and is being retired, and RC2 is obsolete and should not be used.
Digital signature
The sender signs a hash of the document with its private key. The receiver checks it with the sender's certificate, which proves who sent it and that nothing changed. Signing does not hide the content; encryption does. SHA-256 or stronger is the current choice; SHA-1 and MD5 are legacy and weak.
TLS (HTTPS)
TLS protects the connection between the two servers, including the AS2 headers, and can authenticate the server. It is separate from S/MIME: TLS protects the channel while the message is in transit, S/MIME protects the message itself. Many partners use both. TLS 1.2 or 1.3 should be used; TLS 1.0 and 1.1 and all SSL versions are deprecated.
Compression
Large documents can be compressed before signing or encryption (AS2-Version 1.1 and later). It reduces transfer time and has to be agreed with the partner.
MDN receipts
The MDN reports whether the message was processed or failed, for example with decryption-failed or authentication-failed. A signed MDN with a matching MIC gives non-repudiation of receipt: evidence the partner received exactly what you sent.
Synchronous or asynchronous MDN
Synchronous receipts return on the same connection and suit most documents. Asynchronous receipts are sent later to the sender's URL and avoid timeouts on large files or slow processing.
Certificates
Each party has X.509 certificates for signing and encryption, often self-signed for AS2, and a separate CA-issued certificate for its HTTPS server. Certificates expire, so each one is tracked.
Certificate rollover
Before a certificate expires, the new one is sent to every partner with a change date. Partners load it in advance; on the date the new key is used for signing and decryption. Where both sides' software supports it, the old and new keys overlap for a short period to avoid failed messages.
Troubleshooting
Common causes of failure: an AS2 identifier or URL mismatch, an expired or wrong certificate, a firewall or IP allow list blocking the connection, mismatched algorithms, TLS version or cipher mismatch, or a synchronous MDN timing out on a large file. Logs on both sides and the MDN text point to the cause.
Encryption, signatures and TLS compared
All three use certificates, but they answer different questions.
| Layer | Protects | Answers the question | Current choice | Legacy, with limits |
|---|---|---|---|---|
| S/MIME encryption | The document, end to end | Can anyone else read it? | AES (128 or 256-bit) | 3DES: being retired; RC2: obsolete |
| S/MIME signature | The document's integrity and origin | Who sent it, and was it changed? | SHA-256 or stronger | SHA-1 and MD5: weak |
| TLS (HTTPS) | The connection in transit, including headers | Is the channel private and is the server genuine? | TLS 1.2 or 1.3 | SSL, TLS 1.0 and 1.1: deprecated |
| Signed MDN | Proof of receipt | Did the partner receive exactly this? | Signed, SHA-256 MIC | Unsigned MDN: no proof |
In practice
Example: connecting a supplier to a retailer by AS2
A retailer asks a new supplier to connect by AS2 before it sends its first purchase orders.
Most of the work is in steps one to three. After go-live, monitoring and certificate renewal keep the connection healthy.
Connections
How AS2 connects your business
Trading partners
Each partner gets its own AS2 profile: identifiers, URL, certificates, algorithms and MDN options.
EDI translation
Received documents go straight to translation and mapping; outbound documents are sent as soon as they are mapped.
ERP and business systems
Orders, ship notices and invoices flow between AS2 partners and your ERP without manual steps.
Monitoring
Every message and MDN is logged, so you can show when a document was sent and received.
ECOM
How ECOM supports AS2
ECOM supports AS2 with dedicated implementation, mapping, communication and support teams, and with specialists who know the industries your partners work in.
Implementation team
Plans the AS2 setup with you, configures it on the gateway and runs the tests with your partners and systems.
Mapping team
Builds and maintains the maps, code conversions and validation rules between partner data and your applications.
Communication team
Sets up and monitors partner connections, certificates, keys and credentials, and coordinates changes with each partner.
Support team
Watches the flows, investigates failed or missing documents, and works the issue through with you and your partner.
For AS2 in particular
- A dedicated communication team that sets up AS2 profiles, certificates, algorithms and MDN options for each partner.
- Certificate tracking and coordinated rollovers, with partner notices sent ahead of each change date.
- Troubleshooting of failed transfers and MDN errors with your partner's technical team.
- Partner onboarding for AS2: exchanging connection details, testing in both directions and confirming the go-live date with each partner.
- Monitoring of every connection, with alerts for failed, missing or unacknowledged transfers.
Frequently asked questions
Is AS2 encryption the same as HTTPS?
No. HTTPS (TLS) protects the connection while the message is in transit. AS2 encryption (S/MIME) protects the document itself, end to end, and it stays encrypted until the receiver decrypts it. Many partners use both.
What is an MDN?
A Message Disposition Notification is the receipt the receiver returns. A signed MDN with a matching MIC proves the receiver got exactly the document you sent.
Should we use a synchronous or asynchronous MDN?
Synchronous MDNs are simplest and work for most documents. Asynchronous MDNs are better for large files or when processing takes time, because the HTTP connection does not have to stay open.
What happens when an AS2 certificate expires?
Messages signed or encrypted with an expired certificate are usually rejected. ECOM tracks expiration dates, sends the new certificate to partners ahead of time, and switches on an agreed date.
Are 3DES and SHA-1 still acceptable?
They are legacy algorithms. Some older partner systems still use them, and they work, but they are weaker than AES and SHA-256. ECOM recommends moving partners to current algorithms when possible.
Talk to an EDI/API Expert
Tell us which partners, systems and AS2 requirements you are working with. An ECOM specialist will review them with you and outline the setup, the maps and the tests.