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 57ad0d9844..1ef4d3bf19 100644
--- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
+++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs
@@ -1696,14 +1696,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], @"/"));
+ }
}
}
@@ -1733,14 +1748,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);
+ }
}
}
@@ -1856,6 +1886,7 @@ internal static Exception InvalidCertificateLocation(string certificateLocation,
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
+ 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);
@@ -1867,6 +1898,7 @@ internal static Exception InvalidCertificateLocation(string certificateLocation,
}
else
{
+ 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);
diff --git a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
index 119d049b93..f87b2c259a 100644
--- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
+++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs
@@ -12812,7 +12812,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}'..
///
@@ -12821,7 +12832,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..
///
@@ -13199,7 +13221,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}'..
///
@@ -13208,7 +13241,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 1cb13538c2..be79cd17a3 100644
--- a/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx
+++ b/src/Microsoft.Data.SqlClient/src/Resources/Strings.resx
@@ -4035,9 +4035,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>.
@@ -4053,9 +4059,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>.
diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
index 70859e5ed7..ab055d59bf 100644
--- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
+++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
@@ -512,15 +512,19 @@ public override IEnumerable