Interface IColumnEncryptionPolicy
This policy is used by the driver to provide client side encryption capabilities. The only requirement is that the encrypted columns have the 'blob' type at schema level. Check https://docs.datastax.com/en/developer/csharp-driver/latest/features/column-encryption/ for more information about this feature.
The driver provides an AES based implementation of this policy AesColumnEncryptionPolicy.
You can implement your own policy by implementing a class that inherits the abstract class BaseColumnEncryptionPolicy<TKey>. This class provides some built-in functionality to manage the encrypted columns' metadata.
Namespace: Cassandra
Assembly: Cassandra.dll
Syntax
public interface IColumnEncryptionPolicy
Methods
Decrypt(object, byte[])
Decrypt the specified (encrypted) bytes using the cryptography materials. This method is used by the driver internally before providing the results to the application.
Declaration
byte[] Decrypt(object key, byte[] encryptedBytes)
Parameters
Type | Name | Description |
---|---|---|
object | key | |
byte[] | encryptedBytes |
Returns
Type | Description |
---|---|
byte[] | Decrypted data in a byte array. |
Encrypt(object, byte[])
Encrypt the specified bytes using the cryptography materials. This method is used by the driver internally before sending the parameters to the server.
Declaration
byte[] Encrypt(object key, byte[] objBytes)
Parameters
Type | Name | Description |
---|---|---|
object | key | |
byte[] | objBytes |
Returns
Type | Description |
---|---|
byte[] | Encrypted data in a byte array. The returned byte array can't be 'null' because 'blob' types don't allow 'null' values. |
GetColumnEncryptionMetadata(string, string, string)
Retrieves the cryptography materials for the specified column. If the column is not encrypted then it should return 'null'.
Declaration
ColumnEncryptionMetadata? GetColumnEncryptionMetadata(string ks, string table, string col)
Parameters
Type | Name | Description |
---|---|---|
string | ks | Keyspace of this encrypted column's table. |
string | table | Table of this encrypted column. |
string | col | Name of this encrypted column at schema level. |
Returns
Type | Description |
---|---|
ColumnEncryptionMetadata? |