# Authorization

This part will explain how Faspay account use encrypt method AES 256 for authorization.

Example

* String data that will be encrypted -> **$plaintext = "APP\_KEY:APP\_SECRET";**

* Algorithm used for encryption -> **$algo = "aes256";**

* The Key used for encryption -> **faspay\_secret** (generated by Faspay) Step for encrypted **the key** :

  1. Hashing key uses the sha 256 algorithm and its output is raw binary data.
  2. Then, taken 32 characters from the front. Ex : $password = substr(hash('sha256', $key, true), 0, 32);

* **IV** for encryption (generated by faspay) Step for encrypted IV :

  1. Hashing IV uses the md5 algorithm.
  2. Then taken 16 characters from behind. Ex : $iv = substr(md5($key.self::$iv), -16);

* Encryption using openssl by including **the plaintext, algo, password and iv** for the encryption process, and encryption output is binary raw data. $encrypted = openssl\_encrypt($plaintext, $algo, $password, OPENSSL\_RAW\_DATA, $iv);

* the encryption results are re-encrypted using the base64 encode method to make lowercase hexits. **$base64 = base64\_encode($encrypted);**


---

# 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.faspay.co.id/getting-started/faspay-sendme/authentication/authorization.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.
