Encrypting your Db2 password with SQL DI REST API

Your Db2 user ID and password are required for creating a new connection from SQL DI. For enhanced security, consider encrypting your Db2 password with the public key of the SQL DI server. You can use the SQL DI REST API for password encryption.

Procedure

  1. In your REST API client, start a new HTTPS POST request in JSON format.

    See https://<SQLDI-IPAddress>:<SQLDI-PortNumber>/swagger or Db2 SQL Data Insights REST APIs for a full list of SQL DI REST API endpoints, options, descriptions, and examples.

  2. In the request header, set the Accept and Content-Type fields to application/json.
  3. In the request body, include the password option and set it to your Db2 password as shown in the following example:
    {
      "password": "yourDb2Password"
    }
    
  4. Send the POST request to the following address:
    POST https://<SQLDI-IPAddress>:<SQLDI-PortNumber>/sqldi/v2/encrypt

    If your request returns a response similar to the following example, your API call is successfully processed:

    Code 200 – Success.

    The response will also include the encrypted string of your Db2 password like the following example:

    jzHVH9wnJOXBqwdb6D3UAnIsJlsqcxsFzL70Jz14QMqPiosZ/MjCKtjysh8meAcTsiok80Uu
    4LmoS9WxMHpYXOOOZ78WfwrguSryGWr+CLf1HPGFjOkjq1h+03OnoGkY/oDcuUQpbYN4M4PevVdxr
    V0Wosc8FisjAPVTS5c+ePjJYs913Z5vbl37gfy15byj0qIa33p6JwrZ9gvIQcKezQPN7Zp8kj6CF
    Dhy4QeqUffLlomG12BxqOhA0xzlUn3erMpR/xktQ+ZwqwSSUvcYM5e7015r9mjai7bbJbWLV0f6U
    zxooNBLeWDUWzOpYeB+qpxiBhe0pDQHNq20E1PEKw==

    In a subsequent REST API request that requires a Db2 connection, specify the required Db2-Password option and set it to the string of the encrypted password. In the request header, specify the Encrypted parameter as shown in the following example and set it to 1.

    Encrypted: 1

    The integer value of 1 indicates that your Db2 password is encrypted.