Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorChris Hamons <chris.hamons@xamarin.com>2017-11-20 22:04:28 +0300
committerMarek Safar <marek.safar@gmail.com>2017-11-20 22:04:28 +0300
commitdae27ef2ba39e18aa250fe56a1c46bfd2a69f036 (patch)
tree0b6f9527fbe1826b6bc120e6b2d35c16158688e1 /mcs
parenta9853102879cc1fc16f1b622ef854eb992bec390 (diff)
Fix CryptoConfig.CreateFromName on XM Modern (#6029)
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System/System_test.dll.sources1
-rw-r--r--mcs/class/System/Test/System.Security.Cryptography/CryptoConfigTest.cs54
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs2
3 files changed, 56 insertions, 1 deletions
diff --git a/mcs/class/System/System_test.dll.sources b/mcs/class/System/System_test.dll.sources
index 24351699070..6cd61c08477 100644
--- a/mcs/class/System/System_test.dll.sources
+++ b/mcs/class/System/System_test.dll.sources
@@ -278,6 +278,7 @@ System.Net.Security/SslStreamTest.cs
System.Runtime.Versioning/FrameworkNameTest.cs
System.Security.AccessControl/SemaphoreSecurityTest.cs
System.Security.Cryptography/AsnEncodedDataTest.cs
+System.Security.Cryptography/CryptoConfigTest.cs
System.Security.Cryptography/OidCollectionTest.cs
System.Security.Cryptography/OidEnumeratorTest.cs
System.Security.Cryptography/OidTest.cs
diff --git a/mcs/class/System/Test/System.Security.Cryptography/CryptoConfigTest.cs b/mcs/class/System/Test/System.Security.Cryptography/CryptoConfigTest.cs
new file mode 100644
index 00000000000..460802f9388
--- /dev/null
+++ b/mcs/class/System/Test/System.Security.Cryptography/CryptoConfigTest.cs
@@ -0,0 +1,54 @@
+//
+// CryptoConfig.cs - NUnit tests for CryptoConfig
+//
+// Author:
+// Chris Hamons <chris.hamons@microsoft.com>
+//
+// Copyright (c) 2017 Xamarin, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+
+using NUnit.Framework;
+
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
+namespace MonoTests.System.Security.Cryptography
+{
+
+ [TestFixture]
+ public class CryptoConfigTest
+ {
+ [Test]
+ [TestCase ("http://www.w3.org/2000/09/xmldsig#dsa-sha1")]
+ [TestCase ("http://www.w3.org/2000/09/xmldsig#rsa-sha1")]
+ [TestCase ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")]
+ [TestCase ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384")]
+ [TestCase ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512")]
+ public void CryptoConfig_NonNullDigest (string name)
+ {
+ SignatureDescription signatureDescription = CryptoConfig.CreateFromName (name) as SignatureDescription;
+ Assert.NotNull (signatureDescription.CreateDigest ());
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
index 4f20771c40a..bd9af4717b1 100644
--- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
@@ -416,7 +416,7 @@ public partial class CryptoConfig {
unresolved_algorithms.Add (nameECDsa_2, defaultECDsa);
unresolved_algorithms.Add (nameECDsa_3, defaultECDsa);
-#if MONODROID
+#if MONODROID || XAMARIN_MODERN
algorithms.Add (nameSHA1Cng, defaultSHA1);
algorithms.Add (nameSHA256Cng, defaultSHA256);
algorithms.Add (nameSHA256Provider, defaultSHA256);