Skip to main content

Encrypting Data with Smart Data Proxies

This guide demonstrates how to use the Qanapi Smart Data Proxy to encrypt sensitive data within JSON payloads.

Encryption Process Overview

When you encrypt data with the Smart Data Proxy:
  1. Your application sends a JSON payload to your project’s proxy endpoint
  2. You specify which fields to encrypt using the X-Qanapi-Fields header
  3. Qanapi encrypts only those specified fields, leaving the rest untouched
  4. The encrypted data is returned in the same structure, with encrypted values replacing the original sensitive data

Basic Encryption Request

Here’s a basic example of how to encrypt data using the Smart Data Proxy:

Understanding the Headers

For encryption requests, you need to include these headers:

Optional Headers for Encryption

You can also include these optional headers:

Sample Response

When encrypting data, the response will contain the original JSON structure with the specified fields replaced by encrypted values:

Encrypting Nested JSON Objects

You can encrypt fields within nested JSON objects by using dot notation in the X-Qanapi-Fields header:

Encrypting Arrays

To encrypt items in an array, specify the field name in the X-Qanapi-Fields header. All items in the array will be encrypted:

Error Handling

Common errors when encrypting data include:

Best Practices for Encryption

  1. Only encrypt sensitive fields - Don’t encrypt everything, focus on sensitive data
  2. Store encrypted data securely - Even though the data is encrypted, follow good security practices
  3. Document encrypted fields - Keep track of which fields are encrypted in your application
  4. Handle errors gracefully - Implement proper error handling in your application

Next Steps