Sdílet prostřednictvím


ClientEncryptionPolicy Class

Definition

The ClientEncryptionPolicy should be initialized with policyFormatVersion 2 and "Deterministic" encryption type, if "id" property or properties which are part of partition key need to be encrypted. All partition key property values have to be JSON strings.

public sealed class ClientEncryptionPolicy
type ClientEncryptionPolicy = class
Public NotInheritable Class ClientEncryptionPolicy
Inheritance
ClientEncryptionPolicy

Examples

This example shows how to create a ClientEncryptionPolicy.

Collection<ClientEncryptionIncludedPath> paths = new Collection<ClientEncryptionIncludedPath>()
{
   new ClientEncryptionIncludedPath()
   {
       Path = partitionKeyPath,
       ClientEncryptionKeyId = "key1",
       EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256",
       EncryptionType = "Deterministic"
   },
   new ClientEncryptionIncludedPath()
   {
       Path = "/id",
       ClientEncryptionKeyId = "key2",
       EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256",
       EncryptionType = "Deterministic"
   },
};

ContainerProperties setting = new ContainerProperties()
{
   Id = containerName,
   PartitionKeyPath = partitionKeyPath,
   ClientEncryptionPolicy = new ClientEncryptionPolicy(includedPaths:paths, policyFormatVersion:2)
};

Constructors

ClientEncryptionPolicy(IEnumerable<ClientEncryptionIncludedPath>, Int32)

Initializes a new instance of the ClientEncryptionPolicy class. Note: If you need to include partition key or id field paths as part of ClientEncryptionPolicy, please set PolicyFormatVersion to 2.

ClientEncryptionPolicy(IEnumerable<ClientEncryptionIncludedPath>)

Initializes a new instance of the ClientEncryptionPolicy class. The PolicyFormatVersion will be set to 1. Note: If you need to include partition key or id field paths as part of ClientEncryptionPolicy, please set PolicyFormatVersion to 2.

Properties

IncludedPaths

Paths of the item that need encryption along with path-specific settings.

PolicyFormatVersion

Version of the client encryption policy definition.

Applies to