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:- Your application sends a JSON payload to your project’s proxy endpoint
- You specify which fields to encrypt using the
X-Qanapi-Fieldsheader - Qanapi encrypts only those specified fields, leaving the rest untouched
- 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 theX-Qanapi-Fields header:
Encrypting Arrays
To encrypt items in an array, specify the field name in theX-Qanapi-Fields header. All items in the array will be encrypted:
Error Handling
Common errors when encrypting data include:Best Practices for Encryption
- Only encrypt sensitive fields - Don’t encrypt everything, focus on sensitive data
- Store encrypted data securely - Even though the data is encrypted, follow good security practices
- Document encrypted fields - Keep track of which fields are encrypted in your application
- Handle errors gracefully - Implement proper error handling in your application