SqlColumnEncryptionKeyStoreProvider.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //------------------------------------------------------------------------------
  2. // <copyright file="SqlException.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. // <owner current="true" primary="true">balnee</owner>
  6. // <owner current="true" primary="false">krishnib</owner>
  7. //------------------------------------------------------------------------------
  8. namespace System.Data.SqlClient
  9. {
  10. using System;
  11. /// <summary>
  12. /// Abstract base class for all column encryption Key Store providers. It exposes two functions
  13. /// 1. DecryptColumnEncryptionKey - This is the function used by SqlClient under the covers to decrypt encrypted column encryption key blob.
  14. /// 2. EncryptColumnEncryptionKey - This will be used by client tools that generate DDL for customers
  15. /// </summary>
  16. public abstract class SqlColumnEncryptionKeyStoreProvider
  17. {
  18. /// <summary>
  19. /// This function must be implemented by the corresponding Key Store providers. This function should use an asymmetric key identified by the key path
  20. /// and decrypt an encrypted column encryption key with a given encryption algorithm.
  21. /// </summary>
  22. /// <param name="masterKeyPath">Complete path of an asymmetric key. Path format is specific to a key store provider.</param>
  23. /// <param name="encryptionAlgorithm">Asymmetric Key Encryption Algorithm</param>
  24. /// <param name="encryptedColumnEncryptionKey">Encrypted Column Encryption Key</param>
  25. /// <returns>Plain text column encryption key</returns>
  26. public abstract byte[] DecryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] encryptedColumnEncryptionKey);
  27. /// <summary>
  28. /// This function must be implemented by the corresponding Key Store providers. This function should use an asymmetric key identified by a key path
  29. /// and encrypt a plain text column encryption key with a given asymmetric key encryption algorithm.
  30. /// </summary>
  31. /// <param name="keyPath">Complete path of an asymmetric key. Path format is specific to a key store provider.</param>
  32. /// <param name="encryptionAlgorithm">Asymmetric Key Encryption Algorithm</param>
  33. /// <param name="columnEncryptionKey">Plain text column encryption key to be encrypted</param>
  34. /// <returns>Encrypted column encryption key</returns>
  35. public abstract byte[] EncryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] columnEncryptionKey);
  36. }
  37. }