diff --git a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml index e879311ed1c1..1b490e429b18 100644 --- a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml +++ b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml @@ -171,6 +171,7 @@ + @@ -229,6 +230,9 @@ + + + diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index 011c09c42f17..6e28723c44ed 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -116,6 +116,11 @@ endif TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \ -define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%) -resource:LinkerDescriptor/mscorlib_test.xml,$(test_lib:.dll=.xml) +ifeq ($(PROFILE),net_4_x) +LIB_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE +TEST_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE +endif + CC_PROFILE := $(filter monotouch% xammac, $(PROFILE)) ifdef CC_PROFILE diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs similarity index 98% rename from mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs rename to mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs index bb67bfa14f5b..8ae5b7a95edc 100755 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs @@ -30,7 +30,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if FULL_AOT_RUNTIME +#if !FEATURE_CRYPTO_CONFIGURABLE // This is a special version of CryptoConfig that is not configurable and // every "choice" is statiscally compiled. As long as CreateFromName is not @@ -61,7 +61,6 @@ public static object CreateFromName (string name) return CreateFromName (name, null); } - [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)] public static object CreateFromName (string name, params object[] args) { if (name == null) @@ -156,8 +155,8 @@ public static object CreateFromName (string name, params object[] args) case "system.security.cryptography.hashalgorithm": case "system.security.cryptography.sha1": case "system.security.cryptography.sha1cryptoserviceprovider": - case "system.security.cryptography.sha1cng": case "sha1": + case "system.security.cryptography.sha1cng": case "sha": case "http://www.w3.org/2000/09/xmldsig#sha1": return new SHA1CryptoServiceProvider (); @@ -197,10 +196,10 @@ public static object CreateFromName (string name, params object[] args) name = "System.Security.Cryptography.X509Certificates.X509Chain, System"; break; case "aes": -#if FULL_AOT_DESKTOP // TODO: why is this special cased? we could use AesManaged like other full AOT profiles - name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core"; -#else +#if MONOTOUCH || XAMMAC name = "System.Security.Cryptography.AesManaged, System.Core"; +#else + name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core"; #endif break; } diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs index 31748bb48324..c5cc328844c4 100644 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs @@ -30,7 +30,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if !FULL_AOT_RUNTIME +#if FEATURE_CRYPTO_CONFIGURABLE using System.Collections; using System.Collections.Generic; diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs index 0099a29f0f6c..2a529269c9a7 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs @@ -137,20 +137,9 @@ public void CreateFromName () // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml) // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/ [Test] -#if MOBILE - [Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")] -#endif public void CreateFromURL () { - // URL used in SignatureMethod element - CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription"); - CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription"); - CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", "System.Security.Cryptography.HMACSHA1"); - // URL used in DigestMethod element - CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider"); +#if FEATURE_CRYPTO_CONFIGURABLE // URL used in Canonicalization or Transform elements CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", "System.Security.Cryptography.Xml.XmlDsigC14NTransform"); CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform"); @@ -171,6 +160,17 @@ public void CreateFromURL () CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/DSAKeyValue", "System.Security.Cryptography.Xml.DSAKeyValue"); CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/RSAKeyValue", "System.Security.Cryptography.Xml.RSAKeyValue"); CreateFromName ("http://www.w3.org/2000/09/xmldsig# RetrievalMethod", "System.Security.Cryptography.Xml.KeyInfoRetrievalMethod"); +#endif + // URL used in SignatureMethod element + CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription"); + CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription"); + CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", "System.Security.Cryptography.HMACSHA1"); + // URL used in DigestMethod element + CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider"); + CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha256", "System.Security.Cryptography.SHA256Managed"); CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha384", null); CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha512", "System.Security.Cryptography.SHA512Managed"); diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs index 82e664df946b..d20a3cdf69b4 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs @@ -309,17 +309,16 @@ public void DSASignatureDescription () [Test] public void RSASignatureDescription () { -// TODO: this would be cleaner with NUnit TestCase'es but they're NUnit 2.5+ :( -#if FULL_AOT_RUNTIME || MONOTOUCH || MONODROID || XAMMAC || XAMMAC_4_5 - RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1CryptoServiceProvider"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Managed"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Managed"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Managed"); -#else +#if FEATURE_CRYPTO_CONFIGURABLE RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Cng"); +#else + RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1CryptoServiceProvider"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Managed"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Managed"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Managed"); #endif } diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources index 1259127dd62e..096a3b395b1a 100644 --- a/mcs/class/corlib/corlib.dll.sources +++ b/mcs/class/corlib/corlib.dll.sources @@ -685,7 +685,7 @@ System.Security.AccessControl/SystemAcl.cs System.Security.Cryptography/CryptoAPITransform.cs System.Security.Cryptography/CryptoConfig.cs System.Security.Cryptography/CryptoConfig.common.cs -System.Security.Cryptography/CryptoConfig.fullaot.cs +System.Security.Cryptography/CryptoConfig.Mobile.cs System.Security.Cryptography/CspKeyContainerInfo.cs System.Security.Cryptography/DESCryptoServiceProvider.cs System.Security.Cryptography/DSACryptoServiceProvider.cs