AS2 Protocol Explained: Secure EDI Communication Standard

AS2 (Applicability Statement 2) is the global standard for secure Electronic Data Interchange (EDI) over the internet. It enables businesses to exchange documents such as purchase orders, invoices, and shipping notices directly and safely—without relying on costly intermediaries.

Think of AS2 as a digital armoured truck for business data. Every file is encrypted, digitally signed, and acknowledged with legally verifiable proof of delivery. This ensures that sensitive supply chain transactions reach the intended partner securely, intact, and compliant with global EDI requirements.

Think of AS2 as a digital armoured truck for business data. Every file is encrypted, digitally signed, and acknowledged with legally verifiable proof of delivery. This ensures that sensitive supply chain transactions reach the intended partner securely, intact, and compliant with global EDI requirements.

Today, most large retailers and logistics networks—including Amazon, Walmart, and Target—mandate AS2 connectivity for EDI integration.

What is AS2 in EDI?

AS2 (Applicability Statement 2) is a secure communication protocol that transports EDI documents over HTTP or HTTPS using encryption and digital signatures.

While AS2 can technically transmit any file type, it is almost exclusively used for EDI formats such as:

  • ANSI X12
  • EDIFACT
  • XML EDI
  • CSV / flat files (EDI-mapped)

Unlike email or FTP transfers, AS2 guarantees:

  • Confidential data exchange
  • Verified sender identity
  • Tamper-proof transmission
  • Legally binding delivery confirmation
👉 Learn more about EDI integration :  EDI Integration Services

How AS2 Works: Step-by-Step Workflow

AS2 operates on a secure request-response model over HTTP/S. Below is the technical journey of an EDI document such as a purchase order or invoice.

Phase 1: Sending the AS2 Message

1. Document Generation

The AS2 process begins when a business application such as an ERP, warehouse system, or EDI translator generates an outbound document for a trading partner. These documents are typically standardised EDI transactions like 

purchase orders (850), 

invoices (810), or 

advance ship notices (856), structured in ANSI X12, EDIFACT, or XML formats. 

At this stage, the file is still readable and unsecured. The role of the AS2 layer is to transform this business document into a cryptographically protected payload suitable for secure internet transmission.

2. Canonicalisation

Before applying cryptographic functions, the document is normalised to ensure formatting consistency across systems. This process typically converts line endings to CRLF, removes trailing spaces, and standardises character encoding such as UTF-8 or ASCII. Canonicalisation is essential because cryptographic hashes are extremely sensitive to formatting differences. Even minor variations like line ending styles could cause sender and receiver to compute different integrity hashes for the same document, leading to validation failures.

3. MIC Calculation (Message Integrity Check)

After normalisation, the sender calculates a Message Integrity Check (MIC) using a cryptographic hash algorithm, most commonly SHA-256. The MIC acts as a unique mathematical fingerprint of the document. Any change to the file—even a single character—produces a completely different MIC value. This hash will later be returned by the receiver in the MDN receipt, allowing both parties to confirm that the document remained unchanged during transmission.

4. Digital Signature (Authentication and Non-Repudiation)

The sender then digitally signs the document using its private key. Technically, the previously calculated hash of the document is encrypted with the sender’s private key and attached as the signature. This step provides strong authentication because only the sender possesses that private key. It also establishes non-repudiation, meaning the sender cannot deny sending the document. The signature proves both the origin of the message and that the content existed in that exact form at the time of signing.

5. Encryption (Confidentiality)

Once signed, the message is encrypted using the receiver’s public certificate. AS2 uses asymmetric encryption, meaning only the receiver’s private key can decrypt the message. This guarantees confidentiality during internet transmission. Even if the message were intercepted, its contents would remain unreadable. The signed document is now enclosed within an encrypted S/MIME envelope, forming the secure AS2 payload ready for transport.

6. Transmission via HTTP/S

The encrypted AS2 payload is transmitted to the trading partner using an HTTP or HTTPS POST request directed to the partner’s AS2 endpoint URL. Standard AS2 headers such as AS2-From, AS2-To, Message-ID, and Disposition-Notification-To identify the sender, receiver, and requested acknowledgment behavior. At this point, the message leaves the sender’s environment fully secured, protected against interception, tampering, or impersonation during transit across the public internet.

Phase 2: Receiving and Verifying the AS2 Message

7. Decryption

Upon arrival at the receiver’s AS2 server, the first operation is decryption. The receiver uses its private key to decrypt the S/MIME envelope that was encrypted with its public certificate by the sender. Because only the intended receiver possesses this private key, successful decryption confirms that confidentiality has been preserved and that the message was addressed correctly. After decryption, the receiver obtains the original EDI document along with the sender’s digital signature.

8. Signature Verification

The receiver validates the digital signature using the sender’s public certificate. This verification confirms that the message truly originated from the declared trading partner and that the document has not been altered since it was signed. If signature validation fails, the message is rejected and a failure MDN is generated. Successful verification establishes cryptographic trust between partners and ensures protection against spoofing or impersonation.

9. MIC Comparison

The receiver recalculates the MIC using the same hashing algorithm applied by the sender.

Steps:

  1. Canonicalize received document
  2. Compute hash
  3. Compare with sender MIC

If both MIC values match:

✔ No corruption
✔ No alteration
✔ Transmission intact

If MIC differs:

✖ Message tampered or damaged
✖ MDN error returned

This step mathematically proves message integrity across the internet.

10. MDN Generation (Electronic Receipt)

After successful validation, the AS2 gateway passes the EDI document to internal systems such as:

  • ERP
  • EDI translator
  • Warehouse system
  • Integration middleware

At this point, business processing begins (order creation, invoice posting, etc.).

Core Security Components of AS2

AS2 achieves enterprise-grade security through three cryptographic pillars:

Security Component
Technology Used
Business Value
ConfidentialityAsymmetric EncryptionOnly intended partner can read data
AuthenticityDigital SignaturesVerifies sender identity
IntegrityHashing (MIC)Ensures the file is unchanged

The AS2 Certificate System Explained

AS2 relies on exchanging public certificates between trading partners.

Your Private Key
  • Stored securely on your AS2 server
  • Used to sign outgoing messages
  • Used to decrypt incoming messages
Your Public Certificate
  • Shared with partners
  • Used by them to encrypt messages for you
Partner Public Certificate
  • Shared with you
  • Used by you to encrypt messages for them

This certificate exchange establishes trusted, secure communication channels between businesses.

The MDN: Proof of Delivery and Non-Repudiation

What is an MDN

The Message Disposition Notification (MDN) is a digitally signed electronic receipt generated by the receiver after processing an AS2 message. It confirms whether the message was successfully received, decrypted, authenticated, and validated. Unlike FTP or email acknowledgements, the MDN includes cryptographic proof of integrity and delivery, making it a legally reliable confirmation of EDI exchange.

Information Contained in an MDN

An MDN includes the original message ID, processing status (success or failure), receiver identity, timestamp, and the MIC calculated by the receiver. It is digitally signed using the receiver’s private key. Because the MDN contains the receiver-calculated MIC and signature, it provides verifiable evidence that the exact document sent by the sender was received intact and readable.

MDN Generation Process

After completing decryption, signature verification, and MIC validation, the receiver’s AS2 server generates the MDN. The MDN records whether processing succeeded or failed and embeds the MIC calculated from the received document. The MDN is then digitally signed by the receiver to ensure authenticity and non-repudiation. This signed receipt is returned to the sender as formal confirmation of delivery.

Synchronous MDN

A synchronous MDN is returned immediately within the same HTTP connection used to transmit the AS2 message. The sender sends the AS2 POST request, and the receiver responds with the MDN in the same session. This provides real-time delivery confirmation and is commonly used for standard-size EDI transactions where processing is quick.

Asynchronous MDN

An asynchronous MDN is returned later through a separate AS2 connection. The receiver first accepts and processes the message, then initiates a new AS2 transmission back to the sender containing the MDN. This approach is used for large files, high-volume environments, or scenarios where validation and processing take longer.

MDN and Non-Repudiation

The MDN provides non-repudiation of receipt, meaning the receiver cannot deny having received the document. Because the MDN contains the MIC of the received file and is digitally signed by the receiver, it serves as cryptographic proof that the message arrived intact and was successfully decrypted. In EDI disputes, the MDN acts as legal evidence that documents such as purchase orders or invoices were delivered and readable.

Why AS2 is the Preferred EDI Protocol

1. Eliminates VAN Costs

Traditional EDI used Value-Added Networks (VANs) charging per document or character.

AS2 runs over the internet → zero transmission fees.

2. Real-Time EDI Processing

Documents transmit in seconds instead of hours.

Benefits:

  • Faster order fulfillment
  • Immediate confirmations
  • Real-time supply chain visibility
3. Global Retail Compliance

Major retailers require AS2 connectivity for suppliers and logistics partners.

Examples include:

  • Amazon
  • Walmart
  • Target

Without AS2, EDI onboarding with these partners is often impossible.

4. Bank-Grade Security

AS2 uses:

  • PKI certificates
  • SHA-256 hashing
  • Asymmetric encryption
  • Digital signatures

This meets enterprise security and compliance requirements.

AS2 vs FTP vs VAN: Comparison

Feature
AS2
FTP/SFTP
VAN
Security High Medium High
Real-Time Yes No No
Proof of Delivery Yes (MDN) No Limited
Cost Low Low High
Retail Compliance Yes No Yes

AS2 provides VAN-level security without VAN-level cost.

When Should You Implement AS2?

You should implement AS2 if your business:

  • Works with large retailers
  • Uses EDI documents (850, 810, 856, etc.)
  • Needs secure B2B data exchange
  • Wants to eliminate VAN fees
  • Requires audit-grade delivery proof

AS2 Integration with ERP and EDI Systems

AS2 typically integrates with:

  • ERP systems (Odoo, SAP, NetSuite)
  • EDI translators
  • 3PL / WMS platforms
  • Carrier networks
  • Retail supply chains

Businesses using Odoo EDI commonly deploy AS2 for retailer integrations.

👉 Learn how AS2 fits into your ERP : EDI Integration Services

Conclusion

AS2 has become the global standard for secure EDI communication because it combines:

  • Encryption
  • Digital signatures
  • Integrity validation
  • Legal delivery proof
  • Internet-based transport

It replaces expensive VAN networks while meeting the strict security requirements of global retailers and supply chains.

For any business operating in modern B2B commerce, AS2 is no longer optional—it is the foundation of compliant, secure, and real-time EDI integration.

 

02 Comments