Encryption

To ensure data security, the platform encrypts each request and response.

The merchant needs to use the symmetric encryption algorithm AES/ECB/PKCS5Padding to encrypt the request body and decrypt the response body, and the all results are encoded in Base64.

The merchant should provide a 128-bit AES key in advance(Base64 Encoding format)。

Request Body

For the meaning of each field in the original request body, please refer to the API descriptions.

Merchant:The original request body should be encrypted using the AES key, and then Base64-encoded. The result is used as the value of the bizContent field in the actual request body.

SanSan Platform:The value of the bizContent field in the actual request body received will be decoded by Base64 and then decrypted using the AES key. The result is the original request body.

{
  "key_1": "value_1",
  "key_2": "value_2",
  "key_3": "value_3"
}

Tool Samples

<?php

class AesUtils {

    public static function aesEncrypt(string $keyStr, string $plaintext): string {
        return base64_encode(openssl_encrypt($plaintext, 'AES-128-ECB', base64_decode($keyStr), OPENSSL_RAW_DATA));
    }

    public static function aesDecrypt(string $keyStr, string $ciphertext): string {
        return openssl_decrypt(base64_decode($ciphertext), 'AES-128-ECB', base64_decode($keyStr), OPENSSL_RAW_DATA);
    }
}

Last updated