> ## Documentation Index
> Fetch the complete documentation index at: https://docs-en.keysecure.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

## Domain and API Key

| Production Environment Domain ([https://openapi.keysecure.io/](https://openapi.keysecure.io/)) | Not applicable to the testing environment |
| :- | - |
| app\_id: | Obtain after creating a wallet |
| rsa\_wallet\_pub: | Keysecure System public key; Obtain from Keysecure System after creating a wallet |
| rsa\_third\_prv: | Client private key; Generated and saved independently |
| rsa\_third\_pub: | Client public key; Generated independently; Configure in Keysecure System after creating a wallet |
| rsa\_co\_signer\_pri: | Co-Signer private key; Generated using Co-Signer or generated and saved independently |
| rsa\_co\_signer\_pub: | Co-Signer public key; Generated using Co-Signer or generated independently; Configure in Keysecure System after creating a wallet |

### RSA Public-Private Key Format

Password Length: 2048

Key Format: PKCS#8

```sh theme={null}
openssl genrsa -out rsa_private_key.pem 2048

openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key_2048.pem

openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform pem -nocrypt -out private_pkcs8.pem
```

Noted：`rsa_public_key_2048.pem` is public key file，`private_pkcs8.pem` is private key file.

## Interface Rules

| Transmission Method: | https (temporary use of http in the testing environment) |
| :- | - |
| Response Status Code: | `0` indicates processing `success`, non-0 indicates **request error** or **system exception** |
| Request Address: | Domain + Interface Address |
| Encryption Algorithm: | RSA |

## Common Request Parameters

| Param | Type | Required | Description |
| :- | :- | :- | :- |
| app\_id | String | Required | Merchant unique identifier |
| data | String | Optional | `Data in JSON format` Encrypted string; encrypted with the Client's RSA private key, specific encryption information is described in the `Request Parameter Data Structure` of each interface |

```curl theme={null}
curl -X GET \
--url 'https://openapi.keysecure.io/
api/mpc/wallet/open_coin?app_id=16a9f17fc2ad61ca4339fdd6a8a37f21&data=SWYYr-LBVAmaS0eq8n-CUT_nHkM3OBxyWOsImMTe41UaqAoYI2ZghmaphXHov-7hsRsVmOhyPqC-JFuRGvonJKFd2Jirxv6Vn_8V40r_MMYTkhqcviQbZWYW5xX8Ai8CIpqas9fIWVDIYA_NKBl0UCJpwGxscxLNpjq5Z8-BTyIYDsVBquM9zEQGBCfcA7szD9n2fN_loSkoexlwqV8wg9HIZO5yQ6utZ_Kt0lNDQQb8zn8BwfAvsEsbJlOINUAqhxh1vV_AJ4bXn2uYx8TaYcBht-n_ZcBdxIDt975dbOFUiH-oCzIuDi1oLDtb4EylfCvhU5E4ozel_lQ-6cyIG0Dqiiyx0RFFOCJzPSXIoV031pvoa8pTCpkWklh8mRw1rylBgeZtqSxpnJO2_u2RIlXq6Hs8Yly9CmhIXaSrUgPir0h6xVxlf4VC6PFVCkiiTlp0kZ_H_UbKm0nUis3v3U2sflWJ2C449waSrikhuxVrFAQ6PQmrFVCAE6MYXNrFXJQuam2HAIQNSGbFQjspw8b_bXyfyZMGZ3K2oBC4I_v3eETTdPe0pfSNJb-5g37K0tOAr_UFbWK8pkC8yl56fSjn8tcR3yCRWwoi8jxTcUBiswTtvXZtzgG4dyzkaHXjsZjSGiywXSqP76VZWlyOmAx6IDSViLcPLPISdU3ruCI'
```

## Common Response Parameters

| Param | Type | Required | Description |
| :- | :- | :- | :- |
| data | String | Required | `Data in JSON format` Encrypted string; encrypted with RSA private key, specific encryption information is described in the `Response Result Data Decryption Format` |

```json theme={null}
{
    "data": "ItMK-uGEuHC-d8RsrEM-LxKZzy-osF5JMsBAjioLTzU-YnACZm_ryS7ilW8MMpjBWpxx_DYE5T5w9G8pAy-X-Fxb8mJafpdRLDLi0U2i2tjDGWgaVd0bmmb2-1meSuyS-ggdsN2R9rZtK6SSbBlTG32I4fMhL0WrppREfnRF7IdzRYVveA1j0ZYKHYGZbu_aT4lft9KxJqTJfFyxAvV96iQ-WcWNe4aygyTueSM_HbRrvaozakCytpJi2R8jnHDyV_Y7KiF6Ucd_kV9eqvqlwGHyxPUJIrvtOhXF3No7flrvrEnLLjSxpiHPVgJwkIqPzG8ICB4ilVpJnKmqxZsJJw"
}
```

### Decrypted Response Parameters

The original `JSON data` parameter results format is as follows:

| Param | Type | Required | Description |
| :- | :- | :- | :- |
| code | String | Yes | Status code, e.g., 100002 |
| msg | String | Yes | Explanation of the response result, e.g., Request parameter error |
| data | String | No | Specific response data; data structure defined in the `Response Parameter Data Structure` of each interface |

## Encryption and Decryption Mode

The values of the request parameter data and the response field data are both encrypted with RSA and then encrypted with **base64urlsafe**.

> [!WARNING]
>
> In traditional base64 encoding, there are two symbols, + and /, which will be directly escaped by the URL. Therefore, if you want to transmit these encoded strings via URL, you need to do traditional base64 encoding first, and then replace + and / with - \_ respectively. On the receiving end, do the opposite decoding action.
>
> RSA encryption and decryption use `segmented encryption`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.