16
16
17
17
namespace Microsoft . Data . SqlClient . Tests . AlwaysEncryptedTests
18
18
{
19
- public class SqlColumnEncryptionCertificateStoreProviderWindowsShould : IClassFixture < CertificateFixture >
19
+ public class SqlColumnEncryptionCertificateStoreProviderShould : IClassFixture < CertificateFixture >
20
20
{
21
21
private const string MASTER_KEY_PATH = "CurrentUser/My/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ;
22
22
private const string ENCRYPTION_ALGORITHM = "RSA_OAEP" ;
@@ -95,7 +95,6 @@ public class SqlColumnEncryptionCertificateStoreProviderWindowsShould : IClassFi
95
95
96
96
[ Theory ]
97
97
[ InvalidDecryptionParameters ]
98
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
99
98
public void ThrowExceptionWithInvalidParameterWhileDecryptingColumnEncryptionKey ( string errorMsg , Type exceptionType , string masterKeyPath , string encryptionAlgorithm , byte [ ] bytes )
100
99
{
101
100
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -105,7 +104,6 @@ public void ThrowExceptionWithInvalidParameterWhileDecryptingColumnEncryptionKey
105
104
106
105
[ Theory ]
107
106
[ InvalidEncryptionParameters ]
108
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
109
107
public void ThrowExceptionWithInvalidParameterWhileEncryptingColumnEncryptionKey ( string errorMsg , Type exceptionType , string masterKeyPath , string encryptionAlgorithm , byte [ ] bytes )
110
108
{
111
109
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -115,7 +113,6 @@ public void ThrowExceptionWithInvalidParameterWhileEncryptingColumnEncryptionKey
115
113
116
114
[ Theory ]
117
115
[ InvalidSigningParameters ]
118
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
119
116
public void ThrowExceptionWithInvalidParameterWhileSigningColumnMasterKeyMetadata ( string errorMsg , Type exceptionType , string masterKeyPath )
120
117
{
121
118
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -127,7 +124,6 @@ public void ThrowExceptionWithInvalidParameterWhileSigningColumnMasterKeyMetadat
127
124
[ InlineData ( "CurrentUser/My/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
128
125
[ InlineData ( "CURRENTUSER/My/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
129
126
[ InlineData ( "currentuser/My/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
130
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
131
127
public void SetStoreLocationApproperiatelyFromMasterKeyPathRegardlessOfCase ( string masterKeyPath )
132
128
{
133
129
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -139,7 +135,6 @@ public void SetStoreLocationApproperiatelyFromMasterKeyPathRegardlessOfCase(stri
139
135
[ InlineData ( "CurrentUser/my/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
140
136
[ InlineData ( "CurrentUser/MY/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
141
137
[ InlineData ( "CurrentUser/My/C74D53B816A971E3FF9714FE1DD2E57E1710D946" ) ]
142
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
143
138
public void SetStoreNameApproperiatelyFromMasterKeyPathRegardlessOfCase ( string masterKeyPath )
144
139
{
145
140
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -151,7 +146,6 @@ public void SetStoreNameApproperiatelyFromMasterKeyPathRegardlessOfCase(string m
151
146
[ InlineData ( "RSA_OAEP" ) ]
152
147
[ InlineData ( "rsa_oaep" ) ]
153
148
[ InlineData ( "RsA_oAeP" ) ]
154
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
155
149
public void AcceptEncryptionAlgorithmRegardlessOfCase ( string algorithm )
156
150
{
157
151
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -163,7 +157,6 @@ public void AcceptEncryptionAlgorithmRegardlessOfCase(string algorithm)
163
157
[ InlineData ( 32 ) ]
164
158
[ InlineData ( 64 ) ]
165
159
[ InlineData ( 128 ) ]
166
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
167
160
public void EncryptKeyAndThenDecryptItSuccessfully ( int dataSize )
168
161
{
169
162
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -179,7 +172,6 @@ public void EncryptKeyAndThenDecryptItSuccessfully(int dataSize)
179
172
[ Theory ]
180
173
[ InlineData ( true ) ]
181
174
[ InlineData ( false ) ]
182
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
183
175
public void SignAndVerifyColumnMasterKeyMetadataSuccessfully ( bool allowEnclaveComputations )
184
176
{
185
177
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -192,7 +184,6 @@ public void SignAndVerifyColumnMasterKeyMetadataSuccessfully(bool allowEnclaveCo
192
184
[ Theory ]
193
185
[ InlineData ( true ) ]
194
186
[ InlineData ( false ) ]
195
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
196
187
public void FailToVerifyColumnMasterKeyMetadataWithWrongCertificate ( bool allowEnclaveComputations )
197
188
{
198
189
var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
@@ -204,7 +195,6 @@ public void FailToVerifyColumnMasterKeyMetadataWithWrongCertificate(bool allowEn
204
195
}
205
196
206
197
[ Fact ]
207
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
208
198
public void EncryptAndDecryptDataSuccessfully ( )
209
199
{
210
200
var input = new byte [ ] { 1 , 2 , 3 , 4 , 5 } ;
@@ -218,7 +208,6 @@ public void EncryptAndDecryptDataSuccessfully()
218
208
219
209
[ Theory ]
220
210
[ CEKEncryptionReversalParameters ]
221
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
222
211
public void TestCEKEncryptionReversal ( StoreLocation certificateStoreLocation , String certificateStoreNameAndLocation )
223
212
{
224
213
Assert . True ( ! string . IsNullOrWhiteSpace ( certificateStoreNameAndLocation ) ) ;
@@ -284,7 +273,6 @@ private void TestEncryptionReversalUsingAead(byte[] plainTextInBytes, byte[] roo
284
273
}
285
274
286
275
[ Theory ]
287
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
288
276
[ AeadEncryptionParameters ]
289
277
public void TestAeadEncryptionReversal ( string dataType , object data , Utility . CColumnEncryptionType encType )
290
278
{
@@ -319,7 +307,6 @@ public void TestAeadEncryptionReversal(string dataType, object data, Utility.CCo
319
307
}
320
308
321
309
[ Fact ]
322
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
323
310
public void TestCustomKeyProviderListSetter ( )
324
311
{
325
312
lock ( Utility . ClearSqlConnectionGlobalProvidersLock )
@@ -370,7 +357,6 @@ public void TestCustomKeyProviderListSetter()
370
357
}
371
358
372
359
[ Theory ]
373
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
374
360
[ ValidCertificatePathsParameters ]
375
361
public void TestValidCertificatePaths ( string certificateStoreNameAndLocation , object location )
376
362
{
@@ -414,7 +400,6 @@ public void TestValidCertificatePaths(string certificateStoreNameAndLocation, ob
414
400
}
415
401
416
402
[ Theory ]
417
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
418
403
[ InlineData ( new object [ 3 ] { @"iv" , Utility . CColumnEncryptionType . Randomized , @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" } ) ]
419
404
[ InlineData ( new object [ 3 ] { @"tag" , Utility . CColumnEncryptionType . Randomized , @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" } ) ]
420
405
[ InlineData ( new object [ 3 ] { @"cipher" , Utility . CColumnEncryptionType . Randomized , @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" } ) ]
@@ -617,29 +602,12 @@ public static string GenerateString(int length)
617
602
}
618
603
}
619
604
620
- public class SqlColumnEncryptionCertificateStoreProviderUnixShould
621
- {
622
- [ Fact ]
623
- [ PlatformSpecific ( TestPlatforms . AnyUnix ) ]
624
- public void ThrowPlatformNotSupportedExceptionInUnix ( )
625
- {
626
- var provider = new SqlColumnEncryptionCertificateStoreProvider ( ) ;
627
- Assert . Throws < PlatformNotSupportedException > ( ( ) => provider . EncryptColumnEncryptionKey ( "" , "" , new byte [ ] { } ) ) ;
628
- Assert . Throws < PlatformNotSupportedException > ( ( ) => provider . DecryptColumnEncryptionKey ( "" , "" , new byte [ ] { } ) ) ;
629
- Assert . Throws < PlatformNotSupportedException > ( ( ) => provider . SignColumnMasterKeyMetadata ( "" , false ) ) ;
630
- Assert . Throws < PlatformNotSupportedException > ( ( ) => provider . VerifyColumnMasterKeyMetadata ( "" , false , new byte [ ] { } ) ) ;
631
- }
632
- }
633
-
634
605
public class CertificateFixture : IDisposable
635
606
{
636
607
public static bool IsAdmin
637
608
{
638
609
get
639
610
{
640
- #if NET
641
- System . Diagnostics . Debug . Assert ( OperatingSystem . IsWindows ( ) ) ;
642
- #endif
643
611
return new WindowsPrincipal ( WindowsIdentity . GetCurrent ( ) ) . IsInRole ( WindowsBuiltInRole . Administrator ) ;
644
612
}
645
613
}
0 commit comments