- Encrypted index tokens
- Index centroid salted hashes
- Index payload (embedding) encryption
- Item content encryptions
- Encrypted query tokens
index_key
, is a 256-bit symmetric cryptographic key—the same you would find when using AES-256 encryption. CyborgDB’s cryptography is based entirely on well-established cryptographic standards, including AES, HMAC, and SHA-3 (Keccak).
Without the correct index_key
, it is impossible to use a CyborgDB Encrypted Index. You cannot upsert vectors, query the index, or even delete it. Hence, it is critical to manage these encryption keys safely.
Generating Key Locally (for Development)
Do not store keys locally for production purposes. For production environments, always use secure options such as Hardware Security Modules (HSMs) or a Key Management Service (KMS). See Using Key Management Services (for Production).
1
Generate a Key with OpenSSL
Run the following command to generate a 256-bit encryption key, encoded in Base64:This saves the key to a file named
index_key.txt
. Ensure that this file is kept secure and not included in your source control.2
Use the Key in Python
You can either load the key directly from the file and use it directly with CyborgDB.
Using Key Management Services (for Production)
For production environments, a Key Management Service (KMS) or Hardware Security Module (HSM) is strongly recommended to securely store and manage encryption keys. This ensures the highest level of security by isolating the keys from application logic and providing robust access controls.Overview of KMS
A KMS is a managed service that provides centralized control over encryption keys, including:- Key Generation: Automatically generating keys with required levels of entropy.
- Secure Storage: Storing keys in a tamper-proof environment.
- Access Control: Enforcing strict role-based access control (RBAC) policies.
- Auditing: Logging key usage for compliance and monitoring.
Supported KMS Providers
CyborgDB can integrate with popular KMS providers, such as:- AWS Key Management Service (AWS KMS)
- Google Cloud Key Management (Google Cloud KMS)
- Azure Key Vault
- HashiCorp Vault
Step-by-Step Example: AWS KMS
1
Generate a Data Key Using AWS KMS
Option A: Command LineUse the AWS CLI to generate a data key:Note: The
- Replace
<Your-Key-Id>
with your KMS Key ID or ARN. - The command outputs a JSON object containing both the plaintext key and the encrypted key.
Plaintext
and CiphertextBlob
are Base64-encoded binary data.Option B: Python2
Store the Encrypted Key
- Encrypted Key: Since it’s encrypted, you can safely store it in your application’s configuration file, environment variable, or secure parameter store.
3
Use the Encrypted Key in Your Application at Runtime
In your application code, decrypt the encrypted key at runtime using AWS KMS:
Benefits of This Approach
- Security: The plaintext key is never stored persistently. It’s only available in memory during runtime.
- Simplicity: You can generate and manage the key using AWS KMS and standard AWS tools.
- No Need for Secure Storage: Since the encrypted key is safe to store in your application’s configuration, you don’t need additional secure storage solutions.