Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -137,7 +137,7 @@ public class CryptoConfigTest {
// 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 NET_2_1
#if MOBILE
[Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")]
#endif
public void CreateFromURL ()
@@ -145,6 +145,9 @@ public class CryptoConfigTest {
// 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", null);
// URL used in DigestMethod element
CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
@@ -303,17 +306,24 @@ public class CryptoConfigTest {
MapNameToOID ("System.Security.Cryptography.SHA1", "1.3.14.3.2.26");
// MapNameToOID ("System.Security.Cryptography.HashAlgorithm", "1.3.14.3.2.26");
MapNameToOID ("System.Security.Cryptography.SHA1CryptoServiceProvider", "1.3.14.3.2.26");
MapNameToOID ("System.Security.Cryptography.SHA1Cng", "1.3.14.3.2.26");
MapNameToOID ("System.Security.Cryptography.SHA1Managed", "1.3.14.3.2.26");
MapNameToOID ("MD5", "1.2.840.113549.2.5");
MapNameToOID ("System.Security.Cryptography.MD5", "1.2.840.113549.2.5");
MapNameToOID ("System.Security.Cryptography.MD5CryptoServiceProvider", "1.2.840.113549.2.5");
MapNameToOID ("SHA256", "2.16.840.1.101.3.4.2.1");
MapNameToOID ("System.Security.Cryptography.SHA256CryptoServiceProvider", "2.16.840.1.101.3.4.2.1");
MapNameToOID ("System.Security.Cryptography.SHA256Cng", "2.16.840.1.101.3.4.2.1");
MapNameToOID ("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.2.1");
MapNameToOID ("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.2.1");
MapNameToOID ("SHA384", "2.16.840.1.101.3.4.2.2");
MapNameToOID ("System.Security.Cryptography.SHA384CryptoServiceProvider", "2.16.840.1.101.3.4.2.2");
MapNameToOID ("System.Security.Cryptography.SHA384Cng", "2.16.840.1.101.3.4.2.2");
MapNameToOID ("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2.2");
MapNameToOID ("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2.2");
MapNameToOID ("SHA512", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512CryptoServiceProvider", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512Cng", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.2.3");
MapNameToOID ("RIPEMD160", "1.3.36.3.2.1");

View File

@@ -324,7 +324,7 @@ namespace MonoTests.System.Security.Cryptography {
}
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void Read_Disposed_Break ()

View File

@@ -857,7 +857,7 @@ public class DSACryptoServiceProviderTest {
}
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")]
public void CspKeyContainerInfo_NewKeypair ()

View File

@@ -345,7 +345,7 @@ public class HashAlgorithmTest {
public virtual bool ManagedHashImplementation {
get { return false; }
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // Mono nevers throws an exception (and we're all managed ;-)
public void TransformFinalBlock_Twice ()
@@ -424,7 +424,7 @@ public class HashAlgorithmTest {
{
Assert.AreEqual (HashBuffer (false), HashBuffer (true), "Intersect");
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (NullReferenceException))]
[Category ("NotWorking")] // initialization problem ? fx2.0 only ?

View File

@@ -79,7 +79,7 @@ public class PasswordDeriveBytesTest {
PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, new CspParameters ());
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
public void Ctor_PasswordSaltNullCspParameters ()
@@ -100,7 +100,7 @@ public class PasswordDeriveBytesTest {
Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
public void Ctor_PasswordSaltCspParameters ()
@@ -176,7 +176,7 @@ public class PasswordDeriveBytesTest {
PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, "SHA1", 1, new CspParameters ());
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
public void Ctor_PasswordSaltNullHashIterationCspParameters ()
@@ -209,7 +209,7 @@ public class PasswordDeriveBytesTest {
PasswordDeriveBytes pdb = new PasswordDeriveBytes ("s3kr3t", salt, "SHA1", 0, new CspParameters ());
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
public void Ctor_PasswordSaltHashIterationMaxValueCspParameters ()
@@ -230,7 +230,7 @@ public class PasswordDeriveBytesTest {
Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
public void Ctor_PasswordSaltHashIterationCspParameters ()
@@ -669,7 +669,7 @@ public class PasswordDeriveBytesTest {
pd.CryptDeriveKey ("AlgName", "MD5", -256, new byte [8]);
}
#if !NET_2_1
#if !MOBILE
[Test]
[Category ("NotWorking")] // bug #79499
public void LongMultipleGetBytes ()

View File

@@ -25,7 +25,7 @@ namespace MonoTests.System.Security.Cryptography {
{
_algo = new RNGCryptoServiceProvider ();
}
#if !NET_2_1
#if !MOBILE
[Test]
public void ConstructorByteArray ()
{

View File

@@ -1 +1 @@
8a20b9add458b2d2ed9ff7c097f7a140479c7215
6e44e3235b24061c7626bc48311a4cacbf686184

View File

@@ -277,7 +277,7 @@ namespace MonoTests.System.Security.Cryptography {
CreateEncryptor_IV (size);
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (CryptographicException))]
// Rijndael is the only implementation that has
@@ -324,7 +324,7 @@ namespace MonoTests.System.Security.Cryptography {
int size = (aes.BlockSize >> 3);
CreateDecryptor_IV (size);
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (CryptographicException))]
// Rijndael is the only implementation that has

View File

@@ -307,19 +307,35 @@ public class SignatureDescriptionTest {
}
[Test]
public void RSASignatureDescription ()
public void RSASignatureDescription ()
{
// TODO: this would be cleaner with NUnit TestCase'es but they're NUnit 2.5+ :(
#if FULL_AOT_RUNTIME || MONOTOUCH || MONODROID
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
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");
#endif
}
void RSASignatureDescriptionCore (string name, string expectedDigestAlgorithm, string expectedSelectedDigestAlgorithm)
{
// internal class - we cannot create one without CryptoConfig
SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
Assert.AreEqual ("System.Security.Cryptography.SHA1CryptoServiceProvider", sd.DigestAlgorithm);
SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (name);
Assert.AreEqual (expectedDigestAlgorithm, sd.DigestAlgorithm);
Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureDeformatter", sd.DeformatterAlgorithm);
Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureFormatter", sd.FormatterAlgorithm);
Assert.AreEqual ("System.Security.Cryptography.RSACryptoServiceProvider", sd.KeyAlgorithm);
Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
HashAlgorithm hash = sd.CreateDigest();
Assert.AreEqual ("System.Security.Cryptography.SHA1CryptoServiceProvider", hash.ToString ());
Assert.AreEqual (expectedSelectedDigestAlgorithm, hash.ToString ());
Assert.AreEqual (rsa.ToString (), sd.KeyAlgorithm);
Assert.AreEqual ("System.Security.Cryptography.RSA", sd.KeyAlgorithm);
AsymmetricSignatureDeformatter asd = sd.CreateDeformatter (rsa);
Assert.AreEqual ("System.Security.Cryptography.RSAPKCS1SignatureDeformatter", asd.ToString ());
@@ -329,4 +345,4 @@ public class SignatureDescriptionTest {
}
}
}
}