# Trading partners

A trading partner is another company you exchange AS2 messages with. This page says what makes up a partner on the server, for each of the two [engines](AS2.md#two-engines).

## What you agree with every partner

| | Yours | Theirs |
|---|---|---|
| AS2 name | | |
| address to post to | | |
| certificate | | |
| signing algorithm | | |
| encryption algorithm | | |
| receipts: at once or later; signed or not | | |

Fill in this table per partner and keep it. It is the whole of the agreement.

About AS2 names: they are plain text, agreed by the two sides. Many partners require a certain form, such as a company number. Upper and lower case count for most systems. Avoid spaces.

## A partner in version 1

In version 1 a partner is not a thing of its own. It is made of two parts that you set up separately.

### For receiving: a user

Make a user in the [User Manager](Users.md) for the partner.

| Set | To |
|---|---|
| the name and a password | the partner signs in as this user. They do it through the AS2 name they send to: see [Receiving](AS2-Receiving.md#the-as2-name-carries-the-login). |
| exactly one folder | in [the user's files](VFS.md), with the right to upload. That is where the partner's files land. More than one folder confuses the receiver. |
| **AS2/3 Decryption Key** | your key pair, on the [Settings](Users-Settings.md) tab: [A user's keys and certificates](Users-Settings-Keys.md) |
| **AS2/3 Signature Verification Key** | the partner's certificate, in the same place |
| **Unique AS2 filenames** | on, if the partner sends files under the same name again and again |
| protocols | only HTTPS: [Protocols](Users-Restrictions-Protocols.md). The partner needs nothing else. |
| allowed addresses | the partner's addresses, if they are fixed: [IP restrictions](Users-Restrictions-IP.md) |

Your own decryption key is the same for all partners. Set it once on a template user or a group that all AS2 users inherit from, and set only the partner's certificate on each user.

### For sending: an AS2 task

What you send to the partner is a job with an [AS2 task](Task-AS2.md). The task holds the partner's side: their AS2 name, their address, their certificate, the algorithms. See [Sending](AS2-Sending.md).

Make one job per partner, or one job that takes the partner's values from variables: [Variables](Jobs-Variables.md).

### One partner, both directions

Nothing ties the user and the task together but your own naming. Name them alike: user `as2_acme`, job `AS2 to ACME`.

## A partner in version 2

Version 2 has a registry with two kinds of entry.

| Entry | Is |
|---|---|
| a **station** | your side: an AS2 name of yours, with the key that decrypts what arrives for it and the key that signs its receipts. One company usually has one. A station can answer to several AS2 names. |
| a **partner** | their side: their AS2 name, the certificates they sign with, what is demanded of their messages, and where their files go |

A partner entry holds, among other things:

| Setting | Is | Unless you say otherwise |
|---|---|---|
| the AS2 name, and the station it talks to | | |
| the certificates the partner may sign with | pinned: a message signed by any other certificate is refused | |
| **require signed** | a message without a signature is refused | on |
| **require encrypted** | a message that is not encrypted is refused | off |
| the algorithm policy | which algorithms are accepted: **compat** takes SHA-1 and 3DES as well as the modern ones; **legacy** also the broken ones of the 1990s, for a partner who cannot do better; the strict policy only modern ones | compat |
| the largest message | in megabytes | 2048 |
| gates before the body is read | allowed addresses, a name and password (HTTP basic), or the partner's TLS certificate. A partner with none of these may send at most 100 MB per message. | none |
| receipts sent later | whether the server may post a receipt to an address the partner names: never, only to listed addresses, or to one fixed address | never |
| routes | where the files go: into the folders of a user of the User Manager, as that user would upload them; with rules by file name, type and size | |

Up to 100 stations and 500 partners.

The entries are made with the admin commands `as2v2_saveStation` and `as2v2_savePartner`, or, for a server that has version 1 partners, by the import tool, which builds them from what version 1 knows: [Moving from AS2 version 1](AS2-Upgrade-from-v1.md). Version 2 has no page in the admin pages yet.

### The difference that matters

In version 1 a partner proves who they are with a **password**, and the signature is an extra. In version 2 they prove it with their **signature**, and no password is involved. That is why version 2 needs the partner's certificate before the first message, and why a partner who changes certificate without telling you is refused.

## Things to know

- **One certificate per partner.** If two partners sign with the same certificate, which happens when both use the same service provider, tell them apart by their AS2 names and addresses. Version 2 must be told that the sharing is intended.
- **Partners change certificates.** Certificates end, usually after one to three years. Ask each partner how they announce a change, and keep the old one valid until the new one is confirmed: [AS2 certificates](AS2-Certificates.md#when-a-certificate-ends).
- **A partner list is worth keeping outside the server**: the table at the top of this page, per partner, with a contact person.
