# A user's keys and certificates

AS2 partners sign and encrypt what they send. For each partner, the server needs to know two keys: its own private key, to decrypt what the partner encrypted for it, and the partner's certificate, to check the partner's signature. A partner is a user, and the two keys are set on that user, on the [Settings](Users-Settings.md) tab of the User Manager.

## AS2/3 Decryption Key

Your own key pair, with the private key. Messages from this partner are decrypted with it.

| Field | What it is |
|---|---|
| **Keystore Path** | the keystore file on the server that holds the key. **Browse** picks it. |
| **Keystore format** | **JKS** or **PKCS12** |
| **Keystore Password** | the password of the keystore |
| **Key name(alias)** | the name of the key inside the keystore |
| **Key Password** | the password of the key itself, when it has one of its own |

## AS2/3 Signature Verification Key

The partner's certificate. The signature of what they send is checked against it.

| Field | What it is |
|---|---|
| **Keystore Path**, **Keystore format**, **Keystore Password** | the keystore that holds the partner's certificate |
| **Key name(alias)** | the name of the certificate inside it |

There is no key password here: a certificate has no private part.

## The two buttons

| Button | What it does |
|---|---|
| **Test Certificate** | has the server open the keystore with what is filled in and find the key. It answers with the key it found, or with what is wrong: the path, the password, the alias. |
| **Keystore Utility** | opens the tool that lists what is in a keystore and imports keys and certificates into one: see [The keystore utility](Prefs-Encryption-Keystore-Utility.md) |

Press **Test Certificate** before **Save**: a wrong alias is the most common reason for an AS2 message that cannot be decrypted, and it shows here in a second.

## Where the keys come from

- Your own key pair is made once and its certificate is given to every partner. It can be the same keystore for all partners.
- The partner's certificate comes from the partner, as a file. Import it into a keystore with the Keystore Utility and name its alias here.
- Passwords of keystores are stored encrypted with the user.

Inheritance works here too: set your own decryption key on `default`, or on a template for all AS2 partners, and only the partner's certificate on each partner.
