Setting Up

Payload Encryption

14min

Introduction

The Contract360 Platform's APIs strictly comply with industry-standard security protocols, ensuring that all exchanges of data are automatically protected through default employment of HTTPS, TLS, and SSL protocols. Furthermore, to cater to clients with a priority on enhanced security, we provide Payload Encryption functionality. This feature adds an extra layer of protection to the transmitted data by encrypting its content, thus bolstering the overall security measures of our platform.

Prerequisites

To activate Payload Encryption, the following steps must be completed:

  1. Key Exchange: The organization and Signzy need to exchange keys. Signzy will provide their public key in .cer.txt format, and the organization must share its public key in the same format with Signzy. This exchange is securely conducted via email channels. Assistance for this process will be provided by the assigned Customer Success Manager (CSM) or Account Manager (AM).
  2. Account Specification: The organization needs to specify which accounts are authorized to make API calls to Signzy. This information allows the Signzy team to configure the public certificates against the designated accounts.

Steps To Use Encrypted Payloads

Below are the guidelines for utilizing encrypted payloads with Contract360 APIs:

  1. When implementing payload encryption, ensure to include the request header 'x-content-encoding' with the value 'encrypted'. Adhere to other headers as per the standard API documentation. This header must be included to opt-in for payload encryption. Failure to include this header will result in unencrypted payloads.
x-content-encoding: encrypted

Upon opting for payload encryption in the Initiate Contract API, the responses sent over callbacks will also be encrypted.

2. Construct the standard request payload according to the API documentation:

3. Generate a 256-bit AES key and Initialization Vector (IV). Employ the AES key to encrypt the API payload prepared in Step 2.

  • A 32-byte secret key and a 16-byte initialization vector (IV) are randomly generated.
  • The JSON object is encrypted using these randomly generated keys.
  • The encrypted data is then converted to Base64 format and sent in the 'data' field.

4. Transmission of Randomly Generated AES Key and Initialization Vector (IV): For decryption at our end, both the randomly generated secret key and IV are required.

  • The client encrypts these random values using Signzy's public key and converts them to Base64 format.
  • These Base64-encoded random values are then passed in the 'salt' field.

5. Decryption Process at Signzy: At Signzy, our private key is utilized to decrypt the values passed in the 'salt' parameter.

  • This enables retrieval of the random values necessary for decryption.
  • With these random values, the actual data is decrypted.

The client needs to send the encrypted payload in this way -

JSON


Steps To Handle Encrypted Response Sent By Signzy

When Signzy needs to send a response back:

  • The roles are reversed.
  • The client's public keyis utilized.
  • Data is encrypted by generating an AES key and IV, and then sent in the 'data' field.
  • Subsequently, the AES key and IV are encrypted using the client's public key.

The data on the callback would be posted in this way -

JSON


Sample Java Code For Encryption

Java


Sample Java Code For Decryption

Java


Sample NodeJS Code For Encryption

JS


Sample NodeJS Code For Decryption

JS


Sample Request For Initiate Contract API

PreProduction
Production


Sample Response

JSON




Updated 18 Mar 2024
Did this page help you?