# Key generation

### Key Retrieval Process:

1. You need to go to the [key generation page](https://www.google.com/search?q=https://merchant.alb.ua/jwt).
2. Generate a key pair.
3. Save the `private_key` portion on your side.
4. Send the `public_key` portion to the bank employee.
5. After the bank employee completes the registration, all necessary data for working with signing will be sent to you.

> The following parameters will be provided:
>
> * `merchantId` - internal terminal identifier (used in requests).
> * `kid` - key identifier.
> * `payment_public_key` - public payment key (used for encrypting card data). You can learn more at this link: <https://docs.merchant.alb.ua/kriptuvannya-danikh#zapit-kriptuvannya-nomeru-kartki> (This link leads to the Ukrainian documentation on card number encryption).

#### Key Parameters for Signing

The keys are generated using the following parameters:

* `kty`: `"EC"` (Elliptic Curve)
* `crv`: `"P-256"` - (ES256) - the most common curve, supported by most frameworks and browsers, and provides a sufficient level of security.
* `use`: `"sig"` - indicates that the key is used for signature.
* `alg`: `"ES256"`.

They are displayed in X.509 PEM Format.

Example Key Appearance:

{% tabs %}
{% tab title="private\_key" %}

```
-----BEGIN PRIVATE KEY-----
MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCDCOWlpGDoMfQ25x4Ku
K9J96WuwVn3Ri/UTYEMIV/KPXA==
-----END PRIVATE KEY-----
```

{% endtab %}

{% tab title="public\_key" %}

```
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHZ+3wM4Hmyq6f1H7RJjU4SSrqjt3
8f2VX9aS8ikCxXHID92roxYMsDBzAcVRPwNPiexCu5eS/UzyJsP8e9eydA==
-----END PUBLIC KEY-----
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.merchant.alb.ua/en/authorization-2.0/key-generation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
