Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -130,17 +130,10 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
byte[] hash = { 0xD6,0x2F,0x48,0xD0,0x13,0xEE,0x7F,0xB5,0x8B,0x79,0x07,0x45,0x12,0x67,0x0D,0x9C,0x5B,0x3A,0x5D,0xA9 };
Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
Assert.AreEqual ("D62F48D013EE7FB58B79074512670D9C5B3A5DA9", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
Assert.AreEqual ("03/12/1996 18:38:47", from.ToString (), "GetEffectiveDateString");
DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
Assert.AreEqual ("03/12/1997 18:38:46", until.ToString (), "GetExpirationDateString");
#else
// fx 1.x has a bug where the returned dates were always in the Seattle time zone
Assert.AreEqual ("03/12/1996 10:38:47", x509.GetEffectiveDateString (), "GetEffectiveDateString");
Assert.AreEqual ("03/12/1997 10:38:46", x509.GetExpirationDateString (), "GetExpirationDateString");
// which was making it easier to test the dates ;-)
#endif
Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
Assert.AreEqual (-701544240, x509.GetHashCode (), "GetHashCode");
Assert.AreEqual ("C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName (), "GetIssuerName");
@@ -156,17 +149,11 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
#if NET_2_0
Assert.AreEqual ("02720006E8", x509.GetSerialNumberString (), "GetSerialNumberString");
#else
Assert.AreEqual ("E806007202", x509.GetSerialNumberString (), "GetSerialNumberString");
#endif
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void ConstructorIntPtrZero ()
{
X509Certificate spc = new X509Certificate (IntPtr.Zero);

View File

@@ -122,16 +122,10 @@ namespace MonoCasTests.System.Security.Cryptography.X509Certificates {
byte[] hash = { 0xD6,0x2F,0x48,0xD0,0x13,0xEE,0x7F,0xB5,0x8B,0x79,0x07,0x45,0x12,0x67,0x0D,0x9C,0x5B,0x3A,0x5D,0xA9 };
Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
Assert.AreEqual ("D62F48D013EE7FB58B79074512670D9C5B3A5DA9", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
Assert.AreEqual ("03/12/1996 18:38:47", from.ToString (), "GetEffectiveDateString");
DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
Assert.AreEqual ("03/12/1997 18:38:46", until.ToString (), "GetExpirationDateString");
#else
// fx 1.x has a bug where the returned dates were always in the Seattle time zone
Assert.AreEqual ("03/12/1996 10:38:47", x509.GetEffectiveDateString (), "GetEffectiveDateString");
Assert.AreEqual ("03/12/1997 10:38:46", x509.GetExpirationDateString (), "GetExpirationDateString");
#endif
Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
Assert.AreEqual (-701544240, x509.GetHashCode (), "GetHashCode");
Assert.AreEqual ("C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName (), "GetIssuerName");
@@ -147,11 +141,7 @@ namespace MonoCasTests.System.Security.Cryptography.X509Certificates {
Assert.IsNotNull (x509.GetRawCertDataString (), "GetRawCertDataString");
byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
#if NET_2_0
Assert.AreEqual ("02720006E8", x509.GetSerialNumberString (), "GetSerialNumberString");
#else
Assert.AreEqual ("E806007202", x509.GetSerialNumberString (), "GetSerialNumberString");
#endif
Assert.IsNotNull (x509.ToString (true), "ToString");
}
@@ -195,11 +185,7 @@ namespace MonoCasTests.System.Security.Cryptography.X509Certificates {
[Test]
[SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[ExpectedException (typeof (SecurityException))]
#endif
public void ConstructorIntPtr_DenyUnmanagedCode ()
{
// will fail before calling the constructor
@@ -208,9 +194,7 @@ namespace MonoCasTests.System.Security.Cryptography.X509Certificates {
[Test]
[SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void ConstructorIntPtr_PermitOnlyUnmanagedCode ()
{
// will fail _when_ calling the constructor

View File

@@ -1 +1 @@
90402780c7ce6e467d3facc91ebf5519fccd4239
24cf2b4ccc401c577389a81e641b12a151e9de90