> For the complete documentation index, see [llms.txt](https://opentrustlab.gitbook.io/opentrustlab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://opentrustlab.gitbook.io/opentrustlab/key++interface-documentation-v1.1.0.md).

# Key++Interface documentation V1.1.0

The service port is 8878, the request method is POST, and the submission method is form-data.

## 1.Initialization

### 1.1. Initialization

**Request**

> POST /init

**Parameters**

| Name    | Type | Must | Description |
| ------- | ---- | ---- | ----------- |
| Nothing |      |      |             |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": "success"     }

## 2.Tool

### 2.1.SM3

**Request**

> POST /tool/sm3

**Parameters**

| Name  | Type   | Must | Description  |
| ----- | ------ | ---- | ------------ |
| input | string | yes  | Input string |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hash value     }

## 3.Key Management

### 3.1.Generate a private key

**Request**

> POST /km/genSK

**Parameters**

| Name     | Type   | Must | Description           |
| -------- | ------ | ---- | --------------------- |
| m        | string | yes  | default2              |
| n        | string | yes  | default4              |
| q        | string | yes  | default2147483647     |
| p        | string | yes  | default512            |
| filename | string | yes  | Private key file name |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Private key file URL     }

### 3.2.Generate Public Key

**Request**

> POST /km/genPK

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| skfile   | string | yes  | Private key file URL |
| filename | string | yes  | Public key file name |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Public key file URL     }

### 3.3.Generate dictionary

**Request**

> POST /km/genDict

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| skfile   | string | yes  | Private key file URL |
| filename | string | yes  | Dictionary file name |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Dictionary Files URL     }

## 4.Encryption and Decryption

### 4.1.encryption（symmetry）

**Request**

> POST /enc/encrypt

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.2.Bulk encryption（symmetry）

**Request**

> POST /enc/encryptBatch

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| skfile    | string | yes  | Private key file URL                         |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.3.encryption（Asymmetric）

**Request**

> POST /enc/encryptPublic

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| pkfile | string | yes  | Public key file URL     |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.4.Bulk encryption（Asymmetric）

**Request**

> POST /enc/encryptPublicBatch

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| pkfile    | string | yes  | Public key file URL                          |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.5.Decryption

**Request**

> POST /enc/decrypt

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Plain text string     }

### 4.6.Batch decryption

**Request**

> POST /enc/decrypt

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| skfile    | string | yes  | Private key file URL                         |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Plain text string     }

### 4.7.Encryption in binary mode（symmetry）

**Request**

> POST /enc/encryptBinary

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |
| length | string | yes  | Binary length           |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.8.Encryption in binary mode（Asymmetric）

**Request**

> POST /enc/encryptBinaryPublic

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| pkfile | string | yes  | Public key file URL     |
| length | string | yes  | Binary length           |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.9.Decrypt in binary

**Request**

> POST /enc/decryptBinary

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Plain text string     }

### 4.10.Encrypt as a string（symmetry）

**Request**

> POST /enc/encryptString

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.11.Batch encryption as string（symmetry）

**Request**

> POST /enc/encryptStringBatch

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| skfile    | string | yes  | Private key file URL                         |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.12.Encrypt as a string（Asymmetric）

**Request**

> POST /enc/encryptStringPublic

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| pkfile | string | yes  | Public key file URL     |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.13.Batch encryption as string（Asymmetric）

**Request**

> POST /enc/encryptStringPublicBatch

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| pkfile    | string | yes  | Public key file URL                          |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Hexadecimal ciphertext string     }

### 4.14.Decrypt as a string

**Request**

> POST /enc/decryptString

**Parameters**

| Name   | Type   | Must | Description             |
| ------ | ------ | ---- | ----------------------- |
| input  | string | yes  | Content to be encrypted |
| skfile | string | yes  | Private key file URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Plain text string     }

### 4.15.Batch decryption as string

**Request**

> POST /enc/decryptStringBatch

**Parameters**

| Name      | Type   | Must | Description                                  |
| --------- | ------ | ---- | -------------------------------------------- |
| inputList | string | yes  | JSON format array of content to be encrypted |
| skfile    | string | yes  | Private key file URL                         |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Plain text string     }

### 4.16.Generate signature

**Request**

> POST /enc/genSign

**Parameters**

| Name   | Type   | Must | Description          |
| ------ | ------ | ---- | -------------------- |
| input  | string | yes  | Content to be signed |
| skfile | string | yes  | Private key file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Signature string     }

### 4.17.Verify the signature

**Request**

> POST /enc/verifySign

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| input    | string | yes  | Content to be signed |
| sign     | string | yes  | Signature string     |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": true | false Is the signature valid?     }

## 5.Ciphertext operation

### 5.1.Ciphertext addition

**Request**

> POST /opt/add

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Addend ciphertext    |
| c2       | string | yes  | Addend ciphertext    |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.2.Batch Ciphertext Addition

**Request**

> POST /opt/addBatch

**Parameters**

| Name     | Type   | Must | Description                         |
| -------- | ------ | ---- | ----------------------------------- |
| c1list   | string | yes  | JSON format array of ciphertext     |
| c2list   | string | yes  | Addend ciphertext JSON format array |
| dictfile | string | yes  | Dictionary Files URL                |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.3.Ciphertext subtraction

**Request**

> POST /opt/substract

**Parameters**

| Name     | Type   | Must | Description            |
| -------- | ------ | ---- | ---------------------- |
| c1       | string | yes  | Subtracted ciphertext  |
| c2       | string | yes  | Subtraction Ciphertext |
| dictfile | string | yes  | Dictionary Files URL   |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.4.Batch Ciphertext Subtraction

**Request**

> POST /opt/substractBatch

**Parameters**

| Name     | Type   | Must | Description                                           |
| -------- | ------ | ---- | ----------------------------------------------------- |
| c1list   | string | yes  | JSON format array of the ciphertext of the subtrahend |
| c2list   | string | yes  | Subtraction ciphertext JSON format array              |
| dictfile | string | yes  | Dictionary Files URL                                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.5.Ciphertext multiplication

**Request**

> POST /opt/multiply

**Parameters**

| Name     | Type   | Must | Description             |
| -------- | ------ | ---- | ----------------------- |
| c1       | string | yes  | Multiplicand ciphertext |
| c2       | string | yes  | Multiplier Ciphertext   |
| dictfile | string | yes  | Dictionary Files URL    |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.6.Batch Ciphertext Multiplication

**Request**

> POST /opt/multiplyBatch

**Parameters**

| Name     | Type   | Must | Description                               |
| -------- | ------ | ---- | ----------------------------------------- |
| c1list   | string | yes  | Multiplicand ciphertext JSON format array |
| c2list   | string | yes  | Multiplier ciphertext JSON format array   |
| dictfile | string | yes  | Dictionary Files URL                      |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.7.Ciphertext division

**Request**

> POST /opt/divide

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Dividend ciphertext  |
| c2       | string | yes  | Divisor Ciphertext   |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.8.Batch Ciphertext Division

**Request**

> POST /opt/divideBatch

**Parameters**

| Name     | Type   | Must | Description                           |
| -------- | ------ | ---- | ------------------------------------- |
| c1list   | string | yes  | Dividend ciphertext JSON format array |
| c2list   | string | yes  | Divisor ciphertext JSON format array  |
| dictfile | string | yes  | Dictionary Files URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.9.Ciphertext XOR

**Request**

> POST /opt/xor

**Parameters**

| Name     | Type   | Must | Description               |
| -------- | ------ | ---- | ------------------------- |
| c1       | string | yes  | Enter ciphertext1（Binary） |
| c2       | string | yes  | Enter ciphertext2（Binary） |
| dictfile | string | yes  | Dictionary Files URL      |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.10.Ciphertext and

**Request**

> POST /opt/and

**Parameters**

| Name     | Type   | Must | Description                |
| -------- | ------ | ---- | -------------------------- |
| c1       | string | yes  | Enter ciphertext 1（Binary） |
| c2       | string | yes  | Enter ciphertext 2（Binary） |
| dictfile | string | yes  | Dictionary Files URL       |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.11.Ciphertext or

**Request**

> POST /opt/or

**Parameters**

| Name     | Type   | Must | Description                |
| -------- | ------ | ---- | -------------------------- |
| c1       | string | yes  | Enter ciphertext 1（Binary） |
| c2       | string | yes  | Enter ciphertext 2（Binary） |
| dictfile | string | yes  | Dictionary Files URL       |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.12.Ciphertext not

**Request**

> POST /opt/not

**Parameters**

| Name     | Type   | Must | Description                |
| -------- | ------ | ---- | -------------------------- |
| c1       | string | yes  | Enter ciphertext 1（Binary） |
| pkfile   | string | yes  | Public key file URL        |
| dictfile | string | yes  | Dictionary Files URL       |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.13.Ciphertext left shift

**Request**

> POST /opt/shiftLeft

**Parameters**

| Name   | Type   | Must | Description                |
| ------ | ------ | ---- | -------------------------- |
| c1     | string | yes  | Enter ciphertext 1（Binary） |
| bias   | string | yes  | Offset                     |
| pkfile | string | yes  | Public key file URL        |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.14.Ciphertext right shift

**Request**

> POST /opt/shiftRight

**Parameters**

| Name   | Type   | Must | Description                |
| ------ | ------ | ---- | -------------------------- |
| c1     | string | yes  | Enter ciphertext 1（Binary） |
| bias   | string | yes  | Offset                     |
| pkfile | string | yes  | Public key file URL        |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.15.Ciphertext comparison

**Request**

> POST /opt/compare

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| c2       | string | yes  | Enter ciphertext 2   |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext(-1=Less than；0=equal；1=Greater than）     }

### 5.16.Batch ciphertext comparison

**Request**

> POST /opt/compareBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| c2list   | string | yes  | Input ciphertext2JSON format array   |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array(-1=Less than；0=equal；1=Greater than）     }

### 5.17.Ciphertext absolute value

**Request**

> POST /opt/abs

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.18.Batch ciphertext absolute value

**Request**

> POST /opt/absBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.19.Ciphertext power function

**Request**

> POST /opt/power

**Parameters**

| Name     | Type   | Must | Description                               |
| -------- | ------ | ---- | ----------------------------------------- |
| c1       | string | yes  | Enter ciphertext 1                        |
| n        | string | yes  | index                                     |
| m        | string | no   | index（The denominator part, default is 1） |
| pkfile   | string | yes  | Public key file URL                       |
| dictfile | string | yes  | Dictionary Files URL                      |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.20.Batch Ciphertext Power Function

**Request**

> POST /opt/powerBatch

**Parameters**

| Name     | Type   | Must | Description                               |
| -------- | ------ | ---- | ----------------------------------------- |
| c1list   | string | yes  | Input ciphertext 1 JSON format array      |
| n        | string | yes  | index                                     |
| m        | string | no   | index（The denominator part, default is 1） |
| pkfile   | string | yes  | Public key file URL                       |
| dictfile | string | yes  | Dictionary Files URL                      |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.21.Square root of ciphertext

**Request**

> POST /opt/sqrt

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.22.Square root of batch ciphertext

**Request**

> POST /opt/sqrtBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.23.Ciphertext logarithmic function（Natural logarithm base）

**Request**

> POST /opt/log

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.24.Batch ciphertext logarithmic function（Natural logarithm base）

**Request**

> POST /opt/logBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.25.Ciphertext exponential function（Natural logarithm base）

**Request**

> POST /opt/exp

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.26.Batch Ciphertext Exponential Function（Natural logarithm base）

**Request**

> POST /opt/expBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.27.Ciphertext sine function

**Request**

> POST /opt/sin

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.28.Batch Ciphertext Sine Function

**Request**

> POST /opt/sinBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.29.Ciphertext cosine function

**Request**

> POST /opt/cos

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.30.Batch Ciphertext Cosine Function

**Request**

> POST /opt/cosBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.31.Ciphertext tangent function

**Request**

> POST /opt/tan

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.32.Batch Ciphertext Tangent Function

**Request**

> POST /opt/tanBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.33.Ciphertext inverse sine function

**Request**

> POST /opt/asin

**Parameters**

| Name     | Type   | Must | Description          |
| -------- | ------ | ---- | -------------------- |
| c1       | string | yes  | Enter ciphertext 1   |
| pkfile   | string | yes  | Public key file URL  |
| dictfile | string | yes  | Dictionary Files URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.34.Batch ciphertext inverse sine function

**Request**

> POST /opt/asinBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary Files URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.35.Ciphertext arccosine function

**Request**

> POST /opt/acos

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.36.Batch ciphertext arccosine function

**Request**

> POST /opt/acosBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.37.Ciphertext inverse tangent function

**Request**

> POST /opt/atan

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.38.Batch ciphertext inverse tangent function

**Request**

> POST /opt/atanBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.39.Ciphered Hyperbolic Sine Function

**Request**

> POST /opt/sinh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.40.Batch ciphertext hyperbolic sine function

**Request**

> POST /opt/sinhBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.41.Ciphered Hyperbolic Cosine Function

**Request**

> POST /opt/cosh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.42.Batch ciphertext hyperbolic cosine function

**Request**

> POST /opt/coshBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.43.Ciphered hyperbolic tangent function

**Request**

> POST /opt/tanh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.44.Batch ciphertext hyperbolic tangent function

**Request**

> POST /opt/tanhBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.45.Ciphered inverse hyperbolic sine function

**Request**

> POST /opt/asinh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.46.Batch ciphertext inverse hyperbolic sine function

**Request**

> POST /opt/asinhBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.47.Ciphered inverse hyperbolic cosine function

**Request**

> POST /opt/acosh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.48.Batch ciphertext inverse hyperbolic cosine function

**Request**

> POST /opt/acoshBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.49.Ciphered inverse hyperbolic tangent function

**Request**

> POST /opt/atanh

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.50.Batch ciphertext inverse hyperbolic tangent function

**Request**

> POST /opt/atanhBatch

**Parameters**

| Name     | Type   | Must | Description                          |
| -------- | ------ | ---- | ------------------------------------ |
| c1list   | string | yes  | Input ciphertext 1 JSON format array |
| pkfile   | string | yes  | Public key file URL                  |
| dictfile | string | yes  | Dictionary file URL                  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.51.Complex Ciphertext Addition

**Request**

> POST /opt/addComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| c2       | string | yes  | Enter ciphertext 2  |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.52.Complex Ciphertext Subtraction

**Request**

> POST /opt/substractComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| c2       | string | yes  | Enter ciphertext 2  |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.53.Complex ciphertext multiplication

**Request**

> POST /opt/multiplyComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| c2       | string | yes  | Enter ciphertext 2  |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.54.Complex ciphertext multiplication（Multiply plaintext complex numbers）

**Request**

> POST /opt/multiplyComplexDouble

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| p2       | string | yes  | Enter ciphertext 2  |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.55.Complex ciphertext length

**Request**

> POST /opt/distanceComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.56.Complex ciphertext angle

**Request**

> POST /opt/argComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.57.Complex ciphertext exponential function

**Request**

> POST /opt/expComplex

**Parameters**

| Name     | Type   | Must | Description         |
| -------- | ------ | ---- | ------------------- |
| c1       | string | yes  | Enter ciphertext 1  |
| pkfile   | string | yes  | Public key file URL |
| dictfile | string | yes  | Dictionary file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.58.Fast Fourier Transform

**Request**

> POST /opt/fft

**Parameters**

| Name     | Type   | Must | Description                        |
| -------- | ------ | ---- | ---------------------------------- |
| cstr     | string | yes  | Ciphertext vector（Comma separated） |
| pkfile   | string | yes  | Public key file URL                |
| dictfile | string | yes  | Dictionary file URL                |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.59.Inverse Fast Fourier Transform

**Request**

> POST /opt/ifft

**Parameters**

| Name     | Type   | Must | Description                         |
| -------- | ------ | ---- | ----------------------------------- |
| cstr     | string | yes  | Ciphertext vector (comma separated) |
| pkfile   | string | yes  | Public key file URL                 |
| dictfile | string | yes  | Dictionary file URL                 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.60.String ciphertext concatenation

**Request**

> POST /opt/concat

**Parameters**

| Name | Type   | Must | Description        |
| ---- | ------ | ---- | ------------------ |
| c1   | string | yes  | Enter ciphertext 1 |
| c2   | string | yes  | Enter ciphertext 2 |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.61.Batch string ciphertext concatenation

**Request**

> POST /opt/concatBatch

**Parameters**

| Name   | Type   | Must | Description                          |
| ------ | ------ | ---- | ------------------------------------ |
| c1list | string | yes  | Input ciphertext 1 JSON format array |
| c2list | string | yes  | Input ciphertext2JSON format array   |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

### 5.62.Extract substring from string ciphertext

**Request**

> POST /opt/substring

**Parameters**

| Name   | Type   | Must | Description         |
| ------ | ------ | ---- | ------------------- |
| input  | string | yes  | Enter ciphertext    |
| start  | string | yes  | Starting position   |
| end    | string | yes  | Cut-off position    |
| pkfile | string | yes  | Public key file URL |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext     }

### 5.63.Extract substrings from batch string ciphertext

**Request**

> POST /opt/substringBatch

**Parameters**

| Name   | Type   | Must | Description                       |
| ------ | ------ | ---- | --------------------------------- |
| input  | string | yes  | Input encrypted JSON format array |
| start  | string | yes  | Starting position                 |
| end    | string | yes  | Cut-off position                  |
| pkfile | string | yes  | Public key file URL               |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Calculation result ciphertext JSON array     }

## 6.Random Number Generation

### 6.1.Generate random integers

**Request**

> POST /gen/randInt

**Parameters**

| Name   | Type   | Must | Description  |
| ------ | ------ | ---- | ------------ |
| max    | string | yes  | Maximum      |
| min    | string | yes  | Minimum      |
| length | string | yes  | Array length |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Integer Random Integer JSON Array     }

### 6.2.Generate random floating point numbers

**Request**

> POST /gen/randFloat

**Parameters**

| Name   | Type   | Must | Description  |
| ------ | ------ | ---- | ------------ |
| max    | string | yes  | Maximum      |
| min    | string | yes  | Minimum      |
| length | string | yes  | Array length |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Integer Random Float JSON Array     }

### 6.3.Generate a random string

**Request**

> POST /gen/randString

**Parameters**

| Name   | Type   | Must | Description   |
| ------ | ------ | ---- | ------------- |
| strlen | string | yes  | String length |
| length | string | yes  | Array length  |

**Response**

&#x20;   {         "isSuccess": true | false,         "log": "",         "result": Integer Random String JSON Array     }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://opentrustlab.gitbook.io/opentrustlab/key++interface-documentation-v1.1.0.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.
