diff --git a/eng/pipelines/common/templates/steps/publish-test-results-step.yml b/eng/pipelines/common/templates/steps/publish-test-results-step.yml
index 791a8201b2..de1048580b 100644
--- a/eng/pipelines/common/templates/steps/publish-test-results-step.yml
+++ b/eng/pipelines/common/templates/steps/publish-test-results-step.yml
@@ -38,6 +38,7 @@ steps:
TestResults/*.trx
TestResults/**/*.coverage
testRunTitle: 'Linux Tests'
+ condition: succeededOrFailed()
- powershell: |
cd TestResults
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
index 9dae90ffd0..649c2c8c96 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
@@ -567,6 +567,9 @@
Microsoft\Data\SqlClient\SqlCollation.cs
+
+ Microsoft\Data\SqlClient\SqlColumnEncryptionCertificateStoreProvider.cs
+
Microsoft\Data\SqlClient\SqlColumnEncryptionEnclaveProvider.cs
@@ -950,9 +953,6 @@
Microsoft\Data\SqlClient\SSPI\NativeSspiContextProvider.cs
-
- Microsoft\Data\SqlClient\SqlColumnEncryptionCertificateStoreProvider.Windows.cs
-
Microsoft\Data\SqlClient\TdsParserSafeHandles.Windows.cs
@@ -988,9 +988,6 @@
Microsoft\Data\SqlClient\SessionHandle.netcore.Unix.cs
-
- Microsoft\Data\SqlClinet\SqlColumnEncryptionCertificateStoreProvider.netcore.Unix.cs
-
Microsoft\Data\SqlClinet\SqlColumnEncryptionCngProvider.netcore.Unix.cs
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
index 9ce3b09334..5a05345f34 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj
@@ -678,7 +678,7 @@
Microsoft\Data\SqlClient\SqlCollation.cs
-
+
Microsoft\Data\SqlClient\SqlColumnEncryptionCertificateStoreProvider.cs
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.cs
similarity index 98%
rename from src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs
rename to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.cs
index 9960447465..73e8584b20 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Windows.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.cs
@@ -324,7 +324,9 @@ private void ValidateCertificatePathLength(string masterKeyPath, bool isSystemOp
///
private string[] GetValidCertificateLocations()
{
- return new string[2] { CertLocationLocalMachine, CertLocationCurrentUser };
+ return Environment.OSVersion.Platform == PlatformID.Win32NT
+ ? new string[2] { CertLocationLocalMachine, CertLocationCurrentUser }
+ : new string[1] { CertLocationCurrentUser };
}
///
@@ -372,7 +374,8 @@ private X509Certificate2 GetCertificateByPath(string keyPath, bool isSystemOp)
// Extract the store location where the cert is stored
if (certParts.Length > 2)
{
- if (string.Equals(certParts[0], CertLocationLocalMachine, StringComparison.OrdinalIgnoreCase) == true)
+ if (string.Equals(certParts[0], CertLocationLocalMachine, StringComparison.OrdinalIgnoreCase) == true
+ && Environment.OSVersion.Platform == PlatformID.Win32NT)
{
storeLocation = StoreLocation.LocalMachine;
}
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.netcore.Unix.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.netcore.Unix.cs
deleted file mode 100644
index 598385851c..0000000000
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.netcore.Unix.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if NET
-
-using System;
-
-namespace Microsoft.Data.SqlClient
-{
- ///
- public class SqlColumnEncryptionCertificateStoreProvider : SqlColumnEncryptionKeyStoreProvider
- {
- ///
- /// Name for the certificate key store provider.
- ///
- public const string ProviderName = @"MSSQL_CERTIFICATE_STORE";
-
- ///
- /// This function uses a certificate specified by the key path
- /// and decrypts an encrypted CEK with RSA encryption algorithm.
- ///
- /// Complete path of a certificate
- /// Asymmetric Key Encryption Algorithm
- /// Encrypted Column Encryption Key
- /// Plain text column encryption key
- public override byte[] DecryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] encryptedColumnEncryptionKey)
- {
- throw new PlatformNotSupportedException();
- }
-
- ///
- /// This function uses a certificate specified by the key path
- /// and encrypts CEK with RSA encryption algorithm.
- ///
- /// Complete path of a certificate
- /// Asymmetric Key Encryption Algorithm
- /// The plaintext column encryption key
- /// Encrypted column encryption key
- public override byte[] EncryptColumnEncryptionKey(string masterKeyPath, string encryptionAlgorithm, byte[] columnEncryptionKey)
- {
- throw new PlatformNotSupportedException();
- }
-
- ///
- /// This function must be implemented by the corresponding Key Store providers. This function should use an asymmetric key identified by a key path
- /// and sign the masterkey metadata consisting of (masterKeyPath, allowEnclaveComputations bit, providerName).
- ///
- /// Complete path of an asymmetric key. Path format is specific to a key store provider.
- /// Boolean indicating whether this key can be sent to trusted enclave
- /// Signature for master key metadata
- public override byte[] SignColumnMasterKeyMetadata(string masterKeyPath, bool allowEnclaveComputations)
- {
- throw new PlatformNotSupportedException();
- }
-
- ///
- /// This function must be implemented by the corresponding Key Store providers. This function should use an asymmetric key identified by a key path
- /// and verify the masterkey metadata consisting of (masterKeyPath, allowEnclaveComputations bit, providerName).
- ///
- /// Complete path of an asymmetric key. Path format is specific to a key store provider.
- /// Boolean indicating whether this key can be sent to trusted enclave
- /// Signature for the master key metadata
- /// Boolean indicating whether the master key metadata can be verified based on the provided signature
- public override bool VerifyColumnMasterKeyMetadata(string masterKeyPath, bool allowEnclaveComputations, byte[] signature)
- {
- throw new PlatformNotSupportedException();
- }
- }
-}
-
-#endif
diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
index 06564633e8..35e4ebb356 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
@@ -1683,14 +1683,29 @@ internal static Exception LargeCertificatePathLength(int actualLength, int maxLe
internal static Exception NullCertificatePath(string[] validLocations, bool isSystemOp)
{
- Debug.Assert(2 == validLocations.Length);
- if (isSystemOp)
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
- return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePathSysErr, validLocations[0], validLocations[1], @"/"));
+ Debug.Assert(validLocations.Length == 2);
+ if (isSystemOp)
+ {
+ return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePathSysErr, validLocations[0], validLocations[1], @"/"));
+ }
+ else
+ {
+ return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePath, validLocations[0], validLocations[1], @"/"));
+ }
}
else
{
- return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePath, validLocations[0], validLocations[1], @"/"));
+ Debug.Assert(validLocations.Length == 1);
+ if (isSystemOp)
+ {
+ return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePathSysErr_Unix, validLocations[0], @"/"));
+ }
+ else
+ {
+ return ADP.ArgumentNull(TdsEnums.TCE_PARAM_MASTERKEY_PATH, StringsHelper.GetString(Strings.TCE_NullCertificatePath_Unix, validLocations[0], @"/"));
+ }
}
}
@@ -1720,14 +1735,29 @@ internal static Exception NullCngKeyPath(bool isSystemOp)
internal static Exception InvalidCertificatePath(string actualCertificatePath, string[] validLocations, bool isSystemOp)
{
- Debug.Assert(2 == validLocations.Length);
- if (isSystemOp)
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
- return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePathSysErr, actualCertificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ Debug.Assert(validLocations.Length == 2);
+ if (isSystemOp)
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePathSysErr, actualCertificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
+ else
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePath, actualCertificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
}
else
{
- return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePath, actualCertificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ Debug.Assert(validLocations.Length == 1);
+ if (isSystemOp)
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePathSysErr_Unix, actualCertificatePath, validLocations[0], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
+ else
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificatePath_Unix, actualCertificatePath, validLocations[0], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
}
}
@@ -1841,17 +1871,29 @@ internal static Exception InvalidCngKey(string masterKeyPath, string cngProvider
internal static Exception InvalidCertificateLocation(string certificateLocation, string certificatePath, string[] validLocations, bool isSystemOp)
{
-
-#if NETFRAMEWORK
- Debug.Assert(2 == validLocations.Length);
-#endif
- if (isSystemOp)
+ if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
- return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocationSysErr, certificateLocation, certificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ Debug.Assert(validLocations.Length == 2);
+ if (isSystemOp)
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocationSysErr, certificateLocation, certificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
+ else
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocation, certificateLocation, certificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
}
else
{
- return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocation, certificateLocation, certificatePath, validLocations[0], validLocations[1], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ Debug.Assert(validLocations.Length == 1);
+ if (isSystemOp)
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocationSysErr_Unix, certificateLocation, certificatePath, validLocations[0], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
+ else
+ {
+ return ADP.Argument(StringsHelper.GetString(Strings.TCE_InvalidCertificateLocation_Unix, certificateLocation, certificatePath, validLocations[0], @"/"), TdsEnums.TCE_PARAM_MASTERKEY_PATH);
+ }
}
}
diff --git a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
index b41b331db7..d056631873 100644
--- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
+++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
@@ -12818,7 +12818,18 @@ internal static string TCE_InvalidCertificateLocation {
return ResourceManager.GetString("TCE_InvalidCertificateLocation", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is '{2}'..
+ ///
+ internal static string TCE_InvalidCertificateLocation_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_InvalidCertificateLocation_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Internal error. Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{4}<certificate store>{4}<certificate thumbprint>, where <certificate location> is either '{2}' or '{3}'..
///
@@ -12827,7 +12838,18 @@ internal static string TCE_InvalidCertificateLocationSysErr {
return ResourceManager.GetString("TCE_InvalidCertificateLocationSysErr", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Internal error. Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is '{2}'..
+ ///
+ internal static string TCE_InvalidCertificateLocationSysErr_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_InvalidCertificateLocationSysErr_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Invalid certificate path: '{0}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is either '{1}' or '{2}'..
///
@@ -12836,7 +12858,18 @@ internal static string TCE_InvalidCertificatePath {
return ResourceManager.GetString("TCE_InvalidCertificatePath", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Invalid certificate path: '{0}'. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is '{1}'..
+ ///
+ internal static string TCE_InvalidCertificatePath_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_InvalidCertificatePath_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Internal error. Invalid certificate path: '{0}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is either '{1}' or '{2}'..
///
@@ -12845,7 +12878,18 @@ internal static string TCE_InvalidCertificatePathSysErr {
return ResourceManager.GetString("TCE_InvalidCertificatePathSysErr", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Internal error. Invalid certificate path: '{0}'. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is '{1}'..
+ ///
+ internal static string TCE_InvalidCertificatePathSysErr_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_InvalidCertificatePathSysErr_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The specified encrypted column encryption key signature does not match the signature computed with the column master key (certificate) in '{0}'. The encrypted column encryption key may be corrupt, or the specified path may be incorrect..
///
@@ -13223,7 +13267,18 @@ internal static string TCE_NullCertificatePath {
return ResourceManager.GetString("TCE_NullCertificatePath", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Certificate path cannot be null. Use the following format: <certificate location>{1}<certificate store>{1}<certificate thumbprint>, where <certificate location> is '{0}'..
+ ///
+ internal static string TCE_NullCertificatePath_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_NullCertificatePath_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Internal error. Certificate path cannot be null. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is either '{0}' or '{1}'..
///
@@ -13232,7 +13287,18 @@ internal static string TCE_NullCertificatePathSysErr {
return ResourceManager.GetString("TCE_NullCertificatePathSysErr", resourceCulture);
}
}
-
+
+ ///
+ /// Looks up a localized string similar to Internal error. Certificate path cannot be null. Use the following format: <certificate location>{1}<certificate store>{1}<certificate thumbprint>, where <certificate location> is '{0}'..
+ ///
+ internal static string TCE_NullCertificatePathSysErr_Unix
+ {
+ get
+ {
+ return ResourceManager.GetString("TCE_NullCertificatePathSysErr_Unix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Internal error. Ciphertext value cannot be null..
///
diff --git a/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx b/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx
index 90a157876a..a343856cdd 100644
--- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx
+++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx
@@ -4032,9 +4032,15 @@
Certificate path cannot be null. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is either '{0}' or '{1}'.
+
+ Certificate path cannot be null. Use the following format: <certificate location>{1}<certificate store>{1}<certificate thumbprint>, where <certificate location> is '{0}'.
+
Internal error. Certificate path cannot be null. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is either '{0}' or '{1}'.
+
+ Internal error. Certificate path cannot be null. Use the following format: <certificate location>{1}<certificate store>{1}<certificate thumbprint>, where <certificate location> is '{0}'.
+
Column master key path cannot be null. Use the following format for a key stored in a Microsoft cryptographic service provider (CSP): <CSP Provider Name>{0}<Key Identifier>.
@@ -4050,9 +4056,15 @@
Invalid certificate path: '{0}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is either '{1}' or '{2}'.
+
+ Invalid certificate path: '{0}'. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is '{1}'.
+
Internal error. Invalid certificate path: '{0}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is either '{1}' or '{2}'.
+
+ Internal error. Invalid certificate path: '{0}'. Use the following format: <certificate location>{2}<certificate store>{2}<certificate thumbprint>, where <certificate location> is '{1}'.
+
Invalid column master key path: '{0}'. Use the following format for a key stored in a Microsoft cryptographic service provider (CSP): <CSP Provider Name>{1}<Key Identifier>.
@@ -4068,9 +4080,15 @@
Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{4}<certificate store>{4}<certificate thumbprint>, where <certificate location> is either '{2}' or '{3}'.
+
+ Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is '{2}'.
+
Internal error. Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{4}<certificate store>{4}<certificate thumbprint>, where <certificate location> is either '{2}' or '{3}'.
+
+ Internal error. Invalid certificate location '{0}' in certificate path '{1}'. Use the following format: <certificate location>{3}<certificate store>{3}<certificate thumbprint>, where <certificate location> is '{2}'.
+
Invalid certificate store '{0}' specified in certificate path '{1}'. Expected value: '{2}'.
diff --git a/src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CertificateFixtureBase.cs b/src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CertificateFixtureBase.cs
index 9007796013..f97aedfe4e 100644
--- a/src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CertificateFixtureBase.cs
+++ b/src/Microsoft.Data.SqlClient/tests/Common/Fixtures/CertificateFixtureBase.cs
@@ -59,7 +59,7 @@ protected X509Certificate2 CreateCertificate(string subjectName, IEnumerable
+ public class SqlColumnEncryptionCertificateStoreProviderShould : IClassFixture
{
private const string PRIMARY_CERTIFICATE_PATH = "CurrentUser/My/{primary_thumbprint}";
private const string SECONDARY_CERTIFICATE_PATH = "CurrentUser/My/{secondary_thumbprint}";
@@ -97,7 +97,7 @@ public class SqlColumnEncryptionCertificateStoreProviderWindowsShould : IClassFi
private readonly ColumnEncryptionCertificateFixture _certFixture;
- public SqlColumnEncryptionCertificateStoreProviderWindowsShould(ColumnEncryptionCertificateFixture certFixture)
+ public SqlColumnEncryptionCertificateStoreProviderShould(ColumnEncryptionCertificateFixture certFixture)
{
_certFixture = certFixture;
@@ -107,7 +107,6 @@ public SqlColumnEncryptionCertificateStoreProviderWindowsShould(ColumnEncryption
[Theory]
[InvalidDecryptionParameters]
- [PlatformSpecific(TestPlatforms.Windows)]
public void ThrowExceptionWithInvalidParameterWhileDecryptingColumnEncryptionKey(string errorMsg, Type exceptionType, string masterKeyPath, string encryptionAlgorithm, byte[] bytes)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -118,7 +117,6 @@ public void ThrowExceptionWithInvalidParameterWhileDecryptingColumnEncryptionKey
[Theory]
[InvalidEncryptionParameters]
- [PlatformSpecific(TestPlatforms.Windows)]
public void ThrowExceptionWithInvalidParameterWhileEncryptingColumnEncryptionKey(string errorMsg, Type exceptionType, string masterKeyPath, string encryptionAlgorithm, byte[] bytes)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -128,7 +126,6 @@ public void ThrowExceptionWithInvalidParameterWhileEncryptingColumnEncryptionKey
[Theory]
[InvalidSigningParameters]
- [PlatformSpecific(TestPlatforms.Windows)]
public void ThrowExceptionWithInvalidParameterWhileSigningColumnMasterKeyMetadata(string errorMsg, Type exceptionType, string masterKeyPath)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -140,7 +137,6 @@ public void ThrowExceptionWithInvalidParameterWhileSigningColumnMasterKeyMetadat
[InlineData("CurrentUser/My/{primary_thumbprint}")]
[InlineData("CURRENTUSER/My/{primary_thumbprint}")]
[InlineData("currentuser/My/{primary_thumbprint}")]
- [PlatformSpecific(TestPlatforms.Windows)]
public void SetStoreLocationAppropriatelyFromMasterKeyPathRegardlessOfCase(string masterKeyPath)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -152,7 +148,6 @@ public void SetStoreLocationAppropriatelyFromMasterKeyPathRegardlessOfCase(strin
[InlineData("CurrentUser/my/{primary_thumbprint}")]
[InlineData("CurrentUser/MY/{primary_thumbprint}")]
[InlineData("CurrentUser/My/{primary_thumbprint}")]
- [PlatformSpecific(TestPlatforms.Windows)]
public void SetStoreNameAppropriatelyFromMasterKeyPathRegardlessOfCase(string masterKeyPath)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -164,7 +159,6 @@ public void SetStoreNameAppropriatelyFromMasterKeyPathRegardlessOfCase(string ma
[InlineData("RSA_OAEP")]
[InlineData("rsa_oaep")]
[InlineData("RsA_oAeP")]
- [PlatformSpecific(TestPlatforms.Windows)]
public void AcceptEncryptionAlgorithmRegardlessOfCase(string algorithm)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -176,7 +170,6 @@ public void AcceptEncryptionAlgorithmRegardlessOfCase(string algorithm)
[InlineData(32)]
[InlineData(64)]
[InlineData(128)]
- [PlatformSpecific(TestPlatforms.Windows)]
public void EncryptKeyAndThenDecryptItSuccessfully(int dataSize)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -192,7 +185,6 @@ public void EncryptKeyAndThenDecryptItSuccessfully(int dataSize)
[Theory]
[InlineData(true)]
[InlineData(false)]
- [PlatformSpecific(TestPlatforms.Windows)]
public void SignAndVerifyColumnMasterKeyMetadataSuccessfully(bool allowEnclaveComputations)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -205,7 +197,6 @@ public void SignAndVerifyColumnMasterKeyMetadataSuccessfully(bool allowEnclaveCo
[Theory]
[InlineData(true)]
[InlineData(false)]
- [PlatformSpecific(TestPlatforms.Windows)]
public void FailToVerifyColumnMasterKeyMetadataWithWrongCertificate(bool allowEnclaveComputations)
{
var provider = new SqlColumnEncryptionCertificateStoreProvider();
@@ -217,7 +208,6 @@ public void FailToVerifyColumnMasterKeyMetadataWithWrongCertificate(bool allowEn
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
public void EncryptAndDecryptDataSuccessfully()
{
var input = new byte[] { 1, 2, 3, 4, 5 };
@@ -240,7 +230,6 @@ public void EncryptAndDecryptDataSuccessfully()
, DisableDiscoveryEnumeration = true
#endif
)]
- [PlatformSpecific(TestPlatforms.Windows)]
public void TestCEKEncryptionReversal(StoreLocation certificateStoreLocation, String certificateStoreNameAndLocation)
{
Assert.True(!string.IsNullOrWhiteSpace(certificateStoreNameAndLocation));
@@ -304,7 +293,6 @@ private void TestEncryptionReversalUsingAead(byte[] plainTextInBytes, byte[] roo
}
[Theory]
- [PlatformSpecific(TestPlatforms.Windows)]
[AeadEncryptionParameters]
public void TestAeadEncryptionReversal(string dataType, object data, Utility.CColumnEncryptionType encType)
{
@@ -339,7 +327,6 @@ public void TestAeadEncryptionReversal(string dataType, object data, Utility.CCo
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
public void TestCustomKeyProviderListSetter()
{
lock (Utility.ClearSqlConnectionGlobalProvidersLock)
@@ -396,7 +383,6 @@ public void TestCustomKeyProviderListSetter()
, DisableDiscoveryEnumeration = true
#endif
)]
- [PlatformSpecific(TestPlatforms.Windows)]
public void TestValidCertificatePaths(string certificateStoreNameAndLocation, object location)
{
StoreLocation certificateStoreLocation;
@@ -411,7 +397,9 @@ public void TestValidCertificatePaths(string certificateStoreNameAndLocation, ob
}
else
{
- certificateStoreLocation = StoreLocation.CurrentUser;
+ certificateStoreLocation = Environment.OSVersion.Platform == PlatformID.Win32NT
+ ? StoreLocation.LocalMachine
+ : StoreLocation.CurrentUser;
}
// Fetch the newly created cert.
@@ -436,7 +424,6 @@ public void TestValidCertificatePaths(string certificateStoreNameAndLocation, ob
}
[Theory]
- [PlatformSpecific(TestPlatforms.Windows)]
[InlineData(new object[3] { @"iv", Utility.CColumnEncryptionType.Randomized, @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" })]
[InlineData(new object[3] { @"tag", Utility.CColumnEncryptionType.Randomized, @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" })]
[InlineData(new object[3] { @"cipher", Utility.CColumnEncryptionType.Randomized, @"Specified ciphertext has an invalid authentication tag.\s+\(?Parameter (name: )?'?cipherText('\))?" })]
@@ -532,26 +519,35 @@ public static IEnumerable