@@ -36,70 +36,6 @@ public class SqlColumnEncryptionCspProvider : SqlColumnEncryptionKeyStoreProvide
36
36
/// </summary>
37
37
private const string RSAEncryptionAlgorithmWithOAEP = @"RSA_OAEP" ;
38
38
39
- /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/DecryptColumnEncryptionKey/*' />
40
- public override byte [ ] DecryptColumnEncryptionKey ( string ? masterKeyPath , string ? encryptionAlgorithm , byte [ ] ? encryptedColumnEncryptionKey )
41
- {
42
- // Validate the input parameters
43
- ValidateNonEmptyCSPKeyPath ( masterKeyPath , isSystemOp : true ) ;
44
-
45
- if ( encryptedColumnEncryptionKey is null )
46
- {
47
- throw SQL . NullEncryptedColumnEncryptionKey ( ) ;
48
- }
49
-
50
- if ( encryptedColumnEncryptionKey . Length == 0 )
51
- {
52
- throw SQL . EmptyEncryptedColumnEncryptionKey ( ) ;
53
- }
54
-
55
- // Validate encryptionAlgorithm
56
- ValidateEncryptionAlgorithm ( encryptionAlgorithm , isSystemOp : true ) ;
57
-
58
- // Create RSA Provider with the given CSP name and key name
59
- RSA rsaProvider = CreateRSACryptoProvider ( masterKeyPath , isSystemOp : true ) ;
60
- using EncryptedColumnEncryptionKeyParameters cekDecryptionParameters = new ( rsaProvider , masterKeyPath , MasterKeyType , KeyPathReference ) ;
61
-
62
- return cekDecryptionParameters . Decrypt ( encryptedColumnEncryptionKey ) ;
63
- }
64
-
65
- /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/EncryptColumnEncryptionKey/*' />
66
- public override byte [ ] EncryptColumnEncryptionKey ( string ? masterKeyPath , string ? encryptionAlgorithm , byte [ ] ? columnEncryptionKey )
67
- {
68
- // Validate the input parameters
69
- ValidateNonEmptyCSPKeyPath ( masterKeyPath , isSystemOp : false ) ;
70
-
71
- if ( columnEncryptionKey is null )
72
- {
73
- throw SQL . NullColumnEncryptionKey ( ) ;
74
- }
75
-
76
- if ( columnEncryptionKey . Length == 0 )
77
- {
78
- throw SQL . EmptyColumnEncryptionKey ( ) ;
79
- }
80
-
81
- // Validate encryptionAlgorithm
82
- ValidateEncryptionAlgorithm ( encryptionAlgorithm , isSystemOp : false ) ;
83
-
84
- // Create RSA Provider with the given CSP name and key name
85
- RSA rsaProvider = CreateRSACryptoProvider ( masterKeyPath , isSystemOp : false ) ;
86
- using EncryptedColumnEncryptionKeyParameters cekEncryptionParameters = new ( rsaProvider , masterKeyPath , MasterKeyType , KeyPathReference ) ;
87
-
88
- return cekEncryptionParameters . Encrypt ( columnEncryptionKey ) ;
89
- }
90
-
91
- /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/SignColumnMasterKeyMetadata/*' />
92
- public override byte [ ] SignColumnMasterKeyMetadata ( string ? masterKeyPath , bool allowEnclaveComputations )
93
- {
94
- throw new NotSupportedException ( ) ;
95
- }
96
-
97
- /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/VerifyColumnMasterKeyMetadata/*' />
98
- public override bool VerifyColumnMasterKeyMetadata ( string ? masterKeyPath , bool allowEnclaveComputations , byte [ ] ? signature )
99
- {
100
- throw new NotSupportedException ( ) ;
101
- }
102
-
103
39
/// <summary>
104
40
/// This function validates that the encryption algorithm is RSA_OAEP and if it is not,
105
41
/// then throws an exception.
@@ -211,5 +147,69 @@ private static int GetProviderType(string providerName, string keyPath, bool isS
211
147
return ( int ) ( key . GetValue ( @"Type" )
212
148
?? throw SQL . InvalidCspName ( providerName , keyPath , isSystemOp ) ) ;
213
149
}
150
+
151
+ /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/DecryptColumnEncryptionKey/*' />
152
+ public override byte [ ] DecryptColumnEncryptionKey ( string ? masterKeyPath , string ? encryptionAlgorithm , byte [ ] ? encryptedColumnEncryptionKey )
153
+ {
154
+ // Validate the input parameters
155
+ ValidateNonEmptyCSPKeyPath ( masterKeyPath , isSystemOp : true ) ;
156
+
157
+ if ( encryptedColumnEncryptionKey is null )
158
+ {
159
+ throw SQL . NullEncryptedColumnEncryptionKey ( ) ;
160
+ }
161
+
162
+ if ( encryptedColumnEncryptionKey . Length == 0 )
163
+ {
164
+ throw SQL . EmptyEncryptedColumnEncryptionKey ( ) ;
165
+ }
166
+
167
+ // Validate encryptionAlgorithm
168
+ ValidateEncryptionAlgorithm ( encryptionAlgorithm , isSystemOp : true ) ;
169
+
170
+ // Create RSA Provider with the given CSP name and key name
171
+ RSA rsaProvider = CreateRSACryptoProvider ( masterKeyPath , isSystemOp : true ) ;
172
+ using EncryptedColumnEncryptionKeyParameters cekDecryptionParameters = new ( rsaProvider , masterKeyPath , MasterKeyType , KeyPathReference ) ;
173
+
174
+ return cekDecryptionParameters . Decrypt ( encryptedColumnEncryptionKey ) ;
175
+ }
176
+
177
+ /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/EncryptColumnEncryptionKey/*' />
178
+ public override byte [ ] EncryptColumnEncryptionKey ( string ? masterKeyPath , string ? encryptionAlgorithm , byte [ ] ? columnEncryptionKey )
179
+ {
180
+ // Validate the input parameters
181
+ ValidateNonEmptyCSPKeyPath ( masterKeyPath , isSystemOp : false ) ;
182
+
183
+ if ( columnEncryptionKey is null )
184
+ {
185
+ throw SQL . NullColumnEncryptionKey ( ) ;
186
+ }
187
+
188
+ if ( columnEncryptionKey . Length == 0 )
189
+ {
190
+ throw SQL . EmptyColumnEncryptionKey ( ) ;
191
+ }
192
+
193
+ // Validate encryptionAlgorithm
194
+ ValidateEncryptionAlgorithm ( encryptionAlgorithm , isSystemOp : false ) ;
195
+
196
+ // Create RSA Provider with the given CSP name and key name
197
+ RSA rsaProvider = CreateRSACryptoProvider ( masterKeyPath , isSystemOp : false ) ;
198
+ using EncryptedColumnEncryptionKeyParameters cekEncryptionParameters = new ( rsaProvider , masterKeyPath , MasterKeyType , KeyPathReference ) ;
199
+
200
+ return cekEncryptionParameters . Encrypt ( columnEncryptionKey ) ;
201
+ }
202
+
203
+ /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/SignColumnMasterKeyMetadata/*' />
204
+ public override byte [ ] SignColumnMasterKeyMetadata ( string ? masterKeyPath , bool allowEnclaveComputations )
205
+ {
206
+ throw new NotSupportedException ( ) ;
207
+ }
208
+
209
+ /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionCspProvider.xml' path='docs/members[@name="SqlColumnEncryptionCspProvider"]/VerifyColumnMasterKeyMetadata/*' />
210
+ public override bool VerifyColumnMasterKeyMetadata ( string ? masterKeyPath , bool allowEnclaveComputations , byte [ ] ? signature )
211
+ {
212
+ throw new NotSupportedException ( ) ;
213
+ }
214
214
}
215
215
}
0 commit comments