Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureKeyVaultCosmosEncryptor"/> class.
        /// Creates an Encryption Key Provider for wrap and unwrapping Data Encryption key via a Key Vault.
        /// </summary>
        /// <param name="tokenCredential"> User provided TokenCredential for accessing Key Vault services. </param>
        public AzureKeyVaultCosmosEncryptor(TokenCredential tokenCredential)
        {
            EncryptionKeyWrapProvider wrapProvider = new AzureKeyVaultKeyWrapProvider(new UserProvidedTokenCredentialFactory(tokenCredential));

            this.cosmosDekProvider = new CosmosDataEncryptionKeyProvider(wrapProvider);
            this.cosmosEncryptor   = new CosmosEncryptor(this.cosmosDekProvider);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureKeyVaultCosmosEncryptor"/> class.
        /// Creates an Encryption Key Provider for wrap and unwrapping Data Encryption key via a Key Vault.
        /// </summary>
        /// <param name="keyVaultTokenCredentialFactory"> Factory Instance which represents a method to acquire TokenCredentials for accessing Key Vault Services. </param>
        public AzureKeyVaultCosmosEncryptor(KeyVaultTokenCredentialFactory keyVaultTokenCredentialFactory)
        {
            EncryptionKeyWrapProvider wrapProvider = new AzureKeyVaultKeyWrapProvider(keyVaultTokenCredentialFactory);

            this.cosmosDekProvider = new CosmosDataEncryptionKeyProvider(wrapProvider);
            this.cosmosEncryptor   = new CosmosEncryptor(this.cosmosDekProvider);
        }