Skip to content

Commit e3045f0

Browse files
Introduce Async API counterparts for AE base class
1 parent aea5ade commit e3045f0

2 files changed

Lines changed: 103 additions & 3 deletions

File tree

doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,26 @@
2424
Decrypts the specified encrypted value of a column encryption key. The encrypted value is expected to be encrypted using the column master key with the specified key path and using the specified algorithm.
2525
</summary>
2626
<returns>
27-
Returns <see cref="T:System.Byte" />. The decrypted column encryption key.
27+
Returns <see cref="T:System.Byte" /> array representing the decrypted column encryption key.
2828
</returns>
2929
</DecryptColumnEncryptionKey>
30+
<DecryptColumnEncryptionKeyAsync>
31+
<param name="masterKeyPath">
32+
The master key path.
33+
</param>
34+
<param name="encryptionAlgorithm">
35+
The encryption algorithm.
36+
</param>
37+
<param name="encryptedColumnEncryptionKey">
38+
The encrypted column encryption key.
39+
</param>
40+
<summary>
41+
Decrypts the specified encrypted value of a column encryption key asynchronously. The encrypted value is expected to be encrypted using the column master key with the specified key path and using the specified algorithm.
42+
</summary>
43+
<returns>
44+
Returns a task that returns <see cref="T:System.Byte" /> array representing the decrypted column encryption key on completion.
45+
</returns>
46+
</DecryptColumnEncryptionKeyAsync>
3047
<EncryptColumnEncryptionKey>
3148
<param name="masterKeyPath">
3249
The master key path.
@@ -41,9 +58,26 @@
4158
Encrypts a column encryption key using the column master key with the specified key path and using the specified algorithm.
4259
</summary>
4360
<returns>
44-
Returns <see cref="T:System.Byte" />. The encrypted column encryption key.
61+
Returns <see cref="T:System.Byte" /> array representing the encrypted column encryption key.
4562
</returns>
4663
</EncryptColumnEncryptionKey>
64+
<EncryptColumnEncryptionKeyAsync>
65+
<param name="masterKeyPath">
66+
The master key path.
67+
</param>
68+
<param name="encryptionAlgorithm">
69+
The encryption algorithm.
70+
</param>
71+
<param name="columnEncryptionKey">
72+
The plaintext column encryption key.
73+
</param>
74+
<summary>
75+
Encrypts a column encryption key asynchronously using the column master key with the specified key path and using the specified algorithm.
76+
</summary>
77+
<returns>
78+
Returns a task that returns <see cref="T:System.Byte" /> array representing the encrypted column encryption key on completion.
79+
</returns>
80+
</EncryptColumnEncryptionKeyAsync>
4781
<SignColumnMasterKeyMetadata>
4882
<param name="masterKeyPath">
4983
The column master key path.
@@ -55,7 +89,7 @@
5589
When implemented in a derived class, digitally signs the column master key metadata with the column master key referenced by the <paramref name="masterKeyPath" /> parameter. The input values used to generate the signature should be the specified values of the <paramref name="masterKeyPath" /> and <paramref name="allowEnclaveComputations" /> parameters.
5690
</summary>
5791
<returns>
58-
The signature of the column master key metadata.
92+
Returns the signature of the column master key metadata.
5993
</returns>
6094
<remarks>
6195
<para>
@@ -69,6 +103,31 @@
69103
In all cases.
70104
</exception>
71105
</SignColumnMasterKeyMetadata>
106+
<SignColumnMasterKeyMetadataAsync>
107+
<param name="masterKeyPath">
108+
The column master key path.
109+
</param>
110+
<param name="allowEnclaveComputations">
111+
<see langword="true" /> to indicate that the column master key supports enclave computations; otherwise, <see langword="false" />.
112+
</param>
113+
<summary>
114+
When implemented in a derived class, asynchronously digitally signs the column master key metadata with the column master key referenced by the <paramref name="masterKeyPath" /> parameter. The input values used to generate the signature should be the specified values of the <paramref name="masterKeyPath" /> and <paramref name="allowEnclaveComputations" /> parameters.
115+
</summary>
116+
<returns>
117+
Returns a task that returns the signature of the column master key metadata on completion.
118+
</returns>
119+
<remarks>
120+
<para>
121+
To ensure that the <see cref="M:Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider.SignColumnMasterKeyMetadata(System.String,System.Boolean)" /> method doesn't break applications that rely on an old API, it throws a <see cref="T:System.NotImplementedException" /> exception by default.
122+
</para>
123+
<para>
124+
The <see cref="M:Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider.SignColumnMasterKeyMetadata(System.String,System.Boolean)" /> method will be used by client tools that generate Column Master Keys (CMK) for customers. <see cref="M:Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider.SignColumnMasterKeyMetadata(System.String,System.Boolean)" /> must be implemented by the corresponding key store providers that wish to use enclaves with <see href="https://learn.microsoft.com/sql/relational-databases/security/encryption/always-encrypted-database-engine">Always Encrypted</see>.
125+
</para>
126+
</remarks>
127+
<exception cref="T:System.NotImplementedException">
128+
In all cases.
129+
</exception>
130+
</SignColumnMasterKeyMetadataAsync>
72131
<VerifyColumnMasterKeyMetadata>
73132
<param name="masterKeyPath">
74133
The column master key path.
@@ -86,6 +145,23 @@
86145
When implemented in a derived class, the method is expected to return true if the specified signature is valid, or false if the specified signature is not valid. The default implementation throws `NotImplementedException`.
87146
</returns>
88147
</VerifyColumnMasterKeyMetadata>
148+
<VerifyColumnMasterKeyMetadataAsync>
149+
<param name="masterKeyPath">
150+
The column master key path.
151+
</param>
152+
<param name="allowEnclaveComputations">
153+
Indicates whether the column master key supports enclave computations.
154+
</param>
155+
<param name="signature">
156+
The signature of the column master key metadata.
157+
</param>
158+
<summary>
159+
When implemented in a derived class, this method is expected to verify the specified signature is valid for the column master key with the specified key path and the specified enclave behavior asynchronously. The default implementation throws `NotImplementedException`.
160+
</summary>
161+
<returns>
162+
When implemented in a derived class, the method is expected to return true if the specified signature is valid, or false if the specified signature is not valid. The default implementation throws `NotImplementedException`.
163+
</returns>
164+
</VerifyColumnMasterKeyMetadataAsync>
89165
<ColumnEncryptionKeyCacheTtl>
90166
<summary>
91167
Gets or sets the lifespan of the decrypted column encryption key in the cache. Once the timespan has elapsed, the decrypted column encryption key is discarded and must be revalidated.

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionKeyStoreProvider.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Threading.Tasks;
67

78
namespace Microsoft.Data.SqlClient
89
{
@@ -16,19 +17,42 @@ public abstract class SqlColumnEncryptionKeyStoreProvider
1617
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/DecryptColumnEncryptionKey/*'/>
1718
public abstract byte[] DecryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] encryptedColumnEncryptionKey);
1819

20+
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/DecryptColumnEncryptionKeyAsync/*'/>
21+
public virtual Task<byte[]> DecryptColumnEncryptionKeyAsync(string masterKeyPath, string encryptionAlgorithm, byte[] encryptedColumnEncryptionKey)
22+
{
23+
throw new NotImplementedException();
24+
}
25+
1926
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/EncryptColumnEncryptionKey/*'/>
2027
public abstract byte[] EncryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] columnEncryptionKey);
2128

29+
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/EncryptColumnEncryptionKeyAsync/*'/>
30+
public virtual Task<byte[]> EncryptColumnEncryptionKeyAsync(string masterKeyPath, string encryptionAlgorithm, byte[] columnEncryptionKey)
31+
{
32+
throw new NotImplementedException();
33+
}
34+
2235
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/SignColumnMasterKeyMetadata/*'/>
2336
public virtual byte[] SignColumnMasterKeyMetadata(string masterKeyPath, bool allowEnclaveComputations)
2437
{
2538
throw new NotImplementedException();
2639
}
40+
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/SignColumnMasterKeyMetadataAsync/*'/>
41+
public virtual Task<byte[]> SignColumnMasterKeyMetadataAsync(string masterKeyPath, bool allowEnclaveComputations)
42+
{
43+
throw new NotImplementedException();
44+
}
2745

2846
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/VerifyColumnMasterKeyMetadata/*'/>
2947
public virtual bool VerifyColumnMasterKeyMetadata(string masterKeyPath, bool allowEnclaveComputations, byte[] signature)
3048
{
3149
throw new NotImplementedException();
3250
}
51+
52+
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionKeyStoreProvider.xml' path='docs/members[@name="SqlColumnEncryptionKeyStoreProvider"]/VerifyColumnMasterKeyMetadataAsync/*'/>
53+
public virtual Task<bool> VerifyColumnMasterKeyMetadataAsync(string masterKeyPath, bool allowEnclaveComputations, byte[] signature)
54+
{
55+
throw new NotImplementedException();
56+
}
3357
}
3458
}

0 commit comments

Comments
 (0)