diff options
author | Vladimir Kazakov <vladimir.kazakov@live.com> | 2018-01-05 01:20:13 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-01-05 01:20:13 +0300 |
commit | d0369589868f971fd13668906b178b158541344e (patch) | |
tree | e54e28eac29de0bcf23552bf9857f553287f3cf4 /mcs/class/System | |
parent | 87315d19c6bdbb76f916b0f5c0df5043e717f579 (diff) |
XMLDSIG from .NET Core. (#6154)
Diffstat (limited to 'mcs/class/System')
-rw-r--r-- | mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs | 3 | ||||
-rw-r--r-- | mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs index ad8fe2e7fa0..f535f400b39 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs @@ -126,6 +126,9 @@ namespace System.Security.Cryptography.X509Certificates internal static X509Certificate2Impl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags, bool disableProvider = false) { + if (rawData == null || rawData.Length == 0) + return null; + #if MONO_FEATURE_BTLS if (!disableProvider) { var provider = MonoTlsProviderFactory.GetProvider (); diff --git a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs index 3b02b027426..58b7b181910 100644 --- a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs +++ b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs @@ -366,6 +366,18 @@ WYpnKQqsKIzlSqv9wwXs7B1iA7ZdvHk3TAnSnLP1o2H7ME05UnZPKCvraONdezon } [Test] + public void X509Certificate2_WhenNullProvidedAsByteArray_DoesNotThrow () + { + Assert.DoesNotThrow (() => new X509Certificate2 ((byte[]) null)); + } + + [Test] + public void X509Certificate2_WhenEmptyByteArrayProvided_DoesNotThrow () + { + Assert.DoesNotThrow (() => new X509Certificate2 (new byte [0])); + } + + [Test] public void Ctor_FileName () { string tempFile = Path.GetTempFileName (); |