AS2 has no standard port of its own, meaning no fixed number on which a server accepts AS2 connections, because RFC 4130 does not define one. Messages are sent to the target URL that both partners agree on. If the URL names no port, the default ports of HTTP and HTTPS apply under RFC 9110, that is, 80 and 443. The GS1 Germany implementation guide, version of January 2009, recommends using 4080 for HTTP and 5443 for HTTPS where possible; each company is free to set its own.
The sender signs and encrypts the message with S/MIME, sends it by HTTP POST, and stores the message ID and hash value (MIC). The recipient decrypts it, verifies the signature, recalculates the MIC, and returns it in a signed receipt (MDN). The cycle of a secured transmission is described in RFC 4130 (Request for Comments), the specification of AS2.
HTTP is the transfer protocol of the web; with the POST method, a system sends data to a server. S/MIME (Secure/Multipurpose Internet Mail Extensions) signs and encrypts data and packages it in the CMS (Cryptographic Message Syntax) format. The MIC (Message Integrity Check) is a hash value, meaning a checksum over the content, from which the signature is derived. The message ID is the unique identifier of each message.
A transmission with a signed and encrypted message and a signed receipt runs in six steps:
- The sender computes the MIC over the message and signs it with its private key, which only it knows.
- It encrypts the signed message with a one-time key and encrypts that key with the recipient’s public key.
- It sends the message by HTTP POST to the agreed target URL, requests a signed MDN, and stores the message, message ID, and MIC.
- The recipient uses its private key to decrypt the one-time key and with it the payload.
- It verifies the signature with the sender’s public key and recomputes the MIC with the same hash algorithm.
- It enters the computed MIC in the MDN, signs it, and sends it back, after which the sender compares the value with the stored one.
If the signature of the MDN is valid and the returned MIC matches the stored one, the sender has proof that exactly this message arrived unchanged at the right recipient. The RFC 4130 specification calls this proof non-repudiation of receipt (NRR).
Partners can skip individual steps, such as encrypting the message when they send over HTTPS, meaning HTTP over an encrypted connection. Only the full variant offers all the security functions of the specification, however: confidentiality, integrity of the content, and provable origin and provable receipt. Because data for EDI (electronic data interchange) is usually processed without human involvement, the six steps usually run automatically too. Both partners need suitable EDI software that supports AS2 for this.
