> For the complete documentation index, see [llms.txt](https://aliniex.gitbook.io/alix-pay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aliniex.gitbook.io/alix-pay/api-reference/introduction/digital-signature.md).

# Digital Signature

## Digital signature <a href="#digital-signature" id="digital-signature"></a>

Currently, AliX is using the RSA 2048 bit algorithm. In addition to data digital signing, it is also used for encryption and decryption.

Partners can create signatures with online tool:&#x20;

<https://8gwifi.org/RSAFunctionality?rsasignverifyfunctions=rsasignverifyfunctions&keysize=2048>

or refer to how to generate keys using the command line: <https://www.scottbrady91.com/OpenSSL/Creating-RSA-Keys-using-OpenSSL>

Standard signature: RSA - PKCS1 or RSA - PKCS8.

The signature pair consists of a private key and a public key:

* Private key for partners to create signatures
* Public key which partner provides for AliX to verify the partner's signature.

  At the same time, AliX provides partners with AliX's public key for partners to verify AliX's signature.

AliX algorithms support partners: SHA1, SHA256, SHA384, SHA224, SHA512 Partner informs AliX the algorithm that is using.

Partners can use online tools to put strings before encryption and check signature output, such as <https://8gwifi.org/RSAFunctionality?rsasignverifyfunctions=rsasignverifyfunctions&keysize=2048>

### Code examples <a href="#how-to-do-signature-creation-verification" id="how-to-do-signature-creation-verification"></a>

#### 1. Creation

```typescript
import * as crypto from 'crypto';

function create(data: string, privateKey: string): string 
{
  const signer = crypto.createSign('RSA-SHA256');
  signer.update(data);
  signer.end();

  return signer.sign(privateKey, 'base64');
}
```

#### 2. Verification

```typescript

function verify (data: string, signature: string, pubKey: string): boolean
{
        const verify = createVerify('RSA-SHA256');
        verify.update(data);
        verify.end();
        return verify.verify(pubKey, signature, 'base64');
}
```


---

# 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://aliniex.gitbook.io/alix-pay/api-reference/introduction/digital-signature.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.
