GetHashCode() public method

public GetHashCode ( ) : int
return int
Ejemplo n.º 1
0
		public Publisher (X509Certificate cert) 
		{
			if (cert == null)
				throw new ArgumentNullException ("cert");
			if (cert.GetHashCode () == 0)
				throw new ArgumentException ("cert");
			m_cert = cert;
		}
Ejemplo n.º 2
0
		public void EmptyCertificateConstructor () 
		{
			byte[] n = null;
			X509Certificate x509 = new X509Certificate (n);
			Publisher p = new Publisher (x509);

			Assert.AreEqual (x509.GetHashCode (), p.GetHashCode (), "GetHashCode");
			Assert.AreEqual ("<System.Security.Policy.Publisher version=\"1\">" + Environment.NewLine + "   <X509v3Certificate/>" + Environment.NewLine + "</System.Security.Policy.Publisher>" + Environment.NewLine, p.ToString (), "ToString");
		}
		public PublisherMembershipCondition (X509Certificate certificate) 
		{
			if (certificate == null)
				throw new ArgumentNullException ("certificate");
			// needed to match MS implementation
			if (certificate.GetHashCode () == 0) {
				throw new ArgumentException ("certificate");
			}
			x509 = certificate;
		}
Ejemplo n.º 4
0
		public PublisherMembershipCondition (X509Certificate certificate) 
		{
			if (certificate == null)
				throw new ArgumentNullException ("certificate");
			// needed to match MS implementation
			if (certificate.GetHashCode () == 0) {
#if NET_2_0
				throw new ArgumentException ("certificate");
#else
				throw new NullReferenceException ("certificate");
#endif
			}
			x509 = certificate;
		}
Ejemplo n.º 5
0
		public void Constructor () 
		{
			X509Certificate x509 = new X509Certificate (msSpCert);
			Publisher p = new Publisher (x509);

			Assert.AreEqual (x509.GetHashCode (), p.GetHashCode (), "GetHashCode");

			IPermission ip = p.CreateIdentityPermission (null);
			Assert.IsTrue ((ip is PublisherIdentityPermission), "CreateIdentityPermission");

			string s = "<System.Security.Policy.Publisher version=\"1\">" + Environment.NewLine;
			s += "<X509v3Certificate>3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F";
			s += "7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8";
			s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87</X509v3Certificate>" + Environment.NewLine + "</System.Security.Policy.Publisher>" + Environment.NewLine;
			Assert.AreEqual (s, p.ToString (), "ToString");
		}
public void Certificate4 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x02,0x29,0x30,0x82,0x01,0x96,0x02,0x05,0x02,0x41,0x00,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
		0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x34,0x31,0x31,0x30,0x39,0x32,0x33,0x35,0x34,0x31,0x37,0x5A,0x17,0x0D,0x39,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x34,0x31,0x37,0x5A,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,
		0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x81,0x9B,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x89,0x00,0x30,0x81,0x85,0x02,0x7E,0x00,0x92,0xCE,0x7A,0xC1,0xAE,0x83,0x3E,0x5A,0xAA,0x89,0x83,0x57,0xAC,0x25,0x01,0x76,0x0C,
		0xAD,0xAE,0x8E,0x2C,0x37,0xCE,0xEB,0x35,0x78,0x64,0x54,0x03,0xE5,0x84,0x40,0x51,0xC9,0xBF,0x8F,0x08,0xE2,0x8A,0x82,0x08,0xD2,0x16,0x86,0x37,0x55,0xE9,0xB1,0x21,0x02,0xAD,0x76,0x68,0x81,0x9A,0x05,0xA2,0x4B,0xC9,0x4B,0x25,0x66,0x22,0x56,0x6C,0x88,0x07,0x8F,0xF7,0x81,0x59,0x6D,0x84,0x07,0x65,0x70,0x13,0x71,0x76,0x3E,0x9B,0x77,0x4C,0xE3,0x50,0x89,0x56,0x98,0x48,0xB9,0x1D,0xA7,0x29,0x1A,0x13,0x2E,0x4A,0x11,0x59,0x9C,0x1E,0x15,0xD5,0x49,0x54,0x2C,0x73,0x3A,0x69,0x82,0xB1,0x97,0x39,0x9C,0x6D,0x70,0x67,
		0x48,0xE5,0xDD,0x2D,0xD6,0xC8,0x1E,0x7B,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x88,0xD1,0xD1,0x79,0x21,0xCE,0xE2,0x8B,0xE8,0xF8,0xC1,0x7D,0x34,0x53,0x3F,0x61,0x83,0xD9,0xB6,0x0B,0x38,0x17,0xB6,0xE8,0xBE,0x21,0x8D,0x8F,0x00,0xB8,0x8B,0x53,0x7E,0x44,0x67,0x1E,0x22,0xBD,0x97,0x27,0xE0,0x9C,0x85,0xCC,0x4A,0xF6,0x85,0x3B,0xB2,0xE2,0xBE,0x92,0xD3,0xE5,0x0D,0xE9,0xAF,0x5C,0x0E,0x0C,0x46,0x95,0xFF,0xA1,0x1C,0x5E,0x3E,0xE8,0x36,
		0x58,0x7A,0x73,0xA6,0x0A,0xF8,0x22,0x11,0x6B,0xC3,0x09,0x38,0x7E,0x26,0xBB,0x73,0xEF,0x00,0xBD,0x02,0xA4,0xF3,0x14,0x0D,0x30,0x3F,0x61,0x70,0x7B,0x20,0xFE,0x32,0xA3,0x9F,0xB3,0xF4,0x67,0x52,0xDC,0xB4,0xEE,0x84,0x8C,0x96,0x36,0x20,0xDE,0x81,0x08,0x83,0x71,0x21,0x8A,0x0F,0x9E,0xA9 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x0D,0x97,0x44,0x61,0x70,0x37,0x13,0xCB,0x74,0x93,0x2D,0x2A,0x75,0xAC,0xBC,0x71,0x4B,0x28,0x12,0x66 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "0D974461703713CB74932D2A75ACBC714B281266", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "11/09/1994 15:54:17", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "12/31/1999 15:54:17", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 228017249, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetName ());
	byte[] pubkey = { 0x30,0x81,0x85,0x02,0x7E,0x00,0x92,0xCE,0x7A,0xC1,0xAE,0x83,0x3E,0x5A,0xAA,0x89,0x83,0x57,0xAC,0x25,0x01,0x76,0x0C,0xAD,0xAE,0x8E,0x2C,0x37,0xCE,0xEB,0x35,0x78,0x64,0x54,0x03,0xE5,0x84,0x40,0x51,0xC9,0xBF,0x8F,0x08,0xE2,0x8A,0x82,0x08,0xD2,0x16,0x86,0x37,0x55,0xE9,0xB1,0x21,0x02,0xAD,0x76,0x68,0x81,0x9A,0x05,0xA2,0x4B,0xC9,0x4B,0x25,0x66,0x22,0x56,0x6C,0x88,0x07,0x8F,0xF7,0x81,0x59,0x6D,0x84,0x07,0x65,0x70,0x13,0x71,0x76,0x3E,0x9B,0x77,0x4C,0xE3,0x50,0x89,0x56,0x98,0x48,0xB9,0x1D,0xA7,0x29,0x1A,0x13,
		0x2E,0x4A,0x11,0x59,0x9C,0x1E,0x15,0xD5,0x49,0x54,0x2C,0x73,0x3A,0x69,0x82,0xB1,0x97,0x39,0x9C,0x6D,0x70,0x67,0x48,0xE5,0xDD,0x2D,0xD6,0xC8,0x1E,0x7B,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "308185027E0092CE7AC1AE833E5AAA898357AC2501760CADAE8E2C37CEEB3578645403E5844051C9BF8F08E28A8208D216863755E9B12102AD7668819A05A24BC94B256622566C88078FF781596D840765701371763E9B774CE35089569848B91DA7291A132E4A11599C1E15D549542C733A6982B197399C6D706748E5DD2DD6C81E7B0203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x01,0x00,0x00,0x41,0x02 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "0100004102", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,
		0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,
		0x69,0x74,0x79,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x31,0x30,0x30,0x30,0x30,0x34,0x31,0x30,0x32,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,
		0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x35,0x30,0x32,0x37,0x45,0x30,0x30,0x39,0x32,0x43,0x45,0x37,0x41,0x43,0x31,0x41,0x45,0x38,0x33,0x33,0x45,0x35,0x41,0x41,0x41,0x38,0x39,0x38,0x33,0x35,0x37,0x41,0x43,0x32,0x35,0x30,0x31,0x37,0x36,0x30,0x43,0x41,0x44,0x41,0x45,0x38,0x45,0x32,0x43,0x33,0x37,0x43,0x45,0x45,0x42,0x33,0x35,0x37,0x38,0x36,0x34,0x35,0x34,0x30,0x33,0x45,0x35,0x38,0x34,0x34,0x30,0x35,0x31,0x43,
		0x39,0x42,0x46,0x38,0x46,0x30,0x38,0x45,0x32,0x38,0x41,0x38,0x32,0x30,0x38,0x44,0x32,0x31,0x36,0x38,0x36,0x33,0x37,0x35,0x35,0x45,0x39,0x42,0x31,0x32,0x31,0x30,0x32,0x41,0x44,0x37,0x36,0x36,0x38,0x38,0x31,0x39,0x41,0x30,0x35,0x41,0x32,0x34,0x42,0x43,0x39,0x34,0x42,0x32,0x35,0x36,0x36,0x32,0x32,0x35,0x36,0x36,0x43,0x38,0x38,0x30,0x37,0x38,0x46,0x46,0x37,0x38,0x31,0x35,0x39,0x36,0x44,0x38,0x34,0x30,0x37,0x36,0x35,0x37,0x30,0x31,0x33,0x37,0x31,0x37,0x36,0x33,0x45,0x39,0x42,0x37,0x37,0x34,0x43,0x45,
		0x33,0x35,0x30,0x38,0x39,0x35,0x36,0x39,0x38,0x34,0x38,0x42,0x39,0x31,0x44,0x41,0x37,0x32,0x39,0x31,0x41,0x31,0x33,0x32,0x45,0x34,0x41,0x31,0x31,0x35,0x39,0x39,0x43,0x31,0x45,0x31,0x35,0x44,0x35,0x34,0x39,0x35,0x34,0x32,0x43,0x37,0x33,0x33,0x41,0x36,0x39,0x38,0x32,0x42,0x31,0x39,0x37,0x33,0x39,0x39,0x43,0x36,0x44,0x37,0x30,0x36,0x37,0x34,0x38,0x45,0x35,0x44,0x44,0x32,0x44,0x44,0x36,0x43,0x38,0x31,0x45,0x37,0x42,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
public void Certificate3 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x03,0x4E,0x30,0x82,0x02,0xB7,0xA0,0x03,0x02,0x01,0x02,0x02,0x20,0x03,0x53,0xD7,0x8B,0xDB,0x3E,0x16,0x15,0x80,0x55,0xC4,0x05,0x40,0x02,0x73,0x4D,0x0C,0x20,0xF8,0x0D,0x88,0x00,0x5F,0x65,0x7A,0xAC,0xBA,0x86,0xBD,0x1C,0xD7,0xE4,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x49,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,
		0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x36,0x30,0x38,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x6E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x42,0x72,0x61,0x6E,0x64,0x49,
		0x44,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x03,0x13,0x1C,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,
		0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x01,0x44,0x30,0x82,0x01,0x40,0x30,0x5C,0x06,0x03,0x55,0x1D,0x23,0x04,0x55,0x30,0x53,0x81,0x4B,0x84,0x49,0x31,0x0B,0x30,
		0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x82,0x04,0x32,0x06,0xAC,0x10,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x2E,0x06,0x03,0x55,0x1D,0x10,0x01,
		0x01,0xFF,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x36,0x30,0x39,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x30,0x18,0x06,0x03,0x55,0x1D,0x20,0x04,0x11,0x30,0x0F,0x30,0x0D,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x02,0x30,0x00,0x30,0x14,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x03,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,
		0x07,0x80,0x30,0x62,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x07,0x01,0x01,0xFF,0x04,0x52,0x30,0x50,0x04,0x14,0x33,0x39,0x38,0x32,0x33,0x39,0x38,0x37,0x32,0x33,0x37,0x38,0x39,0x31,0x33,0x34,0x39,0x37,0x38,0x32,0x30,0x09,0x06,0x05,0x2B,0x0D,0x03,0x02,0x1A,0x05,0x00,0x16,0x0F,0x74,0x65,0x72,0x73,0x65,0x20,0x73,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x1D,0x00,0x16,0x1A,0x67,0x65,0x74,0x73,0x65,0x74,0x2D,0x63,0x65,0x6E,0x74,0x65,0x72,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,
		0x6F,0x6D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0x1D,0x6C,0x90,0xF2,0x02,0x10,0xD5,0xA0,0x7B,0xEB,0x07,0x14,0x1D,0xAE,0x2C,0xD5,0xB1,0x4C,0x23,0x30,0xB2,0x31,0x7F,0x96,0x3C,0xD1,0x41,0x11,0xEA,0x08,0x0D,0x80,0x5F,0x46,0x66,0x9D,0x0A,0xF2,0x91,0xE8,0x7C,0xCE,0xC0,0xAD,0xE6,0x96,0x19,0x9C,0x26,0xC3,0x4E,0xEB,0x6F,0xF4,0x4A,0x69,0x4C,0xFE,0x4C,0x76,0xB3,0x51,0xCA,0x44,0x03,0xFC,0xD4,0xF4,0xF9,0x32,0x2A,0xAE,0x03,0x1B,0x5F,0xA6,0xBF,0x16,0x61,
		0xA0,0x07,0x86,0x85,0xA7,0xD6,0x0D,0xEF,0x88,0x9B,0x2A,0xBA,0xB8,0xD4,0x5C,0x94,0x7C,0x63,0xE1,0xE0,0x69,0xEB,0x3D,0x2F,0xC1,0x71,0x56,0x47,0x55,0x4B,0xB8,0xFD,0xCD,0xD6,0xC7,0x6F,0xA7,0x47,0xE9,0x43,0x91,0x2E,0xCF,0x93,0xA4,0x05,0x18,0xC5,0x98 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x39,0x5F,0xBB,0xFC,0x14,0x89,0x33,0x27,0x76,0x89,0xB7,0x59,0x3A,0x7D,0x1C,0xFF,0xF1,0x56,0xF1,0x62 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "395FBBFC148933277689B7593A7D1CFFF156F162", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "08/06/1996 16:00:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "08/31/1996 15:59:59", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 962575356, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=CCA - Unique ID, CN=Brand Name:Product Type", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=BrandID, OU=Issuing Financial Institution, CN=\"0+WKJx+wYEZabSSPVX9kLsnx92s=\"", x509.GetName ());
	byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "3048024100ACC40E0525BCEAEF0C227FC40C4A693100F93FE9E16C5497774E18C64A95E0D458295C175D1D1E56BC493DE0F99FBB01F986B6A695DDE1043201524E8F8630F70203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0xE4,0xD7,0x1C,0xBD,0x86,0xBA,0xAC,0x7A,0x65,0x5F,0x00,0x88,0x0D,0xF8,0x20,0x0C,0x4D,0x73,0x02,0x40,0x05,0xC4,0x55,0x80,0x15,0x16,0x3E,0xDB,0x8B,0xD7,0x53,0x03 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "E4D71CBD86BAAC7A655F00880DF8200C4D73024005C4558015163EDB8BD75303", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x42,0x72,0x61,0x6E,0x64,0x49,0x44,0x2C,0x20,0x4F,0x55,0x3D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x22,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,
		0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x22,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,
		0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x34,0x44,0x37,0x31,0x43,0x42,0x44,0x38,0x36,0x42,0x41,0x41,0x43,0x37,0x41,0x36,0x35,0x35,0x46,0x30,0x30,0x38,0x38,0x30,0x44,0x46,0x38,0x32,0x30,0x30,0x43,0x34,0x44,0x37,0x33,0x30,0x32,0x34,0x30,0x30,0x35,0x43,0x34,0x35,0x35,0x38,0x30,0x31,0x35,0x31,0x36,0x33,0x45,
		0x44,0x42,0x38,0x42,0x44,0x37,0x35,0x33,0x30,0x33,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x41,0x43,0x43,0x34,0x30,0x45,0x30,0x35,0x32,0x35,0x42,0x43,0x45,0x41,0x45,0x46,0x30,0x43,0x32,0x32,0x37,0x46,0x43,0x34,0x30,0x43,0x34,0x41,0x36,0x39,
		0x33,0x31,0x30,0x30,0x46,0x39,0x33,0x46,0x45,0x39,0x45,0x31,0x36,0x43,0x35,0x34,0x39,0x37,0x37,0x37,0x34,0x45,0x31,0x38,0x43,0x36,0x34,0x41,0x39,0x35,0x45,0x30,0x44,0x34,0x35,0x38,0x32,0x39,0x35,0x43,0x31,0x37,0x35,0x44,0x31,0x44,0x31,0x45,0x35,0x36,0x42,0x43,0x34,0x39,0x33,0x44,0x45,0x30,0x46,0x39,0x39,0x46,0x42,0x42,0x30,0x31,0x46,0x39,0x38,0x36,0x42,0x36,0x41,0x36,0x39,0x35,0x44,0x44,0x45,0x31,0x30,0x34,0x33,0x32,0x30,0x31,0x35,0x32,0x34,0x45,0x38,0x46,0x38,0x36,0x33,0x30,0x46,0x37,0x30,0x32,
		0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
		private void CheckBase64 (X509Certificate x)
		{
			// note: the raw data is still the DER encoded ASN.1 (not the base64 string)
			byte[] cert = { 0x30, 0x82, 0x01, 0xC5, 0x30, 0x82, 0x01, 0x32, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0xC7, 0x75, 0xAE, 0x48, 0x53, 0x9B, 0x1E, 0x9E, 0x44, 0x80, 0x15, 0xCA, 0x78, 0x15, 0x47, 0x69, 0x30, 0x09, 
				0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x25, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x1E, 0x1A, 0x00, 0x43, 0x00, 0x41, 0x00, 0x53, 0x00, 0x54, 0x00, 0x4F, 0x00, 0x52, 
				0x00, 0x5C, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x75, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x35, 0x30, 0x36, 0x30, 0x38, 0x31, 0x33, 0x33, 0x38, 0x34, 0x37, 0x5A, 0x17, 0x0D, 0x30, 
				0x36, 0x30, 0x36, 0x30, 0x38, 0x31, 0x39, 0x33, 0x38, 0x34, 0x37, 0x5A, 0x30, 0x25, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x1E, 0x1A, 0x00, 0x43, 0x00, 0x41, 0x00, 0x53, 0x00, 0x54, 0x00, 
				0x4F, 0x00, 0x52, 0x00, 0x5C, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x70, 0x00, 0x6F, 0x00, 0x75, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 
				0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xDA, 0xEA, 0x39, 0x38, 0xF6, 0x3A, 0xF4, 0x8B, 0xF9, 0xE2, 0xC7, 0xD5, 0x2C, 0xF9, 0x1A, 0xD5, 0x75, 0xCF, 0x17, 0xAC, 0xB3, 0x46, 
				0xBD, 0x7F, 0x3F, 0x97, 0x38, 0x2E, 0x10, 0x41, 0xB2, 0xC4, 0xD9, 0x14, 0x15, 0xD8, 0xE6, 0xF9, 0x11, 0x38, 0x80, 0x75, 0xE3, 0xD7, 0x1F, 0xC0, 0x86, 0xA7, 0x3E, 0x02, 0x11, 0x04, 0xE9, 0x57, 0xB5, 0xD8, 
				0x57, 0x65, 0x27, 0x7B, 0x8F, 0xBA, 0xB9, 0xEF, 0xA0, 0x8F, 0x15, 0x9C, 0xEC, 0x2F, 0x85, 0x63, 0x4E, 0x52, 0x6B, 0xA6, 0xE3, 0x33, 0xCA, 0x86, 0x22, 0xBA, 0xF9, 0x06, 0xE8, 0xEC, 0xCB, 0xA7, 0xA5, 0xA8, 
				0xE2, 0x3E, 0xC7, 0x21, 0x74, 0x4E, 0xC9, 0xE9, 0x05, 0x5F, 0xAE, 0x78, 0x12, 0x51, 0x2F, 0xFA, 0x6A, 0x8F, 0x7C, 0xB0, 0x64, 0x2A, 0xFB, 0xB7, 0xB2, 0x40, 0x91, 0x20, 0xE7, 0x32, 0x53, 0x3F, 0x58, 0xCA, 
				0x80, 0xA2, 0x41, 0xC5, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x9D, 0x57, 0xB0, 0x25, 0x97, 0x81, 0x22, 0x3C, 0xC4, 0x61, 
				0x9D, 0xC9, 0xDB, 0xD8, 0xC7, 0xC1, 0xED, 0xFB, 0x1C, 0xDD, 0x35, 0x98, 0xD7, 0x40, 0x58, 0xA4, 0x43, 0x86, 0x54, 0xF9, 0x68, 0x96, 0x85, 0xB5, 0x91, 0xBC, 0xB7, 0x82, 0xB2, 0x7E, 0x7B, 0x58, 0xBD, 0x80, 
				0xCE, 0x34, 0x7E, 0x22, 0x87, 0x62, 0x31, 0xB5, 0x03, 0x16, 0xA0, 0x20, 0x17, 0x9D, 0xE7, 0x5D, 0xAA, 0x12, 0xF5, 0x92, 0xDF, 0x94, 0xE6, 0x69, 0xCD, 0xF6, 0xFC, 0x82, 0x9B, 0xDC, 0xD3, 0x30, 0x40, 0xB1, 
				0x71, 0x4F, 0x4A, 0x64, 0xCB, 0xDC, 0x14, 0xC8, 0xC1, 0x7F, 0x6F, 0x23, 0xCE, 0xDD, 0x19, 0x22, 0x4F, 0x24, 0x1E, 0x27, 0x18, 0x66, 0x88, 0x7A, 0x9A, 0x9A, 0x09, 0x37, 0x6D, 0x65, 0x15, 0xE8, 0x28, 0x5E, 
				0x82, 0xEB, 0x5B, 0x82, 0xE8, 0x8A, 0xAC, 0x8F, 0xC3, 0x6C, 0xEE, 0xF0, 0x3E, 0x20, 0xCB, 0xC7 };
			Assert.AreEqual ("CN=CASTOR\\poupou", x.Issuer, "Issuer");
			Assert.AreEqual ("CN=CASTOR\\poupou", x.GetIssuerName (), "GetIssuerName");
			Assert.AreEqual ("CN=CASTOR\\poupou", x.Subject, "Subject");
			Assert.AreEqual ("CN=CASTOR\\poupou", x.GetName (), "GetName");
			byte[] hash = { 0x1D, 0x53, 0xCC, 0x89, 0xD0, 0x9F, 0x11, 0x4A, 0x48, 0x7F, 0x7F, 0x52, 0x9E, 0xCB, 0xD1, 0x86, 0xA3, 0xD5, 0x85, 0x29 };
			Assert.AreEqual (hash, x.GetCertHash (), "GetCertHash");
			Assert.AreEqual ("1D53CC89D09F114A487F7F529ECBD186A3D58529", x.GetCertHashString (), "GetCertHashString");
			long from = DateTime.Parse (x.GetEffectiveDateString ()).ToUniversalTime ().Ticks;
			Assert.AreEqual (632538347270000000, from, "GetEffectiveDateString");
			long until = DateTime.Parse (x.GetExpirationDateString ()).ToUniversalTime ().Ticks;
			Assert.AreEqual (632853923270000000, until, "GetExpirationDateString");
			Assert.AreEqual ("X509", x.GetFormat (), "GetFormat");
			Assert.AreEqual (492031113, x.GetHashCode (), "GetHashCode");
			Assert.AreEqual ("1.2.840.113549.1.1.1", x.GetKeyAlgorithm (), "GetKeyAlgorithm");
			byte[] keyparams = { 0x05, 0x00 };
			Assert.AreEqual (keyparams, x.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
			Assert.AreEqual ("0500", x.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
			byte[] pubkey = { 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xDA, 0xEA, 0x39, 0x38, 0xF6, 0x3A, 0xF4, 0x8B, 0xF9, 0xE2, 0xC7, 0xD5, 0x2C, 0xF9, 0x1A, 0xD5, 0x75, 0xCF, 0x17, 0xAC, 0xB3, 0x46, 0xBD, 0x7F, 0x3F, 0x97, 0x38, 0x2E, 0x10, 0x41, 0xB2, 0xC4, 0xD9, 0x14, 0x15, 0xD8, 0xE6, 0xF9, 0x11, 0x38, 0x80, 0x75, 0xE3, 0xD7, 0x1F, 0xC0, 0x86, 
				0xA7, 0x3E, 0x02, 0x11, 0x04, 0xE9, 0x57, 0xB5, 0xD8, 0x57, 0x65, 0x27, 0x7B, 0x8F, 0xBA, 0xB9, 0xEF, 0xA0, 0x8F, 0x15, 0x9C, 0xEC, 0x2F, 0x85, 0x63, 0x4E, 0x52, 0x6B, 0xA6, 0xE3, 0x33, 0xCA, 0x86, 0x22, 0xBA, 0xF9, 0x06, 0xE8, 0xEC, 0xCB, 0xA7, 0xA5, 0xA8, 0xE2, 0x3E, 0xC7, 0x21, 0x74, 0x4E, 0xC9, 0xE9, 0x05, 0x5F, 0xAE, 0x78, 0x12, 
				0x51, 0x2F, 0xFA, 0x6A, 0x8F, 0x7C, 0xB0, 0x64, 0x2A, 0xFB, 0xB7, 0xB2, 0x40, 0x91, 0x20, 0xE7, 0x32, 0x53, 0x3F, 0x58, 0xCA, 0x80, 0xA2, 0x41, 0xC5, 0x02, 0x03, 0x01, 0x00, 0x01 };
			Assert.AreEqual (pubkey, x.GetPublicKey (), "GetPublicKey");
			Assert.AreEqual ("30818902818100DAEA3938F63AF48BF9E2C7D52CF91AD575CF17ACB346BD7F3F97382E1041B2C4D91415D8E6F911388075E3D71FC086A73E021104E957B5D85765277B8FBAB9EFA08F159CEC2F85634E526BA6E333CA8622BAF906E8ECCBA7A5A8E23EC721744EC9E9055FAE7812512FFA6A8F7CB0642AFBB7B2409120E732533F58CA80A241C50203010001", x.GetPublicKeyString (), "GetPublicKeyString");
			Assert.AreEqual (cert, x.GetRawCertData (), "GetRawCertData");
			byte[] serial = { 0x69, 0x47, 0x15, 0x78, 0xCA, 0x15, 0x80, 0x44, 0x9E, 0x1E, 0x9B, 0x53, 0x48, 0xAE, 0x75, 0xC7 };
			Assert.AreEqual (serial, x.GetSerialNumber (), "GetSerialNumber");
			Assert.AreEqual ("C775AE48539B1E9E448015CA78154769", x.GetSerialNumberString (), "GetSerialNumberString");
		}
public void Certificate13 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x02,0x14,0x30,0x82,0x01,0xD3,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x3A,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x0F,0x30,0x0D,0x06,0x03,0x55,0x04,0x03,0x13,0x06,0x44,0x53,0x41,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,
		0x32,0x30,0x5A,0x17,0x0D,0x31,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x4F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x53,0x41,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x20,0x49,0x6E,0x68,0x65,0x72,0x69,0x74,0x65,0x64,0x20,0x43,0x41,0x30,
		0x81,0x92,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x67,0x8C,0x47,0xDA,0x0C,0x36,0x81,0x64,0x39,0xF8,0x1A,0x37,0x0B,0xF0,0xBB,0xD4,0x13,0xFD,0x67,0x3D,0x40,0xC8,0x9C,0x92,0xE1,0x3A,0x89,0x54,0xB0,0xF2,0x97,0xA5,0x70,0xD0,0x64,0x17,0xA4,0xA7,0x7C,0xA9,0xE9,0x27,0x09,0x65,0xDF,0xA0,0xA5,0x1C,0xFC,0x04,0xDA,0x3E,0xDD,0x62,0x6B,0xF0,0x0C,0xED,0x81,0x57,0x4F,0x5D,0x29,0xC8,0x08,0x59,0x19,0x0C,0x5F,0x8D,0x88,0xF0,0xFF,0x8C,0xB6,0xE8,0x75,0x01,0xBE,0x10,
		0x0A,0x64,0xDF,0x57,0x7B,0x8B,0x6C,0x56,0xF0,0x53,0xCE,0x43,0x88,0xB9,0x09,0x99,0x08,0x3C,0x90,0xAF,0x01,0xE8,0xD9,0x32,0x5D,0xED,0x56,0x02,0xCF,0x60,0xD2,0x01,0x3A,0xE3,0x0A,0x2B,0x9E,0x91,0x41,0xF6,0xC7,0x7C,0xDE,0x6C,0x99,0x63,0x00,0x0E,0xA3,0x7C,0x30,0x7A,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x5D,0x24,0xEE,0x8A,0x55,0x1A,0xF2,0xC6,0xC9,0xB2,0xC2,0xBF,0x8A,0xF0,0xB2,0x49,0x4F,0x3A,0xB3,0x1B,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x74,0x15,0xD5,0x24,
		0x1C,0xBD,0x5E,0x65,0x88,0x1F,0xE1,0x8B,0x09,0x7E,0x7F,0xEA,0x19,0x48,0x4E,0x61,0x30,0x17,0x06,0x03,0x55,0x1D,0x20,0x04,0x10,0x30,0x0E,0x30,0x0C,0x06,0x0A,0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x01,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x30,0x00,0x30,0x2D,0x02,0x15,0x00,0xA8,0x59,0x6F,0x31,0x77,0xB6,0x20,
		0xEC,0x36,0x9B,0xEB,0x4B,0x61,0x0A,0xAF,0x44,0xED,0x72,0xBA,0x29,0x02,0x14,0x6D,0x22,0xE1,0xBD,0x4D,0x27,0xF6,0x2E,0x3B,0x1F,0xD7,0x9D,0xD6,0x59,0x5E,0xCB,0x25,0x86,0x22,0xD8 };

	X509Certificate x509 = new X509Certificate (cert);
//	X509Certificate clone = new X509Certificate (x509);

//	Assertion.Assert ("Equals", x509.Equals (clone));
//	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
//	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x0E,0x29,0xCD,0xDC,0xA5,0xE7,0x32,0xA2,0x0D,0xCE,0xD8,0x7B,0x3D,0x00,0x24,0x46,0x85,0x3E,0xBB,0xD1 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "0E29CDDCA5E732A20DCED87B3D002446853EBBD1", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", DateTime.Parse ("04/19/2001 06:57:20"), DateTime.Parse (x509.GetEffectiveDateString ()));
	Assertion.AssertEquals ("GetExpirationDateString", DateTime.Parse ("04/19/2011 06:57:20"), DateTime.Parse (x509.GetExpirationDateString ()));
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 237620700, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=Test Certificates, CN=DSA CA", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.10040.4.1", x509.GetKeyAlgorithm ());
	Assertion.AssertNull ("GetKeyAlgorithmParameters", x509.GetKeyAlgorithmParameters ());
	Assertion.AssertNull ("GetKeyAlgorithmParametersString", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=Test Certificates, CN=DSA Parameters Inherited CA", x509.GetName ());
	byte[] pubkey = { 0x02,0x81,0x80,0x67,0x8C,0x47,0xDA,0x0C,0x36,0x81,0x64,0x39,0xF8,0x1A,0x37,0x0B,0xF0,0xBB,0xD4,0x13,0xFD,0x67,0x3D,0x40,0xC8,0x9C,0x92,0xE1,0x3A,0x89,0x54,0xB0,0xF2,0x97,0xA5,0x70,0xD0,0x64,0x17,0xA4,0xA7,0x7C,0xA9,0xE9,0x27,0x09,0x65,0xDF,0xA0,0xA5,0x1C,0xFC,0x04,0xDA,0x3E,0xDD,0x62,0x6B,0xF0,0x0C,0xED,0x81,0x57,0x4F,0x5D,0x29,0xC8,0x08,0x59,0x19,0x0C,0x5F,0x8D,0x88,0xF0,0xFF,0x8C,0xB6,0xE8,0x75,0x01,0xBE,0x10,0x0A,0x64,0xDF,0x57,0x7B,0x8B,0x6C,0x56,0xF0,0x53,0xCE,0x43,0x88,0xB9,0x09,0x99,0x08,0x3C,
		0x90,0xAF,0x01,0xE8,0xD9,0x32,0x5D,0xED,0x56,0x02,0xCF,0x60,0xD2,0x01,0x3A,0xE3,0x0A,0x2B,0x9E,0x91,0x41,0xF6,0xC7,0x7C,0xDE,0x6C,0x99,0x63,0x00,0x0E };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "028180678C47DA0C36816439F81A370BF0BBD413FD673D40C89C92E13A8954B0F297A570D06417A4A77CA9E9270965DFA0A51CFC04DA3EDD626BF00CED81574F5D29C80859190C5F8D88F0FF8CB6E87501BE100A64DF577B8B6C56F053CE4388B90999083C90AF01E8D9325DED5602CF60D2013AE30A2B9E9141F6C77CDE6C9963000E", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x02 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "02", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x53,0x41,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x20,0x49,0x6E,0x68,0x65,0x72,0x69,0x74,0x65,0x64,0x20,0x43,0x41,0x0D,0x0A,0x09,0x49,0x73,0x73,
		0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x53,0x41,0x20,0x43,0x41,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x30,0x30,0x34,0x30,0x2E,0x34,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,
		0x20,0x30,0x32,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x30,0x32,0x38,0x31,0x38,0x30,0x36,0x37,0x38,0x43,0x34,0x37,0x44,0x41,0x30,0x43,0x33,0x36,0x38,0x31,0x36,0x34,0x33,0x39,0x46,0x38,0x31,0x41,0x33,0x37,0x30,0x42,0x46,0x30,0x42,0x42,0x44,0x34,0x31,0x33,0x46,0x44,0x36,0x37,0x33,0x44,0x34,0x30,0x43,0x38,0x39,0x43,0x39,0x32,0x45,0x31,0x33,0x41,0x38,0x39,0x35,0x34,0x42,0x30,0x46,0x32,0x39,0x37,0x41,0x35,0x37,0x30,0x44,0x30,0x36,0x34,0x31,0x37,0x41,0x34,0x41,
		0x37,0x37,0x43,0x41,0x39,0x45,0x39,0x32,0x37,0x30,0x39,0x36,0x35,0x44,0x46,0x41,0x30,0x41,0x35,0x31,0x43,0x46,0x43,0x30,0x34,0x44,0x41,0x33,0x45,0x44,0x44,0x36,0x32,0x36,0x42,0x46,0x30,0x30,0x43,0x45,0x44,0x38,0x31,0x35,0x37,0x34,0x46,0x35,0x44,0x32,0x39,0x43,0x38,0x30,0x38,0x35,0x39,0x31,0x39,0x30,0x43,0x35,0x46,0x38,0x44,0x38,0x38,0x46,0x30,0x46,0x46,0x38,0x43,0x42,0x36,0x45,0x38,0x37,0x35,0x30,0x31,0x42,0x45,0x31,0x30,0x30,0x41,0x36,0x34,0x44,0x46,0x35,0x37,0x37,0x42,0x38,0x42,0x36,0x43,0x35,
		0x36,0x46,0x30,0x35,0x33,0x43,0x45,0x34,0x33,0x38,0x38,0x42,0x39,0x30,0x39,0x39,0x39,0x30,0x38,0x33,0x43,0x39,0x30,0x41,0x46,0x30,0x31,0x45,0x38,0x44,0x39,0x33,0x32,0x35,0x44,0x45,0x44,0x35,0x36,0x30,0x32,0x43,0x46,0x36,0x30,0x44,0x32,0x30,0x31,0x33,0x41,0x45,0x33,0x30,0x41,0x32,0x42,0x39,0x45,0x39,0x31,0x34,0x31,0x46,0x36,0x43,0x37,0x37,0x43,0x44,0x45,0x36,0x43,0x39,0x39,0x36,0x33,0x30,0x30,0x30,0x45,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
public void Certificate11 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xF5,0x30,0x82,0x01,0x5E,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1A,0x17,0x0B,
		0x39,0x36,0x30,0x32,0x32,0x33,0x31,0x39,0x31,0x35,0x5A,0x17,0x0B,0x39,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x5A,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x81,0x9F,0x30,0x0D,
		0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,
		0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x34,0x9B,0x09,0x05,0x9D,0x42,0x48,0x7F,0x7C,0x24,0x8E,0xC2,0x88,0x65,0x78,0x6B,0x4D,0x2A,0x0E,0xAF,0xED,0xED,0xF0,0x6A,
		0x2D,0x37,0xEB,0x57,0x51,0x0E,0x8A,0xAD,0x2D,0x13,0x02,0xA1,0x40,0x6A,0x41,0xF6,0x69,0x72,0xBF,0x0F,0xA0,0x4E,0x55,0xE7,0x82,0xA6,0x57,0x91,0x8B,0x5D,0x43,0x08,0xC9,0xF8,0x71,0x07,0x82,0xE3,0x3E,0x14,0x01,0x24,0x0C,0x39,0xEB,0x61,0x22,0xF7,0xA2,0x0B,0x42,0x23,0x14,0xCA,0x10,0x18,0x36,0x0A,0x05,0xD1,0xC8,0x4A,0xF1,0x0E,0xB3,0xFD,0x00,0xD0,0xC6,0xEE,0x55,0xF2,0x4C,0x62,0xB4,0x19,0x73,0x1F,0x48,0x18,0xD8,0xB0,0x4E,0xB0,0x75,0xBC,0xB9,0x84,0x8B,0x1F,0x96,0x8A,0x83,0xF1,0xA0,0x1A,0xA2,0xED,0xFF,0x87,
		0x8C,0xA3,0x4F,0xA2 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0xA2,0x75,0xE0,0x26,0xAC,0xD8,0x54,0x79,0x4A,0x4A,0xA2,0xCB,0x53,0xF6,0x62,0x33,0x12,0x9C,0x55,0xB6 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "A275E026ACD854794A4AA2CB53F66233129C55B6", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "02/23/1996 11:15:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "12/31/1999 15:59:00", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", -1569333210, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetName ());
	byte[] pubkey = { 0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,
		0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "30818902818100B8E64FBADB987C717CAF44B7D30F46D964E593C1428EC7BA498D352D7AE78BBDE5053159C6B12F0A0CFB9FA73FA2096684561E37291B87E97E0CCA9A9FA57FF51594A3D5A24682D8684CD137150668AFBDF8B0B3F029F5955A091661770A2225D44F45AAC7BDE596DFF9D4A88E42CC24C01E91274AB56D06806339C4A25E38030203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x00 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "00", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,
		0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,
		0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x39,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x42,0x38,0x45,0x36,0x34,0x46,0x42,0x41,0x44,0x42,0x39,0x38,0x37,0x43,0x37,0x31,0x37,0x43,0x41,0x46,0x34,0x34,0x42,0x37,0x44,0x33,0x30,0x46,0x34,
		0x36,0x44,0x39,0x36,0x34,0x45,0x35,0x39,0x33,0x43,0x31,0x34,0x32,0x38,0x45,0x43,0x37,0x42,0x41,0x34,0x39,0x38,0x44,0x33,0x35,0x32,0x44,0x37,0x41,0x45,0x37,0x38,0x42,0x42,0x44,0x45,0x35,0x30,0x35,0x33,0x31,0x35,0x39,0x43,0x36,0x42,0x31,0x32,0x46,0x30,0x41,0x30,0x43,0x46,0x42,0x39,0x46,0x41,0x37,0x33,0x46,0x41,0x32,0x30,0x39,0x36,0x36,0x38,0x34,0x35,0x36,0x31,0x45,0x33,0x37,0x32,0x39,0x31,0x42,0x38,0x37,0x45,0x39,0x37,0x45,0x30,0x43,0x43,0x41,0x39,0x41,0x39,0x46,0x41,0x35,0x37,0x46,0x46,0x35,0x31,
		0x35,0x39,0x34,0x41,0x33,0x44,0x35,0x41,0x32,0x34,0x36,0x38,0x32,0x44,0x38,0x36,0x38,0x34,0x43,0x44,0x31,0x33,0x37,0x31,0x35,0x30,0x36,0x36,0x38,0x41,0x46,0x42,0x44,0x46,0x38,0x42,0x30,0x42,0x33,0x46,0x30,0x32,0x39,0x46,0x35,0x39,0x35,0x35,0x41,0x30,0x39,0x31,0x36,0x36,0x31,0x37,0x37,0x30,0x41,0x32,0x32,0x32,0x35,0x44,0x34,0x34,0x46,0x34,0x35,0x41,0x41,0x43,0x37,0x42,0x44,0x45,0x35,0x39,0x36,0x44,0x46,0x46,0x39,0x44,0x34,0x41,0x38,0x38,0x45,0x34,0x32,0x43,0x43,0x32,0x34,0x43,0x30,0x31,0x45,0x39,
		0x31,0x32,0x37,0x34,0x41,0x42,0x35,0x36,0x44,0x30,0x36,0x38,0x30,0x36,0x33,0x33,0x39,0x43,0x34,0x41,0x32,0x35,0x45,0x33,0x38,0x30,0x33,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
public void Certificate10 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x02,0x1D,0x30,0x82,0x01,0x86,0x02,0x01,0x14,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,
		0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x39,0x30,0x35,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x58,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x43,0x41,0x31,0x1F,0x30,0x1D,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x31,0x28,0x30,0x26,0x06,
		0x0A,0x2B,0x06,0x01,0x04,0x01,0x2A,0x02,0x0B,0x02,0x01,0x13,0x18,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,
		0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03,0x30,0x0D,0x06,
		0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x32,0x1A,0x35,0xBA,0xBF,0x43,0x27,0xD6,0xB4,0xD4,0xB8,0x76,0xE5,0xE3,0x9B,0x4D,0x6C,0xC0,0x86,0xC9,0x77,0x35,0xBA,0x6B,0x16,0x2D,0x13,0x46,0x4A,0xB0,0x32,0x53,0xA1,0x5B,0x5A,0xE9,0x99,0xE2,0x0C,0x86,0x88,0x17,0x4E,0x0D,0xFE,0x82,0xAC,0x4E,0x47,0xEF,0xFB,0xFF,0x39,0xAC,0xEE,0x35,0xC8,0xFA,0x52,0x37,0x0A,0x49,0xAD,0x59,0xAD,0xE2,0x8A,0xA9,0x1C,0xC6,0x5F,0x1F,0xF8,0x6F,0x73,0x7E,0xCD,0xA0,0x31,0xE8,0x0C,0xBE,0xF5,0x4D,
		0xD9,0xB2,0xAB,0x8A,0x12,0xB6,0x30,0x78,0x68,0x11,0x7C,0x0D,0xF1,0x49,0x4D,0xA3,0xFD,0xB2,0xE9,0xFF,0x1D,0xF0,0x91,0xFA,0x54,0x85,0xFF,0x33,0x90,0xE8,0xC1,0xBF,0xA4,0x9B,0xA4,0x62,0x46,0xBD,0x61,0x12,0x59,0x98,0x41,0x89 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0xE0,0xA0,0x0A,0xBE,0xB2,0xCC,0xA8,0x45,0x40,0xC2,0x1A,0x75,0xE0,0xB3,0xA4,0x06,0xF9,0xA6,0x24,0xAC };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "E0A00ABEB2CCA84540C21A75E0B3A406F9A624AC", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "05/06/1996 16:00:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "05/06/1999 16:00:00", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", -526382402, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=CA, CN=Keywitness Canada Inc., [email protected]", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=CA, CN=Keywitness Canada Inc., [email protected]", x509.GetName ());
	byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0xCD,0x23,0xFA,0x2A,0xE1,0xED,0x98,0xF4,0xE9,0xD0,0x93,0x3E,0xD7,0x7A,0x80,0x02,0x4C,0xCC,0xC1,0x02,0xAF,0x5C,0xB6,0x1F,0x7F,0xFA,0x57,0x42,0x6F,0x30,0xD1,0x20,0xC5,0xB5,0x21,0x07,0x40,0x2C,0xA9,0x86,0xC2,0xF3,0x64,0x84,0xAE,0x3D,0x85,0x2E,0xED,0x85,0xBD,0x54,0xB0,0x18,0x28,0xEF,0x6A,0xF8,0x1B,0xE7,0x0B,0x16,0x1F,0x93,0x25,0x4F,0xC7,0xF8,0x8E,0xC3,0xB9,0xCA,0x98,0x84,0x0E,0x55,0xD0,0x2F,0xEF,0x78,0x77,0xC5,0x72,0x28,0x5F,0x60,0xBF,0x19,0x2B,0xD1,0x72,0xA2,0xB7,0xD8,
		0x3F,0xE0,0x97,0x34,0x5A,0x01,0xBD,0x04,0x9C,0xC8,0x78,0x45,0xCD,0x93,0x8D,0x15,0xF2,0x76,0x10,0x11,0xAB,0xB8,0x5B,0x2E,0x9E,0x52,0xDD,0x81,0x3E,0x9C,0x64,0xC8,0x29,0x93,0x02,0x01,0x03 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "30818702818100CD23FA2AE1ED98F4E9D0933ED77A80024CCCC102AF5CB61F7FFA57426F30D120C5B52107402CA986C2F36484AE3D852EED85BD54B01828EF6AF81BE70B161F93254FC7F88EC3B9CA98840E55D02FEF7877C572285F60BF192BD172A2B7D83FE097345A01BD049CC87845CD938D15F2761011ABB85B2E9E52DD813E9C64C82993020103", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x14 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "14", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x43,0x41,0x2C,0x20,0x43,0x4E,0x3D,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x4F,0x49,0x44,0x2E,0x31,0x2E,0x33,0x2E,0x36,0x2E,0x31,0x2E,0x34,0x2E,0x31,0x2E,0x34,0x32,0x2E,0x32,0x2E,0x31,0x31,0x2E,0x32,0x2E,0x31,0x3D,0x6B,0x65,
		0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x43,0x41,0x2C,0x20,0x43,0x4E,0x3D,0x4B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x20,0x43,0x61,0x6E,0x61,0x64,0x61,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x4F,0x49,0x44,0x2E,0x31,0x2E,0x33,0x2E,0x36,0x2E,0x31,0x2E,0x34,0x2E,0x31,0x2E,0x34,0x32,0x2E,0x32,0x2E,0x31,0x31,0x2E,0x32,0x2E,0x31,0x3D,0x6B,
		0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x40,0x6B,0x65,0x79,0x77,0x69,0x74,0x6E,0x65,0x73,0x73,0x2E,0x63,0x61,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x31,0x34,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
		0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x43,0x44,0x32,0x33,0x46,0x41,0x32,0x41,0x45,0x31,0x45,0x44,0x39,0x38,0x46,0x34,0x45,0x39,0x44,0x30,0x39,0x33,0x33,0x45,0x44,0x37,0x37,0x41,0x38,0x30,0x30,0x32,0x34,0x43,0x43,0x43,0x43,0x31,0x30,0x32,0x41,0x46,0x35,0x43,0x42,0x36,0x31,0x46,0x37,0x46,0x46,0x41,0x35,
		0x37,0x34,0x32,0x36,0x46,0x33,0x30,0x44,0x31,0x32,0x30,0x43,0x35,0x42,0x35,0x32,0x31,0x30,0x37,0x34,0x30,0x32,0x43,0x41,0x39,0x38,0x36,0x43,0x32,0x46,0x33,0x36,0x34,0x38,0x34,0x41,0x45,0x33,0x44,0x38,0x35,0x32,0x45,0x45,0x44,0x38,0x35,0x42,0x44,0x35,0x34,0x42,0x30,0x31,0x38,0x32,0x38,0x45,0x46,0x36,0x41,0x46,0x38,0x31,0x42,0x45,0x37,0x30,0x42,0x31,0x36,0x31,0x46,0x39,0x33,0x32,0x35,0x34,0x46,0x43,0x37,0x46,0x38,0x38,0x45,0x43,0x33,0x42,0x39,0x43,0x41,0x39,0x38,0x38,0x34,0x30,0x45,0x35,0x35,0x44,
		0x30,0x32,0x46,0x45,0x46,0x37,0x38,0x37,0x37,0x43,0x35,0x37,0x32,0x32,0x38,0x35,0x46,0x36,0x30,0x42,0x46,0x31,0x39,0x32,0x42,0x44,0x31,0x37,0x32,0x41,0x32,0x42,0x37,0x44,0x38,0x33,0x46,0x45,0x30,0x39,0x37,0x33,0x34,0x35,0x41,0x30,0x31,0x42,0x44,0x30,0x34,0x39,0x43,0x43,0x38,0x37,0x38,0x34,0x35,0x43,0x44,0x39,0x33,0x38,0x44,0x31,0x35,0x46,0x32,0x37,0x36,0x31,0x30,0x31,0x31,0x41,0x42,0x42,0x38,0x35,0x42,0x32,0x45,0x39,0x45,0x35,0x32,0x44,0x44,0x38,0x31,0x33,0x45,0x39,0x43,0x36,0x34,0x43,0x38,0x32,
		0x39,0x39,0x33,0x30,0x32,0x30,0x31,0x30,0x33,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
public void Certificate8 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x03,0x04,0x30,0x82,0x02,0xC4,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x03,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,
		0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x30,0x30,0x31,0x30,0x32,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x33,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x51,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x31,0x0C,0x30,0x0A,0x06,0x03,0x55,0x04,0x0B,0x13,0x03,0x44,0x6F,0x44,0x31,0x1A,0x30,0x18,
		0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0xB6,0x30,0x82,0x01,0x2B,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,
		0x16,0xB2,0xC3,0x08,0x3D,0xC4,0x59,0xC6,0xF2,0x70,0xA5,0xB0,0xF5,0x1F,0x1D,0xF4,0xB0,0x15,0xDA,0x7E,0x28,0x39,0x24,0x99,0x36,0x5B,0xEC,0x39,0x25,0xFA,0x92,0x49,0x65,0xD2,0x43,0x05,0x6A,0x9E,0xA3,0x7B,0xF0,0xDE,0xA3,0x2F,0xD3,0x6F,0x3A,0xF9,0x35,0xC3,0x29,0xD4,0x45,0x6C,0x56,0x9A,0xDE,0x36,0x6E,0xFE,0x12,0x68,0x96,0x7B,0x45,0x1D,0x2C,0xFF,0xB9,0x2D,0xF5,0x52,0x8C,0xDF,0x3E,0x2F,0x63,0x02,0x15,0x00,0x81,0xA9,0xB5,0xD0,0x04,0xF2,0x9B,0xA7,0xD8,0x55,0x4C,0x3B,0x32,0xA1,0x45,0x32,0x4F,0xF5,0x51,0xDD,
		0x02,0x81,0x80,0x64,0x7A,0x88,0x0B,0xF2,0x3E,0x91,0x81,0x59,0x9C,0xF4,0xEA,0xC6,0x7B,0x0E,0xBE,0xEA,0x05,0xE8,0x77,0xFD,0x20,0x34,0x87,0xA1,0xC4,0x69,0xF6,0xC8,0x8B,0x19,0xDA,0xCD,0xFA,0x21,0x8A,0x57,0xA9,0x7A,0x26,0x0A,0x56,0xD4,0xED,0x4B,0x1B,0x7C,0x70,0xED,0xB4,0xE6,0x7A,0x6A,0xDE,0xD3,0x29,0xE2,0xE9,0x9A,0x33,0xED,0x09,0x8D,0x9E,0xDF,0xDA,0x2E,0x4A,0xC1,0x50,0x92,0xEE,0x2F,0xE5,0x5A,0xF3,0x85,0x62,0x6A,0x48,0xDC,0x1B,0x02,0x98,0xA6,0xB0,0xD1,0x09,0x4B,0x10,0xD1,0xF0,0xFA,0xE0,0xB1,0x1D,0x13,
		0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,
		0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8,0xA3,0x2F,0x30,0x2D,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x9D,0x2D,0x73,0xC3,0xB8,0xE3,0x4D,0x29,0x28,0xC3,0x65,0xBE,0xA9,0x98,0xCB,0xD6,0x8A,0x06,0x68,
		0x9C,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x2F,0x00,0x30,0x2C,0x02,0x14,0x5A,0x1B,0x2D,0x08,0x0E,0xE6,0x99,0x38,0x8F,0xB5,0x09,0xC9,0x89,0x79,0x7E,0x01,0x30,0xBD,0xCE,0xF0,0x02,0x14,0x71,0x7B,0x08,0x51,0x97,0xCE,0x4D,0x1F,0x6A,0x84,0x47,0x3A,0xC0,0xBD,0x13,0x89,0x81,0xB9,0x01,0x97 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0xA3,0x0A,0x06,0xB1,0xB0,0xD4,0xF8,0x71,0x67,0x8A,0x60,0xC5,0x4E,0xE4,0xD8,0x66,0x36,0x06,0xCC,0xE6 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "A30A06B1B0D4F871678A60C54EE4D8663606CCE6", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "10/24/2000 16:00:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "12/31/2002 16:00:00", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", -1559624015, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.10040.4.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x30,0x82,0x01,0x1E,0x02,0x81,0x81,0x00,0x90,0x89,0x3E,0x18,0x1B,0xFE,0xA3,0x1D,0x16,0x89,0x00,0xB4,0xD5,0x40,0x82,0x4C,0x2E,0xEC,0x3D,0x66,0x0D,0x0D,0xB9,0x17,0x40,0x6E,0x3A,0x5C,0x03,0x7B,0x1B,0x93,0x28,0x0C,0xEF,0xB9,0x97,0xE3,0xA1,0xEB,0xE2,0xA3,0x7C,0x61,0xDD,0x6F,0xD5,0xAD,0x15,0x69,0x00,0x16,0xB2,0xC3,0x08,0x3D,0xC4,0x59,0xC6,0xF2,0x70,0xA5,0xB0,0xF5,0x1F,0x1D,0xF4,0xB0,0x15,0xDA,0x7E,0x28,0x39,0x24,0x99,0x36,0x5B,0xEC,0x39,0x25,0xFA,0x92,0x49,0x65,0xD2,0x43,0x05,0x6A,0x9E,0xA3,0x7B,0xF0,0xDE,
		0xA3,0x2F,0xD3,0x6F,0x3A,0xF9,0x35,0xC3,0x29,0xD4,0x45,0x6C,0x56,0x9A,0xDE,0x36,0x6E,0xFE,0x12,0x68,0x96,0x7B,0x45,0x1D,0x2C,0xFF,0xB9,0x2D,0xF5,0x52,0x8C,0xDF,0x3E,0x2F,0x63,0x02,0x15,0x00,0x81,0xA9,0xB5,0xD0,0x04,0xF2,0x9B,0xA7,0xD8,0x55,0x4C,0x3B,0x32,0xA1,0x45,0x32,0x4F,0xF5,0x51,0xDD,0x02,0x81,0x80,0x64,0x7A,0x88,0x0B,0xF2,0x3E,0x91,0x81,0x59,0x9C,0xF4,0xEA,0xC6,0x7B,0x0E,0xBE,0xEA,0x05,0xE8,0x77,0xFD,0x20,0x34,0x87,0xA1,0xC4,0x69,0xF6,0xC8,0x8B,0x19,0xDA,0xCD,0xFA,0x21,0x8A,0x57,0xA9,0x7A,
		0x26,0x0A,0x56,0xD4,0xED,0x4B,0x1B,0x7C,0x70,0xED,0xB4,0xE6,0x7A,0x6A,0xDE,0xD3,0x29,0xE2,0xE9,0x9A,0x33,0xED,0x09,0x8D,0x9E,0xDF,0xDA,0x2E,0x4A,0xC1,0x50,0x92,0xEE,0x2F,0xE5,0x5A,0xF3,0x85,0x62,0x6A,0x48,0xDC,0x1B,0x02,0x98,0xA6,0xB0,0xD1,0x09,0x4B,0x10,0xD1,0xF0,0xFA,0xE0,0xB1,0x1D,0x13,0x54,0x4B,0xC0,0xA8,0x40,0xEF,0x71,0xE8,0x56,0x6B,0xA2,0x29,0xCB,0x1E,0x09,0x7D,0x27,0x39,0x91,0x3B,0x20,0x4F,0x98,0x39,0xE8,0x39,0xCA,0x98,0xC5,0xAF,0x54 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "3082011E0281810090893E181BFEA31D168900B4D540824C2EEC3D660D0DB917406E3A5C037B1B93280CEFB997E3A1EBE2A37C61DD6FD5AD15690016B2C3083DC459C6F270A5B0F51F1DF4B015DA7E28392499365BEC3925FA924965D243056A9EA37BF0DEA32FD36F3AF935C329D4456C569ADE366EFE1268967B451D2CFFB92DF5528CDF3E2F6302150081A9B5D004F29BA7D8554C3B32A145324FF551DD028180647A880BF23E9181599CF4EAC67B0EBEEA05E877FD203487A1C469F6C88B19DACDFA218A57A97A260A56D4ED4B1B7C70EDB4E67A6ADED329E2E99A33ED098D9EDFDA2E4AC15092EE2FE55AF385626A48DC1B0298A6B0D1094B10D1F0FAE0B11D13544BC0A840EF71E8566BA229CB1E097D2739913B204F9839E839CA98C5AF54", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=U.S. Government, OU=DoD, CN=Armed Forces Root", x509.GetName ());
	byte[] pubkey = { 0x02,0x81,0x80,0x54,0xA8,0x88,0xB5,0x8F,0x01,0x56,0xCE,0x18,0x8F,0xA6,0xD6,0x7C,0x29,0x29,0x75,0x45,0xE8,0x31,0xA4,0x07,0x17,0xED,0x1E,0x5D,0xB2,0x7B,0xBB,0xCE,0x3C,0x97,0x67,0x1E,0x88,0x0A,0xFE,0x7D,0x00,0x22,0x27,0x1D,0x66,0xEE,0xF6,0x1B,0xB6,0x95,0x7F,0x5A,0xFF,0x06,0x34,0x02,0x43,0xC3,0x83,0xC4,0x66,0x2C,0xA1,0x05,0x0E,0x68,0xB3,0xCA,0xDC,0xD3,0xF9,0x0C,0xC0,0x66,0xDF,0x85,0x84,0x4B,0x20,0x5D,0x41,0xAC,0xC0,0xEC,0x37,0x92,0x0E,0x97,0x19,0xBF,0x53,0x35,0x63,0x27,0x18,0x33,0x35,0x42,0x4D,0xF0,0x2D,
		0x6D,0xA7,0xA4,0x98,0xAA,0x57,0xF3,0xD2,0xB8,0x6E,0x4E,0x8F,0xFF,0xBE,0x6F,0x4E,0x0F,0x0B,0x44,0x24,0xEE,0xDF,0x4C,0x22,0x5B,0x44,0x98,0x94,0xCB,0xB8 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "02818054A888B58F0156CE188FA6D67C29297545E831A40717ED1E5DB27BBBCE3C97671E880AFE7D0022271D66EEF61BB6957F5AFF06340243C383C4662CA1050E68B3CADCD3F90CC066DF85844B205D41ACC0EC37920E9719BF53356327183335424DF02D6DA7A498AA57F3D2B86E4E8FFFBE6F4E0F0B4424EEDF4C225B449894CBB8", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x03 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "03", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x6F,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,
		0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x55,0x2E,0x53,0x2E,0x20,0x47,0x6F,0x76,0x65,0x72,0x6E,0x6D,0x65,0x6E,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x6F,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x41,0x72,0x6D,0x65,0x64,0x20,0x46,0x6F,0x72,0x63,0x65,0x73,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x30,0x30,0x34,0x30,0x2E,0x34,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,
		0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x33,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,0x31,0x31,0x45,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x39,0x30,0x38,0x39,0x33,0x45,0x31,0x38,0x31,0x42,0x46,0x45,0x41,0x33,0x31,0x44,0x31,0x36,0x38,0x39,0x30,0x30,0x42,0x34,0x44,0x35,0x34,0x30,0x38,0x32,0x34,0x43,0x32,0x45,0x45,0x43,0x33,0x44,
		0x36,0x36,0x30,0x44,0x30,0x44,0x42,0x39,0x31,0x37,0x34,0x30,0x36,0x45,0x33,0x41,0x35,0x43,0x30,0x33,0x37,0x42,0x31,0x42,0x39,0x33,0x32,0x38,0x30,0x43,0x45,0x46,0x42,0x39,0x39,0x37,0x45,0x33,0x41,0x31,0x45,0x42,0x45,0x32,0x41,0x33,0x37,0x43,0x36,0x31,0x44,0x44,0x36,0x46,0x44,0x35,0x41,0x44,0x31,0x35,0x36,0x39,0x30,0x30,0x31,0x36,0x42,0x32,0x43,0x33,0x30,0x38,0x33,0x44,0x43,0x34,0x35,0x39,0x43,0x36,0x46,0x32,0x37,0x30,0x41,0x35,0x42,0x30,0x46,0x35,0x31,0x46,0x31,0x44,0x46,0x34,0x42,0x30,0x31,0x35,
		0x44,0x41,0x37,0x45,0x32,0x38,0x33,0x39,0x32,0x34,0x39,0x39,0x33,0x36,0x35,0x42,0x45,0x43,0x33,0x39,0x32,0x35,0x46,0x41,0x39,0x32,0x34,0x39,0x36,0x35,0x44,0x32,0x34,0x33,0x30,0x35,0x36,0x41,0x39,0x45,0x41,0x33,0x37,0x42,0x46,0x30,0x44,0x45,0x41,0x33,0x32,0x46,0x44,0x33,0x36,0x46,0x33,0x41,0x46,0x39,0x33,0x35,0x43,0x33,0x32,0x39,0x44,0x34,0x34,0x35,0x36,0x43,0x35,0x36,0x39,0x41,0x44,0x45,0x33,0x36,0x36,0x45,0x46,0x45,0x31,0x32,0x36,0x38,0x39,0x36,0x37,0x42,0x34,0x35,0x31,0x44,0x32,0x43,0x46,0x46,
		0x42,0x39,0x32,0x44,0x46,0x35,0x35,0x32,0x38,0x43,0x44,0x46,0x33,0x45,0x32,0x46,0x36,0x33,0x30,0x32,0x31,0x35,0x30,0x30,0x38,0x31,0x41,0x39,0x42,0x35,0x44,0x30,0x30,0x34,0x46,0x32,0x39,0x42,0x41,0x37,0x44,0x38,0x35,0x35,0x34,0x43,0x33,0x42,0x33,0x32,0x41,0x31,0x34,0x35,0x33,0x32,0x34,0x46,0x46,0x35,0x35,0x31,0x44,0x44,0x30,0x32,0x38,0x31,0x38,0x30,0x36,0x34,0x37,0x41,0x38,0x38,0x30,0x42,0x46,0x32,0x33,0x45,0x39,0x31,0x38,0x31,0x35,0x39,0x39,0x43,0x46,0x34,0x45,0x41,0x43,0x36,0x37,0x42,0x30,0x45,
		0x42,0x45,0x45,0x41,0x30,0x35,0x45,0x38,0x37,0x37,0x46,0x44,0x32,0x30,0x33,0x34,0x38,0x37,0x41,0x31,0x43,0x34,0x36,0x39,0x46,0x36,0x43,0x38,0x38,0x42,0x31,0x39,0x44,0x41,0x43,0x44,0x46,0x41,0x32,0x31,0x38,0x41,0x35,0x37,0x41,0x39,0x37,0x41,0x32,0x36,0x30,0x41,0x35,0x36,0x44,0x34,0x45,0x44,0x34,0x42,0x31,0x42,0x37,0x43,0x37,0x30,0x45,0x44,0x42,0x34,0x45,0x36,0x37,0x41,0x36,0x41,0x44,0x45,0x44,0x33,0x32,0x39,0x45,0x32,0x45,0x39,0x39,0x41,0x33,0x33,0x45,0x44,0x30,0x39,0x38,0x44,0x39,0x45,0x44,0x46,
		0x44,0x41,0x32,0x45,0x34,0x41,0x43,0x31,0x35,0x30,0x39,0x32,0x45,0x45,0x32,0x46,0x45,0x35,0x35,0x41,0x46,0x33,0x38,0x35,0x36,0x32,0x36,0x41,0x34,0x38,0x44,0x43,0x31,0x42,0x30,0x32,0x39,0x38,0x41,0x36,0x42,0x30,0x44,0x31,0x30,0x39,0x34,0x42,0x31,0x30,0x44,0x31,0x46,0x30,0x46,0x41,0x45,0x30,0x42,0x31,0x31,0x44,0x31,0x33,0x35,0x34,0x34,0x42,0x43,0x30,0x41,0x38,0x34,0x30,0x45,0x46,0x37,0x31,0x45,0x38,0x35,0x36,0x36,0x42,0x41,0x32,0x32,0x39,0x43,0x42,0x31,0x45,0x30,0x39,0x37,0x44,0x32,0x37,0x33,0x39,
		0x39,0x31,0x33,0x42,0x32,0x30,0x34,0x46,0x39,0x38,0x33,0x39,0x45,0x38,0x33,0x39,0x43,0x41,0x39,0x38,0x43,0x35,0x41,0x46,0x35,0x34,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x30,0x32,0x38,0x31,0x38,0x30,0x35,0x34,0x41,0x38,0x38,0x38,0x42,0x35,0x38,0x46,0x30,0x31,0x35,0x36,0x43,0x45,0x31,0x38,0x38,0x46,0x41,0x36,0x44,0x36,0x37,0x43,0x32,0x39,0x32,0x39,0x37,0x35,0x34,0x35,0x45,0x38,0x33,0x31,0x41,0x34,0x30,0x37,0x31,0x37,0x45,0x44,0x31,0x45,0x35,0x44,0x42,0x32,
		0x37,0x42,0x42,0x42,0x43,0x45,0x33,0x43,0x39,0x37,0x36,0x37,0x31,0x45,0x38,0x38,0x30,0x41,0x46,0x45,0x37,0x44,0x30,0x30,0x32,0x32,0x32,0x37,0x31,0x44,0x36,0x36,0x45,0x45,0x46,0x36,0x31,0x42,0x42,0x36,0x39,0x35,0x37,0x46,0x35,0x41,0x46,0x46,0x30,0x36,0x33,0x34,0x30,0x32,0x34,0x33,0x43,0x33,0x38,0x33,0x43,0x34,0x36,0x36,0x32,0x43,0x41,0x31,0x30,0x35,0x30,0x45,0x36,0x38,0x42,0x33,0x43,0x41,0x44,0x43,0x44,0x33,0x46,0x39,0x30,0x43,0x43,0x30,0x36,0x36,0x44,0x46,0x38,0x35,0x38,0x34,0x34,0x42,0x32,0x30,
		0x35,0x44,0x34,0x31,0x41,0x43,0x43,0x30,0x45,0x43,0x33,0x37,0x39,0x32,0x30,0x45,0x39,0x37,0x31,0x39,0x42,0x46,0x35,0x33,0x33,0x35,0x36,0x33,0x32,0x37,0x31,0x38,0x33,0x33,0x33,0x35,0x34,0x32,0x34,0x44,0x46,0x30,0x32,0x44,0x36,0x44,0x41,0x37,0x41,0x34,0x39,0x38,0x41,0x41,0x35,0x37,0x46,0x33,0x44,0x32,0x42,0x38,0x36,0x45,0x34,0x45,0x38,0x46,0x46,0x46,0x42,0x45,0x36,0x46,0x34,0x45,0x30,0x46,0x30,0x42,0x34,0x34,0x32,0x34,0x45,0x45,0x44,0x46,0x34,0x43,0x32,0x32,0x35,0x42,0x34,0x34,0x39,0x38,0x39,0x34,
		0x43,0x42,0x42,0x38,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
Ejemplo n.º 13
0
public void Certificate13 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x02,0x14,0x30,0x82,0x01,0xD3,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x02,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x30,0x3A,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x0F,0x30,0x0D,0x06,0x03,0x55,0x04,0x03,0x13,0x06,0x44,0x53,0x41,0x20,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,
		0x32,0x30,0x5A,0x17,0x0D,0x31,0x31,0x30,0x34,0x31,0x39,0x31,0x34,0x35,0x37,0x32,0x30,0x5A,0x30,0x4F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1A,0x30,0x18,0x06,0x03,0x55,0x04,0x0A,0x13,0x11,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x31,0x24,0x30,0x22,0x06,0x03,0x55,0x04,0x03,0x13,0x1B,0x44,0x53,0x41,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x20,0x49,0x6E,0x68,0x65,0x72,0x69,0x74,0x65,0x64,0x20,0x43,0x41,0x30,
		0x81,0x92,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x01,0x03,0x81,0x84,0x00,0x02,0x81,0x80,0x67,0x8C,0x47,0xDA,0x0C,0x36,0x81,0x64,0x39,0xF8,0x1A,0x37,0x0B,0xF0,0xBB,0xD4,0x13,0xFD,0x67,0x3D,0x40,0xC8,0x9C,0x92,0xE1,0x3A,0x89,0x54,0xB0,0xF2,0x97,0xA5,0x70,0xD0,0x64,0x17,0xA4,0xA7,0x7C,0xA9,0xE9,0x27,0x09,0x65,0xDF,0xA0,0xA5,0x1C,0xFC,0x04,0xDA,0x3E,0xDD,0x62,0x6B,0xF0,0x0C,0xED,0x81,0x57,0x4F,0x5D,0x29,0xC8,0x08,0x59,0x19,0x0C,0x5F,0x8D,0x88,0xF0,0xFF,0x8C,0xB6,0xE8,0x75,0x01,0xBE,0x10,
		0x0A,0x64,0xDF,0x57,0x7B,0x8B,0x6C,0x56,0xF0,0x53,0xCE,0x43,0x88,0xB9,0x09,0x99,0x08,0x3C,0x90,0xAF,0x01,0xE8,0xD9,0x32,0x5D,0xED,0x56,0x02,0xCF,0x60,0xD2,0x01,0x3A,0xE3,0x0A,0x2B,0x9E,0x91,0x41,0xF6,0xC7,0x7C,0xDE,0x6C,0x99,0x63,0x00,0x0E,0xA3,0x7C,0x30,0x7A,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x5D,0x24,0xEE,0x8A,0x55,0x1A,0xF2,0xC6,0xC9,0xB2,0xC2,0xBF,0x8A,0xF0,0xB2,0x49,0x4F,0x3A,0xB3,0x1B,0x30,0x1F,0x06,0x03,0x55,0x1D,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x74,0x15,0xD5,0x24,
		0x1C,0xBD,0x5E,0x65,0x88,0x1F,0xE1,0x8B,0x09,0x7E,0x7F,0xEA,0x19,0x48,0x4E,0x61,0x30,0x17,0x06,0x03,0x55,0x1D,0x20,0x04,0x10,0x30,0x0E,0x30,0x0C,0x06,0x0A,0x60,0x86,0x48,0x01,0x65,0x03,0x02,0x01,0x30,0x01,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x0F,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x05,0x30,0x03,0x01,0x01,0xFF,0x30,0x09,0x06,0x07,0x2A,0x86,0x48,0xCE,0x38,0x04,0x03,0x03,0x30,0x00,0x30,0x2D,0x02,0x15,0x00,0xA8,0x59,0x6F,0x31,0x77,0xB6,0x20,
		0xEC,0x36,0x9B,0xEB,0x4B,0x61,0x0A,0xAF,0x44,0xED,0x72,0xBA,0x29,0x02,0x14,0x6D,0x22,0xE1,0xBD,0x4D,0x27,0xF6,0x2E,0x3B,0x1F,0xD7,0x9D,0xD6,0x59,0x5E,0xCB,0x25,0x86,0x22,0xD8 };

	X509Certificate x509 = new X509Certificate (cert);
//	X509Certificate clone = new X509Certificate (x509);

//	Assert.IsTrue (x509.Equals (clone), "Equals");
//	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
//	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	byte[] hash = { 0x0E,0x29,0xCD,0xDC,0xA5,0xE7,0x32,0xA2,0x0D,0xCE,0xD8,0x7B,0x3D,0x00,0x24,0x46,0x85,0x3E,0xBB,0xD1 };
	Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
	Assert.AreEqual ("0E29CDDCA5E732A20DCED87B3D002446853EBBD1", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
	DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("04/19/2001 14:57:20", from.ToString (), "GetEffectiveDateString");
	DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("04/19/2011 14:57:20", until.ToString (), "GetExpirationDateString");
#else
	// fx 1.x has a bug where the returned dates were always in the Seattle time zone
	Assert.AreEqual (DateTime.Parse ("04/19/2001 06:57:20"), DateTime.Parse (x509.GetEffectiveDateString ()), "GetEffectiveDateString");
	Assert.AreEqual (DateTime.Parse ("04/19/2011 06:57:20"), DateTime.Parse (x509.GetExpirationDateString ()), "GetExpirationDateString");
	// which was making it easier to test the dates ;-)
#endif
	Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
	Assert.AreEqual (237620700, x509.GetHashCode (), "GetHashCode");
	Assert.AreEqual ("C=US, O=Test Certificates, CN=DSA CA", x509.GetIssuerName (), "GetIssuerName");
	Assert.AreEqual ("1.2.840.10040.4.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	// this fails under 2.0
	Assert.IsNull (x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.IsNull (x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("C=US, O=Test Certificates, CN=DSA Parameters Inherited CA", x509.GetName (), "GetName");
	byte[] pubkey = { 0x02,0x81,0x80,0x67,0x8C,0x47,0xDA,0x0C,0x36,0x81,0x64,0x39,0xF8,0x1A,0x37,0x0B,0xF0,0xBB,0xD4,0x13,0xFD,0x67,0x3D,0x40,0xC8,0x9C,0x92,0xE1,0x3A,0x89,0x54,0xB0,0xF2,0x97,0xA5,0x70,0xD0,0x64,0x17,0xA4,0xA7,0x7C,0xA9,0xE9,0x27,0x09,0x65,0xDF,0xA0,0xA5,0x1C,0xFC,0x04,0xDA,0x3E,0xDD,0x62,0x6B,0xF0,0x0C,0xED,0x81,0x57,0x4F,0x5D,0x29,0xC8,0x08,0x59,0x19,0x0C,0x5F,0x8D,0x88,0xF0,0xFF,0x8C,0xB6,0xE8,0x75,0x01,0xBE,0x10,0x0A,0x64,0xDF,0x57,0x7B,0x8B,0x6C,0x56,0xF0,0x53,0xCE,0x43,0x88,0xB9,0x09,0x99,0x08,0x3C,
		0x90,0xAF,0x01,0xE8,0xD9,0x32,0x5D,0xED,0x56,0x02,0xCF,0x60,0xD2,0x01,0x3A,0xE3,0x0A,0x2B,0x9E,0x91,0x41,0xF6,0xC7,0x7C,0xDE,0x6C,0x99,0x63,0x00,0x0E };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("028180678C47DA0C36816439F81A370BF0BBD413FD673D40C89C92E13A8954B0F297A570D06417A4A77CA9E9270965DFA0A51CFC04DA3EDD626BF00CED81574F5D29C80859190C5F8D88F0FF8CB6E87501BE100A64DF577B8B6C56F053CE4388B90999083C90AF01E8D9325DED5602CF60D2013AE30A2B9E9141F6C77CDE6C9963000E", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0x02 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	Assert.AreEqual ("02", x509.GetSerialNumberString (), "GetSerialNumberString");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x53,0x41,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x20,0x49,0x6E,0x68,0x65,0x72,0x69,0x74,0x65,0x64,0x20,0x43,0x41,0x0D,0x0A,0x09,0x49,0x73,0x73,
		0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x54,0x65,0x73,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x73,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x53,0x41,0x20,0x43,0x41,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x30,0x30,0x34,0x30,0x2E,0x34,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,
		0x20,0x30,0x32,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x30,0x32,0x38,0x31,0x38,0x30,0x36,0x37,0x38,0x43,0x34,0x37,0x44,0x41,0x30,0x43,0x33,0x36,0x38,0x31,0x36,0x34,0x33,0x39,0x46,0x38,0x31,0x41,0x33,0x37,0x30,0x42,0x46,0x30,0x42,0x42,0x44,0x34,0x31,0x33,0x46,0x44,0x36,0x37,0x33,0x44,0x34,0x30,0x43,0x38,0x39,0x43,0x39,0x32,0x45,0x31,0x33,0x41,0x38,0x39,0x35,0x34,0x42,0x30,0x46,0x32,0x39,0x37,0x41,0x35,0x37,0x30,0x44,0x30,0x36,0x34,0x31,0x37,0x41,0x34,0x41,
		0x37,0x37,0x43,0x41,0x39,0x45,0x39,0x32,0x37,0x30,0x39,0x36,0x35,0x44,0x46,0x41,0x30,0x41,0x35,0x31,0x43,0x46,0x43,0x30,0x34,0x44,0x41,0x33,0x45,0x44,0x44,0x36,0x32,0x36,0x42,0x46,0x30,0x30,0x43,0x45,0x44,0x38,0x31,0x35,0x37,0x34,0x46,0x35,0x44,0x32,0x39,0x43,0x38,0x30,0x38,0x35,0x39,0x31,0x39,0x30,0x43,0x35,0x46,0x38,0x44,0x38,0x38,0x46,0x30,0x46,0x46,0x38,0x43,0x42,0x36,0x45,0x38,0x37,0x35,0x30,0x31,0x42,0x45,0x31,0x30,0x30,0x41,0x36,0x34,0x44,0x46,0x35,0x37,0x37,0x42,0x38,0x42,0x36,0x43,0x35,
		0x36,0x46,0x30,0x35,0x33,0x43,0x45,0x34,0x33,0x38,0x38,0x42,0x39,0x30,0x39,0x39,0x39,0x30,0x38,0x33,0x43,0x39,0x30,0x41,0x46,0x30,0x31,0x45,0x38,0x44,0x39,0x33,0x32,0x35,0x44,0x45,0x44,0x35,0x36,0x30,0x32,0x43,0x46,0x36,0x30,0x44,0x32,0x30,0x31,0x33,0x41,0x45,0x33,0x30,0x41,0x32,0x42,0x39,0x45,0x39,0x31,0x34,0x31,0x46,0x36,0x43,0x37,0x37,0x43,0x44,0x45,0x36,0x43,0x39,0x39,0x36,0x33,0x30,0x30,0x30,0x45,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.Issuer, "Issuer");
	Assert.AreEqual ("C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.Subject, "Subject");
#endif
}
Ejemplo n.º 14
0
public void Certificate1 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
		0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x37,0x5A,0x17,0x0D,0x39,0x37,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x36,0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x31,0x14,0x30,0x12,0x06,0x03,
		0x55,0x04,0x0A,0x13,0x0B,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x70,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x5F,0x00,0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,
		0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x54,0x20,0x67,0x12,0xBB,0x66,0x14,0xC3,0x26,0x6B,0x7F,
		0xDA,0x4A,0x25,0x4D,0x8B,0xE0,0xFD,0x1E,0x53,0x6D,0xAC,0xA2,0xD0,0x89,0xB8,0x2E,0x90,0xA0,0x27,0x43,0xA4,0xEE,0x4A,0x26,0x86,0x40,0xFF,0xB8,0x72,0x8D,0x1E,0xE7,0xB7,0x77,0xDC,0x7D,0xD8,0x3F,0x3A,0x6E,0x55,0x10,0xA6,0x1D,0xB5,0x58,0xF2,0xF9,0x0F,0x2E,0xB4,0x10,0x55,0x48,0xDC,0x13,0x5F,0x0D,0x08,0x26,0x88,0xC9,0xAF,0x66,0xF2,0x2C,0x9C,0x6F,0x3D,0xC3,0x2B,0x69,0x28,0x89,0x40,0x6F,0x8F,0x35,0x3B,0x9E,0xF6,0x8E,0xF1,0x11,0x17,0xFB,0x0C,0x98,0x95,0xA1,0xC2,0xBA,0x89,0x48,0xEB,0xB4,0x06,0x6A,0x22,0x54,
		0xD7,0xBA,0x18,0x3A,0x48,0xA6,0xCB,0xC2,0xFD,0x20,0x57,0xBC,0x63,0x1C };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assert.IsTrue (x509.Equals (clone), "Equals");
	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	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");
	Assert.AreEqual ("02720006E8", x509.GetSerialNumberString (), "GetSerialNumberString");
#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 ;-)
	Assert.AreEqual ("E806007202", x509.GetSerialNumberString (), "GetSerialNumberString");
#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");
	Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	byte[] keyparams = { 0x05,0x00 };
	Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.GetName (), "GetName");
	byte[] pubkey = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("305C02552D58E9BFF031CD7906505AD59E0E2CE6C2F7F9D2CE556485B1909A92B336C1BCEAC823B7AB3AA76463775F84228EE5B645DD46AE0ADD00C21FBAD9ADC07562F89582A280B18269FAE1AF7FBC7DE27C76D5BC2A80FB0203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x2C,0x20,0x4F,0x3D,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,
		0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x4B,
		0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x38,0x30,0x36,0x30,0x30,0x37,0x32,0x30,0x32,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,
		0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x35,0x43,0x30,0x32,0x35,0x35,0x32,0x44,0x35,0x38,0x45,0x39,0x42,0x46,0x46,0x30,0x33,0x31,0x43,0x44,0x37,0x39,0x30,0x36,0x35,0x30,0x35,0x41,0x44,0x35,0x39,0x45,0x30,0x45,0x32,0x43,0x45,0x36,0x43,0x32,0x46,0x37,0x46,0x39,0x44,0x32,0x43,0x45,0x35,0x35,0x36,0x34,0x38,0x35,0x42,0x31,0x39,0x30,0x39,0x41,0x39,0x32,0x42,0x33,0x33,0x36,0x43,0x31,0x42,0x43,0x45,0x41,0x43,0x38,0x32,0x33,0x42,0x37,0x41,0x42,0x33,0x41,0x41,0x37,
		0x36,0x34,0x36,0x33,0x37,0x37,0x35,0x46,0x38,0x34,0x32,0x32,0x38,0x45,0x45,0x35,0x42,0x36,0x34,0x35,0x44,0x44,0x34,0x36,0x41,0x45,0x30,0x41,0x44,0x44,0x30,0x30,0x43,0x32,0x31,0x46,0x42,0x41,0x44,0x39,0x41,0x44,0x43,0x30,0x37,0x35,0x36,0x32,0x46,0x38,0x39,0x35,0x38,0x32,0x41,0x32,0x38,0x30,0x42,0x31,0x38,0x32,0x36,0x39,0x46,0x41,0x45,0x31,0x41,0x46,0x37,0x46,0x42,0x43,0x37,0x44,0x45,0x32,0x37,0x43,0x37,0x36,0x44,0x35,0x42,0x43,0x32,0x41,0x38,0x30,0x46,0x42,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,
		0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("OU=Secure Server Certification Authority, O=\"RSA Data Security, Inc.\", C=US", x509.Issuer, "Issuer");
	Assert.AreEqual ("OU=Server Certification Authority, O=CommerceNet, S=California, C=US", x509.Subject, "Subject");
#endif
}
Ejemplo n.º 15
0
public void Certificate9 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x09,0xB9,0x30,0x82,0x09,0x22,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x20,0x0B,0x35,0x5E,0xCE,0xC4,0xB0,0x63,0xB7,0xDE,0xC6,0x34,0xB9,0x70,0x34,0x44,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x62,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,
		0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x37,0x30,0x38,0x32,0x30,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x82,0x01,0x0A,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,
		0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x31,0x46,0x30,0x44,0x06,0x03,0x55,0x04,0x0B,0x13,0x3D,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,
		0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,
		0x13,0x0D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x31,0x1E,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,0x16,0x0F,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,
		0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x07,0x08,0x30,0x82,0x07,0x04,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x82,0x02,0x1F,0x06,0x03,0x55,0x1D,0x03,0x04,0x82,0x02,0x16,0x30,0x82,0x02,0x12,0x30,0x82,0x02,0x0E,0x30,0x82,0x02,0x0A,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x82,
		0x01,0xF9,0x16,0x82,0x01,0xA7,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,
		0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x20,0x61,0x74,0x3A,0x20,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x50,0x53,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x43,0x50,0x53,0x2D,
		0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x20,0x54,0x65,
		0x6C,0x2E,0x20,0x2B,0x31,0x20,0x28,0x34,0x31,0x35,0x29,0x20,0x39,0x36,0x31,0x2D,0x38,0x38,0x33,0x30,0x20,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
		0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x61,0x6E,0x64,0x20,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0xA0,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x01,0xA1,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x02,0x30,0x2C,0x30,0x2A,0x16,0x28,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,
		0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x36,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,0x04,0x29,0x16,0x27,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x30,0x82,0x04,0x87,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,0x04,0x82,0x04,
		0x78,0x16,0x82,0x04,0x74,0x43,0x41,0x55,0x54,0x49,0x4F,0x4E,0x3A,0x20,0x54,0x68,0x65,0x20,0x43,0x6F,0x6D,0x6D,0x6F,0x6E,0x20,0x4E,0x61,0x6D,0x65,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x0A,0x49,0x44,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2E,0x20,0x49,0x74,0x20,0x6D,0x61,0x79,0x20,0x62,
		0x65,0x20,0x74,0x68,0x65,0x0A,0x68,0x6F,0x6C,0x64,0x65,0x72,0x27,0x73,0x20,0x72,0x65,0x61,0x6C,0x20,0x6E,0x61,0x6D,0x65,0x20,0x6F,0x72,0x20,0x61,0x6E,0x20,0x61,0x6C,0x69,0x61,0x73,0x2E,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x64,0x6F,0x65,0x73,0x20,0x61,0x75,0x74,0x68,0x2D,0x0A,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x65,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x68,0x6F,0x6C,0x64,0x65,0x72,0x2E,
		0x0A,0x0A,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x0A,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x0A,0x43,0x65,0x72,
		0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x0A,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x20,0x61,0x74,0x3A,0x20,0x0A,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,
		0x63,0x6F,0x6D,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x0A,0x43,0x50,0x53,0x2D,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x0A,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,
		0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x0A,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x0A,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
		0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x0A,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0x0A,0x0A,0x57,0x41,0x52,0x4E,0x49,0x4E,0x47,0x3A,0x20,0x54,0x48,0x45,0x20,0x55,0x53,0x45,0x20,0x4F,0x46,0x20,0x54,0x48,0x49,0x53,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x20,0x49,0x53,0x20,0x53,0x54,0x52,0x49,0x43,0x54,0x4C,0x59,0x0A,0x53,0x55,0x42,0x4A,0x45,0x43,0x54,0x20,0x54,0x4F,0x20,0x54,0x48,0x45,0x20,0x56,0x45,0x52,0x49,
		0x53,0x49,0x47,0x4E,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4F,0x4E,0x20,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x0A,0x53,0x54,0x41,0x54,0x45,0x4D,0x45,0x4E,0x54,0x2E,0x20,0x20,0x54,0x48,0x45,0x20,0x49,0x53,0x53,0x55,0x49,0x4E,0x47,0x20,0x41,0x55,0x54,0x48,0x4F,0x52,0x49,0x54,0x59,0x20,0x44,0x49,0x53,0x43,0x4C,0x41,0x49,0x4D,0x53,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x0A,0x49,0x4D,0x50,0x4C,0x49,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x45,0x58,0x50,0x52,0x45,0x53,0x53,0x20,
		0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x2C,0x20,0x49,0x4E,0x43,0x4C,0x55,0x44,0x49,0x4E,0x47,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x0A,0x4F,0x46,0x20,0x4D,0x45,0x52,0x43,0x48,0x41,0x4E,0x54,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4F,0x52,0x20,0x46,0x49,0x54,0x4E,0x45,0x53,0x53,0x20,0x46,0x4F,0x52,0x20,0x41,0x20,0x50,0x41,0x52,0x54,0x49,0x43,0x55,0x4C,0x41,0x52,0x0A,0x50,0x55,0x52,0x50,0x4F,0x53,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x57,0x49,0x4C,0x4C,0x20,0x4E,0x4F,
		0x54,0x20,0x42,0x45,0x20,0x4C,0x49,0x41,0x42,0x4C,0x45,0x20,0x46,0x4F,0x52,0x20,0x43,0x4F,0x4E,0x53,0x45,0x51,0x55,0x45,0x4E,0x54,0x49,0x41,0x4C,0x2C,0x0A,0x50,0x55,0x4E,0x49,0x54,0x49,0x56,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x4F,0x54,0x48,0x45,0x52,0x20,0x44,0x41,0x4D,0x41,0x47,0x45,0x53,0x2E,0x20,0x53,0x45,0x45,0x20,0x54,0x48,0x45,0x20,0x43,0x50,0x53,0x0A,0x46,0x4F,0x52,0x20,0x44,0x45,0x54,0x41,0x49,0x4C,0x53,0x2E,0x0A,0x0A,0x43,0x6F,0x6E,0x74,0x65,0x6E,
		0x74,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x65,0x64,0x0A,0x6E,0x6F,0x6E,0x76,0x65,0x72,0x69,0x66,0x69,0x65,0x64,0x53,0x75,0x62,0x6A,0x65,0x63,0x74,0x41,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x73,0x20,0x65,0x78,0x74,0x65,0x6E,0x73,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x75,0x65,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x0A,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x63,0x6F,0x6E,0x73,0x69,0x64,0x65,0x72,0x65,0x64,0x20,
		0x61,0x73,0x20,0x61,0x63,0x63,0x75,0x72,0x61,0x74,0x65,0x20,0x69,0x6E,0x66,0x6F,0x72,0x6D,0x61,0x74,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x69,0x64,0x61,0x74,0x65,0x64,0x20,0x0A,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x49,0x41,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x2B,0x3D,0x44,0xC7,0x32,0x59,0xAE,0xF1,0x5F,0x8F,0x3F,0x87,0xE3,0x3E,0xEB,0x81,0x30,0xF8,0xA9,0x96,0xDB,0x01,0x42,0x0B,0x04,0xEF,0x37,0x02,0x3F,0xD4,0x20,0x61,0x58,0xC4,0x4A,0x3A,
		0x39,0xB3,0xFB,0xD9,0xF8,0xA5,0xC4,0x5E,0x33,0x5A,0x0E,0xFA,0x93,0x56,0x2F,0x6F,0xD6,0x61,0xA2,0xAF,0xA5,0x0C,0x1D,0xE2,0x41,0x65,0xF3,0x40,0x75,0x66,0x83,0xD2,0x5A,0xB4,0xB7,0x56,0x0B,0x8E,0x0D,0xA1,0x33,0x13,0x7D,0x49,0xC3,0xB1,0x00,0x68,0x83,0x7F,0xB5,0x66,0xD4,0x32,0x32,0xFE,0x8B,0x9A,0x5A,0xD6,0x01,0x72,0x31,0x5D,0x85,0x91,0xBC,0x93,0x9B,0x65,0x60,0x25,0xC6,0x1F,0xBC,0xDD,0x69,0x44,0x62,0xC2,0xB2,0x6F,0x46,0xAB,0x2F,0x20,0xA5,0x6F,0xDA,0x48,0x6C,0x9C };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assert.IsTrue (x509.Equals (clone), "Equals");
	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	byte[] hash = { 0x52,0xD1,0x84,0x8F,0x6A,0x16,0x1B,0xA5,0xC6,0xC1,0x90,0x07,0xF8,0x16,0x46,0x68,0xF5,0xA3,0xB2,0xCF };
	Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
	Assert.AreEqual ("52D1848F6A161BA5C6C19007F8164668F5A3B2CF", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
	DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("08/21/1996 00:00:00", from.ToString (), "GetEffectiveDateString");
	DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("08/20/1997 23:59:59", until.ToString (), "GetExpirationDateString");
	Assert.AreEqual ("200B355ECEC4B063B7DEC634B9703444", x509.GetSerialNumberString (), "GetSerialNumberString");
#else
	// fx 1.x has a bug where the returned dates were always in the Seattle time zone
	Assert.AreEqual ("08/20/1996 16:00:00", x509.GetEffectiveDateString (), "GetEffectiveDateString");
	Assert.AreEqual ("08/20/1997 15:59:59", x509.GetExpirationDateString (), "GetExpirationDateString");
	// which was making it easier to test the dates ;-)
	Assert.AreEqual ("443470B934C6DEB763B0C4CE5E350B20", x509.GetSerialNumberString (), "GetSerialNumberString");
#endif
	Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
	Assert.AreEqual (1389462671, x509.GetHashCode (), "GetHashCode");
	Assert.AreEqual ("L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber", x509.GetIssuerName (), "GetIssuerName");
	Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	byte[] keyparams = { 0x05,0x00 };
	Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber, OU=\"www.verisign.com/repository/CPS Incorp. by Ref.,LIAB.LTD(c)96\", OU=Digital ID Class 1 - Netscape, CN=David T. Gray, [email protected]", x509.GetName (), "GetName");
	byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01 };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("3048024100C58107A2EB0FB8FFF8F81CEE32FFBF12356AF96BC8BE2FFB3EAF04514AACDD1029A8CD405B661E98EFF24C77FA8F86D1216792444AC489C983CF889F6FE232350203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0x44,0x34,0x70,0xB9,0x34,0xC6,0xDE,0xB7,0x63,0xB0,0xC4,0xCE,0x5E,0x35,0x0B,0x20 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,
		0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x2C,0x20,0x4F,0x55,0x3D,0x22,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,
		0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x2C,0x20,0x45,0x3D,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,
		0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,
		0x62,0x65,0x72,0x3A,0x20,0x20,0x34,0x34,0x33,0x34,0x37,0x30,0x42,0x39,0x33,0x34,0x43,0x36,0x44,0x45,0x42,0x37,0x36,0x33,0x42,0x30,0x43,0x34,0x43,0x45,0x35,0x45,0x33,0x35,0x30,0x42,0x32,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x43,0x35,
		0x38,0x31,0x30,0x37,0x41,0x32,0x45,0x42,0x30,0x46,0x42,0x38,0x46,0x46,0x46,0x38,0x46,0x38,0x31,0x43,0x45,0x45,0x33,0x32,0x46,0x46,0x42,0x46,0x31,0x32,0x33,0x35,0x36,0x41,0x46,0x39,0x36,0x42,0x43,0x38,0x42,0x45,0x32,0x46,0x46,0x42,0x33,0x45,0x41,0x46,0x30,0x34,0x35,0x31,0x34,0x41,0x41,0x43,0x44,0x44,0x31,0x30,0x32,0x39,0x41,0x38,0x43,0x44,0x34,0x30,0x35,0x42,0x36,0x36,0x31,0x45,0x39,0x38,0x45,0x46,0x46,0x32,0x34,0x43,0x37,0x37,0x46,0x41,0x38,0x46,0x38,0x36,0x44,0x31,0x32,0x31,0x36,0x37,0x39,0x32,
		0x34,0x34,0x34,0x41,0x43,0x34,0x38,0x39,0x43,0x39,0x38,0x33,0x43,0x46,0x38,0x38,0x39,0x46,0x36,0x46,0x45,0x32,0x33,0x32,0x33,0x35,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("OU=VeriSign Class 1 CA - Individual Subscriber, O=\"VeriSign, Inc.\", L=Internet", x509.Issuer, "Issuer");
	Assert.AreEqual ("[email protected], CN=David T. Gray, OU=Digital ID Class 1 - Netscape, OU=\"www.verisign.com/repository/CPS Incorp. by Ref.,LIAB.LTD(c)96\", OU=VeriSign Class 1 CA - Individual Subscriber, O=\"VeriSign, Inc.\", L=Internet", x509.Subject, "Subject");
#endif
}
Ejemplo n.º 16
0
public void Certificate3 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x03,0x4E,0x30,0x82,0x02,0xB7,0xA0,0x03,0x02,0x01,0x02,0x02,0x20,0x03,0x53,0xD7,0x8B,0xDB,0x3E,0x16,0x15,0x80,0x55,0xC4,0x05,0x40,0x02,0x73,0x4D,0x0C,0x20,0xF8,0x0D,0x88,0x00,0x5F,0x65,0x7A,0xAC,0xBA,0x86,0xBD,0x1C,0xD7,0xE4,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x49,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,
		0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x36,0x30,0x38,0x33,0x31,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x6E,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x0A,0x13,0x07,0x42,0x72,0x61,0x6E,0x64,0x49,
		0x44,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x31,0x25,0x30,0x23,0x06,0x03,0x55,0x04,0x03,0x13,0x1C,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,
		0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x01,0x44,0x30,0x82,0x01,0x40,0x30,0x5C,0x06,0x03,0x55,0x1D,0x23,0x04,0x55,0x30,0x53,0x81,0x4B,0x84,0x49,0x31,0x0B,0x30,
		0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x03,0x13,0x17,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x82,0x04,0x32,0x06,0xAC,0x10,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x2E,0x06,0x03,0x55,0x1D,0x10,0x01,
		0x01,0xFF,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39,0x39,0x36,0x30,0x38,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x36,0x30,0x39,0x30,0x37,0x30,0x37,0x34,0x39,0x30,0x30,0x5A,0x30,0x18,0x06,0x03,0x55,0x1D,0x20,0x04,0x11,0x30,0x0F,0x30,0x0D,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x0C,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x02,0x30,0x00,0x30,0x14,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x03,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,
		0x07,0x80,0x30,0x62,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x02,0x07,0x01,0x01,0xFF,0x04,0x52,0x30,0x50,0x04,0x14,0x33,0x39,0x38,0x32,0x33,0x39,0x38,0x37,0x32,0x33,0x37,0x38,0x39,0x31,0x33,0x34,0x39,0x37,0x38,0x32,0x30,0x09,0x06,0x05,0x2B,0x0D,0x03,0x02,0x1A,0x05,0x00,0x16,0x0F,0x74,0x65,0x72,0x73,0x65,0x20,0x73,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x1D,0x00,0x16,0x1A,0x67,0x65,0x74,0x73,0x65,0x74,0x2D,0x63,0x65,0x6E,0x74,0x65,0x72,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,
		0x6F,0x6D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0x1D,0x6C,0x90,0xF2,0x02,0x10,0xD5,0xA0,0x7B,0xEB,0x07,0x14,0x1D,0xAE,0x2C,0xD5,0xB1,0x4C,0x23,0x30,0xB2,0x31,0x7F,0x96,0x3C,0xD1,0x41,0x11,0xEA,0x08,0x0D,0x80,0x5F,0x46,0x66,0x9D,0x0A,0xF2,0x91,0xE8,0x7C,0xCE,0xC0,0xAD,0xE6,0x96,0x19,0x9C,0x26,0xC3,0x4E,0xEB,0x6F,0xF4,0x4A,0x69,0x4C,0xFE,0x4C,0x76,0xB3,0x51,0xCA,0x44,0x03,0xFC,0xD4,0xF4,0xF9,0x32,0x2A,0xAE,0x03,0x1B,0x5F,0xA6,0xBF,0x16,0x61,
		0xA0,0x07,0x86,0x85,0xA7,0xD6,0x0D,0xEF,0x88,0x9B,0x2A,0xBA,0xB8,0xD4,0x5C,0x94,0x7C,0x63,0xE1,0xE0,0x69,0xEB,0x3D,0x2F,0xC1,0x71,0x56,0x47,0x55,0x4B,0xB8,0xFD,0xCD,0xD6,0xC7,0x6F,0xA7,0x47,0xE9,0x43,0x91,0x2E,0xCF,0x93,0xA4,0x05,0x18,0xC5,0x98 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assert.IsTrue (x509.Equals (clone), "Equals");
	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	byte[] hash = { 0x39,0x5F,0xBB,0xFC,0x14,0x89,0x33,0x27,0x76,0x89,0xB7,0x59,0x3A,0x7D,0x1C,0xFF,0xF1,0x56,0xF1,0x62 };
	Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
	Assert.AreEqual ("395FBBFC148933277689B7593A7D1CFFF156F162", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
	DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("08/07/1996 00:00:00", from.ToString (), "GetEffectiveDateString");
	DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("08/31/1996 23:59:59", until.ToString (), "GetExpirationDateString");
	Assert.AreEqual ("0353D78BDB3E16158055C4054002734D0C20F80D88005F657AACBA86BD1CD7E4", x509.GetSerialNumberString (), "GetSerialNumberString");
#else
	// fx 1.x has a bug where the returned dates were always in the Seattle time zone
	Assert.AreEqual ("08/06/1996 16:00:00", x509.GetEffectiveDateString (), "GetEffectiveDateString");
	Assert.AreEqual ("08/31/1996 15:59:59", x509.GetExpirationDateString (), "GetExpirationDateString");
	// which was making it easier to test the dates ;-)
	Assert.AreEqual ("E4D71CBD86BAAC7A655F00880DF8200C4D73024005C4558015163EDB8BD75303", x509.GetSerialNumberString (), "GetSerialNumberString");
#endif
	Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
	Assert.AreEqual (962575356, x509.GetHashCode (), "GetHashCode");
	Assert.AreEqual ("C=US, O=CCA - Unique ID, CN=Brand Name:Product Type", x509.GetIssuerName (), "GetIssuerName");
	Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	byte[] keyparams = { 0x05,0x00 };
	Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("C=US, O=BrandID, OU=Issuing Financial Institution, CN=\"0+WKJx+wYEZabSSPVX9kLsnx92s=\"", x509.GetName (), "GetName");
	byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xAC,0xC4,0x0E,0x05,0x25,0xBC,0xEA,0xEF,0x0C,0x22,0x7F,0xC4,0x0C,0x4A,0x69,0x31,0x00,0xF9,0x3F,0xE9,0xE1,0x6C,0x54,0x97,0x77,0x4E,0x18,0xC6,0x4A,0x95,0xE0,0xD4,0x58,0x29,0x5C,0x17,0x5D,0x1D,0x1E,0x56,0xBC,0x49,0x3D,0xE0,0xF9,0x9F,0xBB,0x01,0xF9,0x86,0xB6,0xA6,0x95,0xDD,0xE1,0x04,0x32,0x01,0x52,0x4E,0x8F,0x86,0x30,0xF7,0x02,0x03,0x01,0x00,0x01 };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("3048024100ACC40E0525BCEAEF0C227FC40C4A693100F93FE9E16C5497774E18C64A95E0D458295C175D1D1E56BC493DE0F99FBB01F986B6A695DDE1043201524E8F8630F70203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0xE4,0xD7,0x1C,0xBD,0x86,0xBA,0xAC,0x7A,0x65,0x5F,0x00,0x88,0x0D,0xF8,0x20,0x0C,0x4D,0x73,0x02,0x40,0x05,0xC4,0x55,0x80,0x15,0x16,0x3E,0xDB,0x8B,0xD7,0x53,0x03 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x42,0x72,0x61,0x6E,0x64,0x49,0x44,0x2C,0x20,0x4F,0x55,0x3D,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x49,0x6E,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x22,0x30,0x2B,0x57,0x4B,0x4A,0x78,0x2B,0x77,
		0x59,0x45,0x5A,0x61,0x62,0x53,0x53,0x50,0x56,0x58,0x39,0x6B,0x4C,0x73,0x6E,0x78,0x39,0x32,0x73,0x3D,0x22,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x43,0x43,0x41,0x20,0x2D,0x20,0x55,0x6E,0x69,0x71,0x75,0x65,0x20,0x49,0x44,0x2C,0x20,0x43,0x4E,0x3D,0x42,0x72,0x61,0x6E,0x64,0x20,0x4E,0x61,0x6D,0x65,0x3A,0x50,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x54,0x79,0x70,0x65,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,
		0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x34,0x44,0x37,0x31,0x43,0x42,0x44,0x38,0x36,0x42,0x41,0x41,0x43,0x37,0x41,0x36,0x35,0x35,0x46,0x30,0x30,0x38,0x38,0x30,0x44,0x46,0x38,0x32,0x30,0x30,0x43,0x34,0x44,0x37,0x33,0x30,0x32,0x34,0x30,0x30,0x35,0x43,0x34,0x35,0x35,0x38,0x30,0x31,0x35,0x31,0x36,0x33,0x45,
		0x44,0x42,0x38,0x42,0x44,0x37,0x35,0x33,0x30,0x33,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x41,0x43,0x43,0x34,0x30,0x45,0x30,0x35,0x32,0x35,0x42,0x43,0x45,0x41,0x45,0x46,0x30,0x43,0x32,0x32,0x37,0x46,0x43,0x34,0x30,0x43,0x34,0x41,0x36,0x39,
		0x33,0x31,0x30,0x30,0x46,0x39,0x33,0x46,0x45,0x39,0x45,0x31,0x36,0x43,0x35,0x34,0x39,0x37,0x37,0x37,0x34,0x45,0x31,0x38,0x43,0x36,0x34,0x41,0x39,0x35,0x45,0x30,0x44,0x34,0x35,0x38,0x32,0x39,0x35,0x43,0x31,0x37,0x35,0x44,0x31,0x44,0x31,0x45,0x35,0x36,0x42,0x43,0x34,0x39,0x33,0x44,0x45,0x30,0x46,0x39,0x39,0x46,0x42,0x42,0x30,0x31,0x46,0x39,0x38,0x36,0x42,0x36,0x41,0x36,0x39,0x35,0x44,0x44,0x45,0x31,0x30,0x34,0x33,0x32,0x30,0x31,0x35,0x32,0x34,0x45,0x38,0x46,0x38,0x36,0x33,0x30,0x46,0x37,0x30,0x32,
		0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("CN=Brand Name:Product Type, O=CCA - Unique ID, C=US", x509.Issuer, "Issuer");
	Assert.AreEqual ("CN=\"0+WKJx+wYEZabSSPVX9kLsnx92s=\", OU=Issuing Financial Institution, O=BrandID, C=US", x509.Subject, "Subject");
#endif
}
Ejemplo n.º 17
0
public void Certificate2 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xDF,0x30,0x82,0x01,0x48,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x31,0x31,0x38,0x32,0x31,0x30,0x33,0x35,0x32,
		0x5A,0x17,0x0D,0x30,0x31,0x30,0x31,0x31,0x36,0x32,0x31,0x30,0x33,0x35,0x32,0x5A,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,
		0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,0xB8,0xA4,
		0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x38,0x50,0x1D,0x0A,0xD3,0x1B,0xBB,0xA2,0x9F,0x6C,0x8D,0x10,0xAA,0x42,0x1B,0x05,0x8D,0xE4,0x25,0xAB,0xFB,0x55,0xAE,0x6D,0xBA,0x53,0x67,0x15,0x07,0x9A,0xEC,0x55,0x9F,0x72,0x89,0x5F,0x24,0xB0,0xDB,0xCA,0x64,0xBD,0x64,0xAA,0xC2,0x8C,
		0xD9,0x3D,0xA2,0x45,0xB7,0xC6,0x92,0x71,0x51,0xEF,0xED,0xE1,0x51,0x54,0x97,0x56,0x35,0xA1,0xCE,0xE4,0x44,0xC4,0x47,0x66,0xFF,0x91,0xDA,0x88,0x9C,0x23,0xC2,0xB3,0xD4,0x62,0x4A,0xBC,0x94,0x55,0x9C,0x80,0x8E,0xB3,0xDD,0x4F,0x1A,0xED,0x12,0x5A,0xB5,0x2E,0xBC,0xF8,0x4B,0xCE,0xC6,0xD4,0x70,0xB3,0xB3,0x22,0xF8,0x5E,0x5C,0x36,0x7A,0xA6,0xB8,0x39,0x73,0x46,0x43,0x5C,0x9B,0x9A,0xBD,0x1E,0x7E,0xA7,0x04,0xCF,0x25,0x36 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assert.IsTrue (x509.Equals (clone), "Equals");
	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	byte[] hash = { 0x9E,0x87,0x80,0x3E,0xC5,0x68,0x9A,0xEF,0xE7,0x7F,0x92,0xF9,0x1A,0xBF,0xA7,0x46,0x7C,0x76,0xED,0x02 };
	Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
	Assert.AreEqual ("9E87803EC5689AEFE77F92F91ABFA7467C76ED02", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
	DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("01/18/1996 21:03:52", from.ToString (), "GetEffectiveDateString");
	DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("01/16/2001 21:03:52", until.ToString (), "GetExpirationDateString");
#else
	// fx 1.x has a bug where the returned dates were always in the Seattle time zone
	Assert.AreEqual ("01/18/1996 13:03:52", x509.GetEffectiveDateString (), "GetEffectiveDateString");
	Assert.AreEqual ("01/16/2001 13:03:52", x509.GetExpirationDateString (), "GetExpirationDateString");
	// which was making it easier to test the dates ;-)
#endif
	Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
	Assert.AreEqual (-1635286978, x509.GetHashCode (), "GetHashCode");
	Assert.AreEqual ("C=US, O=AT&T, OU=Directory Services", x509.GetIssuerName (), "GetIssuerName");
	Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	byte[] keyparams = { 0x05,0x00 };
	Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("C=US, O=AT&T, OU=Directory Services", x509.GetName (), "GetName");
	byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,
		0xB8,0xA4,0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("30818702818100876472890B208F8727ACC622FE00406948AFC686CD2333E311C5311A1F7E9E9213B6A2ACE3B01F2A076CB6D4DE4BFAF1A2A07DCE4BBEBE2648098C8511DECB22E7C2EE4451FE67D55B5AE016375404B83B321294839EB14D806CA4A976ACB8A497F7AB0B6CA543BA6E4FC54E0030163C3F9914DAA220088BBAED76AC9700D56D02010F", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0x00 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	Assert.AreEqual ("00", x509.GetSerialNumberString (), "GetSerialNumberString");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,
		0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
		0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x38,0x37,0x36,0x34,0x37,0x32,0x38,0x39,0x30,0x42,0x32,0x30,0x38,0x46,0x38,0x37,0x32,0x37,0x41,0x43,0x43,0x36,0x32,0x32,0x46,0x45,0x30,0x30,0x34,0x30,0x36,0x39,0x34,0x38,0x41,0x46,0x43,0x36,0x38,0x36,0x43,0x44,0x32,0x33,0x33,0x33,0x45,0x33,0x31,0x31,0x43,0x35,0x33,
		0x31,0x31,0x41,0x31,0x46,0x37,0x45,0x39,0x45,0x39,0x32,0x31,0x33,0x42,0x36,0x41,0x32,0x41,0x43,0x45,0x33,0x42,0x30,0x31,0x46,0x32,0x41,0x30,0x37,0x36,0x43,0x42,0x36,0x44,0x34,0x44,0x45,0x34,0x42,0x46,0x41,0x46,0x31,0x41,0x32,0x41,0x30,0x37,0x44,0x43,0x45,0x34,0x42,0x42,0x45,0x42,0x45,0x32,0x36,0x34,0x38,0x30,0x39,0x38,0x43,0x38,0x35,0x31,0x31,0x44,0x45,0x43,0x42,0x32,0x32,0x45,0x37,0x43,0x32,0x45,0x45,0x34,0x34,0x35,0x31,0x46,0x45,0x36,0x37,0x44,0x35,0x35,0x42,0x35,0x41,0x45,0x30,0x31,0x36,0x33,
		0x37,0x35,0x34,0x30,0x34,0x42,0x38,0x33,0x42,0x33,0x32,0x31,0x32,0x39,0x34,0x38,0x33,0x39,0x45,0x42,0x31,0x34,0x44,0x38,0x30,0x36,0x43,0x41,0x34,0x41,0x39,0x37,0x36,0x41,0x43,0x42,0x38,0x41,0x34,0x39,0x37,0x46,0x37,0x41,0x42,0x30,0x42,0x36,0x43,0x41,0x35,0x34,0x33,0x42,0x41,0x36,0x45,0x34,0x46,0x43,0x35,0x34,0x45,0x30,0x30,0x33,0x30,0x31,0x36,0x33,0x43,0x33,0x46,0x39,0x39,0x31,0x34,0x44,0x41,0x41,0x32,0x32,0x30,0x30,0x38,0x38,0x42,0x42,0x41,0x45,0x44,0x37,0x36,0x41,0x43,0x39,0x37,0x30,0x30,0x44,
		0x35,0x36,0x44,0x30,0x32,0x30,0x31,0x30,0x46,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("OU=Directory Services, O=AT&T, C=US", x509.Issuer, "Issuer");
	Assert.AreEqual ("OU=Directory Services, O=AT&T, C=US", x509.Subject, "Subject");
#endif
}
Ejemplo n.º 18
0
		public void ConstructorIntPtr_PermitOnlyUnmanagedCode ()
		{
			// will fail _when_ calling the constructor
			X509Certificate x509 = new X509Certificate (IntPtr.Zero);
			Assert.AreEqual (0, x509.GetHashCode (), "ConstructorIntPtrZero");
		}
Ejemplo n.º 19
0
		public void PartialTrust_DenyUnrestricted ()
		{
			X509Certificate x509 = new X509Certificate (cert);
			X509Certificate clone = new X509Certificate (x509);

			Assert.IsTrue (x509.Equals (clone), "Equals 1");
			Assert.IsTrue (clone.Equals (x509), "Equals 2");

			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");
			Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
			byte[] keyparams = { 0x05,0x00 };
			Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
			Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
			Assert.AreEqual ("C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.GetName (), "GetName");
			byte[] pubkey = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
			Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
			Assert.AreEqual ("305C02552D58E9BFF031CD7906505AD59E0E2CE6C2F7F9D2CE556485B1909A92B336C1BCEAC823B7AB3AA76463775F84228EE5B645DD46AE0ADD00C21FBAD9ADC07562F89582A280B18269FAE1AF7FBC7DE27C76D5BC2A80FB0203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
			Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
			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");
		}	
public void Certificate5 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x06,0x2F,0x30,0x82,0x05,0x17,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x6A,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x20,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1E,0x17,0x0D,0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x30,0x34,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x20,0x31,0x0B,
		0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x0A,0x13,0x08,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD4,0xDC,0x3E,0xBA,0xE1,0x94,0xF7,0xBE,0xCD,0xED,0x21,0x77,0xCF,0xDA,0x88,0x58,0x51,0x0E,0x8F,0xF4,0xDA,0x00,0x14,0x1E,0x0D,0xA7,0xAD,0xB6,0x96,0x5A,0xC6,0xD3,0xEC,0x25,0xED,0xD8,0x43,
		0x0B,0x6E,0x7F,0x3F,0x9E,0x1E,0x74,0xA0,0x1E,0x97,0x76,0x30,0xCA,0x6F,0x0A,0x63,0xC0,0xA3,0x31,0x40,0x25,0x80,0xB8,0xBD,0x28,0xEB,0x7D,0x75,0x0B,0x4E,0x41,0x34,0xC4,0x20,0x00,0xC2,0xCB,0xF4,0x9A,0x20,0x00,0x58,0xD9,0xF4,0x40,0x13,0x18,0x77,0x0C,0xB5,0x04,0xDE,0xB7,0xB6,0x43,0x8B,0xA4,0xCC,0x36,0x76,0x79,0xC5,0x0B,0x17,0xCB,0x7E,0x88,0xA1,0x33,0xB0,0xD3,0x34,0x27,0xBF,0x3B,0x61,0xDA,0xC5,0x20,0xEB,0xF9,0x94,0x9A,0x8B,0x79,0xB2,0xA8,0x8E,0xCB,0xC1,0xD9,0x94,0x4A,0x99,0x66,0x50,0x55,0xB2,0x83,0x28,
		0x7D,0x22,0x3D,0xEC,0xDC,0xA3,0xE8,0x39,0xDB,0x83,0x54,0xC9,0x89,0xA9,0xDF,0x59,0x52,0x9F,0x7A,0xEF,0x7C,0x11,0x62,0x52,0xEC,0xE6,0x67,0xBA,0x3D,0xEA,0xAB,0x47,0xDB,0xE4,0xF4,0x1F,0x73,0xC3,0x3D,0xEC,0x7E,0x84,0x7D,0x2F,0x29,0xFE,0x6C,0x17,0x3F,0x75,0x6D,0x56,0x6E,0xC0,0x4E,0xB5,0xBF,0x2A,0x20,0x8A,0xE4,0x57,0xAE,0xC0,0x2E,0x68,0xC9,0x09,0xCF,0x85,0x77,0x0A,0xEF,0x3A,0x37,0xCB,0x60,0x4C,0x45,0x73,0x7F,0x90,0x3E,0x86,0x1D,0xFA,0xC3,0xFC,0x50,0x8A,0xB2,0xC5,0x8A,0x34,0xF0,0xF2,0x43,0xEE,0x3C,0x56,
		0xBA,0x24,0xE9,0xE0,0xA5,0x87,0x1E,0x7C,0x30,0x33,0x77,0xFD,0x5D,0xE0,0x57,0x0D,0x6C,0x19,0x39,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x03,0x72,0x30,0x82,0x03,0x6E,0x30,0x12,0x06,0x03,0x55,0x1D,0x13,0x01,0x01,0xFF,0x04,0x08,0x30,0x06,0x01,0x01,0xFF,0x02,0x01,0x03,0x30,0x82,0x02,0xC9,0x06,0x03,0x55,0x1D,0x20,0x01,0x01,0xFF,0x04,0x82,0x02,0xBD,0x30,0x82,0x02,0xB9,0x30,0x82,0x02,0xB5,0x06,0x04,0x67,0x2A,0x05,0x00,0x30,0x82,0x02,0xAB,0x30,0x82,0x02,0xA7,0x06,0x04,0x67,0x2A,0x07,0x06,0x30,0x82,0x02,0x9D,
		0x30,0x82,0x02,0x99,0x1A,0x82,0x02,0x95,0x54,0x68,0x69,0x73,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x6E,0x64,0x20,0x61,0x6E,0x79,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x6F,0x72,0x20,0x69,0x6E,0x64,0x69,0x72,0x65,0x63,0x74,0x6C,0x79,0x20,0x62,0x79,0x20,0x74,0x68,0x69,0x73,0x20,0x63,
		0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2C,0x20,0x6D,0x61,0x79,0x20,0x6F,0x6E,0x6C,0x79,0x20,0x62,0x65,0x20,0x75,0x73,0x65,0x64,0x20,0x74,0x6F,0x20,0x65,0x6E,0x61,0x62,0x6C,0x65,0x20,0x22,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x46,0x69,0x6E,0x61,0x6E,0x63,0x69,0x61,0x6C,0x20,0x54,0x72,0x61,0x6E,0x73,0x61,0x63,0x74,0x69,0x6F,0x6E,0x73,0x22,0x20,0x61,0x73,0x20,0x64,0x65,0x66,0x69,0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,
		0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x61,0x6E,0x64,0x2C,0x20,0x77,0x68,0x65,0x6E,0x20,0x61,0x70,0x70,0x72,0x6F,0x70,0x72,0x69,0x61,0x74,0x65,0x2C,0x20,0x69,0x6E,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x2E,0x20,0x20,
		0x4E,0x6F,0x20,0x50,0x61,0x72,0x74,0x79,0x20,0x6D,0x61,0x79,0x20,0x72,0x65,0x6C,0x79,0x20,0x75,0x70,0x6F,0x6E,0x20,0x74,0x68,0x65,0x20,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x66,0x6F,0x72,0x20,0x61,0x6E,0x79,0x20,0x6F,0x74,0x68,0x65,0x72,0x20,0x70,0x75,0x72,0x70,0x6F,0x73,0x65,0x2E,0x20,0x20,0x41,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x61,0x6E,0x79,0x20,0x70,0x61,0x79,
		0x6D,0x65,0x6E,0x74,0x20,0x62,0x72,0x61,0x6E,0x64,0x20,0x77,0x68,0x6F,0x73,0x65,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x73,0x20,0x73,0x69,0x67,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x72,0x72,0x65,0x73,0x70,0x6F,0x6E,0x64,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x74,0x68,0x65,0x20,0x70,0x75,0x62,0x6C,0x69,0x63,0x20,0x6B,0x65,0x79,0x20,0x63,0x6F,0x6E,0x74,0x61,0x69,
		0x6E,0x65,0x64,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x6D,0x61,0x74,0x74,0x65,0x72,0x73,0x20,0x72,0x65,0x6C,0x61,0x74,0x69,0x6E,0x67,0x20,0x74,0x6F,0x20,0x75,0x73,0x61,0x67,0x65,0x2C,0x20,0x6C,0x69,0x61,0x62,0x69,0x6C,0x69,0x74,0x79,0x20,0x61,0x6E,0x64,0x20,0x70,0x72,0x6F,0x63,0x65,0x64,0x75,0x72,0x65,0x73,0x20,0x77,0x69,0x74,0x68,0x20,0x53,0x45,0x54,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,
		0x74,0x65,0x73,0x20,0x69,0x73,0x73,0x75,0x65,0x64,0x20,0x62,0x65,0x6E,0x65,0x61,0x74,0x68,0x20,0x61,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x62,0x65,0x20,0x64,0x65,0x74,0x65,0x72,0x6D,0x69,0x6E,0x65,0x64,0x20,0x62,0x79,0x20,0x74,0x68,0x61,0x74,0x20,0x53,0x45,0x54,0x20,0x42,0x72,0x61,0x6E,0x64,0x2E,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x2B,0x06,0x03,0x55,0x1D,0x10,0x04,0x24,0x30,0x22,0x80,0x0F,0x31,0x39,
		0x39,0x37,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x81,0x0F,0x31,0x39,0x39,0x38,0x30,0x37,0x31,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x30,0x10,0x06,0x04,0x67,0x2A,0x07,0x01,0x01,0x01,0xFF,0x04,0x05,0x03,0x03,0x07,0x00,0x80,0x30,0x3C,0x06,0x04,0x67,0x2A,0x07,0x00,0x01,0x01,0xFF,0x04,0x31,0x30,0x2F,0x30,0x2D,0x02,0x01,0x00,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x30,0x07,0x06,0x05,0x67,0x2A,0x03,0x00,0x00,0x04,0x14,0xC8,0x57,0x44,0x4F,0xD7,0x91,0x56,0x3E,0xC6,0xF3,
		0xE0,0xE6,0x08,0x2E,0x9A,0xAF,0x61,0x11,0x43,0x5D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x91,0x6D,0x0D,0x97,0xB7,0x8D,0x44,0x23,0xB9,0x49,0xAD,0x23,0xA9,0x8B,0xED,0x93,0x33,0x97,0x4C,0xE1,0x6E,0xB1,0x34,0x96,0x18,0xF3,0x58,0xB3,0x9C,0xBF,0x63,0x0F,0x61,0x46,0xC7,0xD1,0x01,0x41,0x0C,0xC8,0x42,0x55,0x6B,0x54,0x71,0x06,0x3B,0xF7,0xD1,0x77,0x65,0xDF,0x16,0xE7,0x63,0x03,0x7B,0x23,0x26,0x28,0xEC,0x94,0xF8,0x9F,0x94,0x04,0x0F,0xE5,0x45,0x99,
		0x4E,0xB5,0x1B,0xBC,0xB9,0xC4,0xB0,0xE2,0x8A,0x3E,0x05,0xA6,0xE3,0x56,0x7D,0x01,0x77,0xAB,0xC2,0xA6,0x72,0x90,0x23,0xD3,0x15,0x8F,0x0F,0xEA,0x7B,0x31,0xDE,0x89,0x31,0xF0,0x1B,0x81,0x6B,0x5F,0xA8,0x13,0xC6,0x62,0x7D,0xFE,0x74,0x14,0x40,0x2A,0x14,0xC2,0xA1,0x1B,0x9C,0xB2,0xD6,0xEF,0x2A,0x6D,0xA5,0xF7,0xA6,0x38,0x8F,0xD4,0x94,0x74,0x30,0x10,0x9E,0xBA,0xA9,0xAB,0x6B,0x61,0x6B,0xFC,0xB2,0x3F,0x87,0x6B,0x19,0x82,0x83,0x70,0xE7,0xD8,0xEA,0x28,0x7B,0xB4,0x29,0x47,0xF4,0x59,0xB3,0x3E,0x4B,0x6A,0x9D,0x54,
		0x0D,0x4E,0x1C,0xD0,0x29,0xB4,0xD1,0xE1,0x19,0x79,0x41,0x73,0xF6,0x57,0x72,0xBE,0x75,0x03,0x94,0xD7,0x58,0xA8,0xC4,0x08,0x71,0xA2,0xE3,0x16,0x31,0xCD,0xC0,0xEE,0x1C,0x21,0x26,0x52,0x55,0x7B,0x00,0x54,0x6D,0xA6,0x44,0xC2,0x4F,0xEA,0x8F,0x04,0x1C,0x3A,0xA2,0xE3,0x5B,0xD7,0x9D,0xE2,0x57,0x30,0x2C,0xF5,0xAE,0x62,0x3B,0xB5,0x49,0x89,0xCB,0x01,0xD1,0x5A,0x38,0xDE,0x97,0x57,0x85,0x91,0x68,0x6B,0xFD,0xEC,0xD3,0x80,0xF0,0x82,0xBF,0x9A };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x63,0xDB,0x7A,0x42,0x67,0x39,0x75,0x39,0x2A,0xC6,0xA4,0xFA,0xE3,0xD7,0x84,0x46,0xB4,0x67,0xC3,0x26 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "63DB7A42673975392AC6A4FAE3D78446B467C326", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "07/14/1997 16:00:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "07/14/2004 16:00:00", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 1675328066, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=SET Root", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=SET Root", x509.GetName ());
	byte[] pubkey = { 0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xD4,0xDC,0x3E,0xBA,0xE1,0x94,0xF7,0xBE,0xCD,0xED,0x21,0x77,0xCF,0xDA,0x88,0x58,0x51,0x0E,0x8F,0xF4,0xDA,0x00,0x14,0x1E,0x0D,0xA7,0xAD,0xB6,0x96,0x5A,0xC6,0xD3,0xEC,0x25,0xED,0xD8,0x43,0x0B,0x6E,0x7F,0x3F,0x9E,0x1E,0x74,0xA0,0x1E,0x97,0x76,0x30,0xCA,0x6F,0x0A,0x63,0xC0,0xA3,0x31,0x40,0x25,0x80,0xB8,0xBD,0x28,0xEB,0x7D,0x75,0x0B,0x4E,0x41,0x34,0xC4,0x20,0x00,0xC2,0xCB,0xF4,0x9A,0x20,0x00,0x58,0xD9,0xF4,0x40,0x13,0x18,0x77,0x0C,0xB5,0x04,0xDE,0xB7,0xB6,0x43,
		0x8B,0xA4,0xCC,0x36,0x76,0x79,0xC5,0x0B,0x17,0xCB,0x7E,0x88,0xA1,0x33,0xB0,0xD3,0x34,0x27,0xBF,0x3B,0x61,0xDA,0xC5,0x20,0xEB,0xF9,0x94,0x9A,0x8B,0x79,0xB2,0xA8,0x8E,0xCB,0xC1,0xD9,0x94,0x4A,0x99,0x66,0x50,0x55,0xB2,0x83,0x28,0x7D,0x22,0x3D,0xEC,0xDC,0xA3,0xE8,0x39,0xDB,0x83,0x54,0xC9,0x89,0xA9,0xDF,0x59,0x52,0x9F,0x7A,0xEF,0x7C,0x11,0x62,0x52,0xEC,0xE6,0x67,0xBA,0x3D,0xEA,0xAB,0x47,0xDB,0xE4,0xF4,0x1F,0x73,0xC3,0x3D,0xEC,0x7E,0x84,0x7D,0x2F,0x29,0xFE,0x6C,0x17,0x3F,0x75,0x6D,0x56,0x6E,0xC0,0x4E,
		0xB5,0xBF,0x2A,0x20,0x8A,0xE4,0x57,0xAE,0xC0,0x2E,0x68,0xC9,0x09,0xCF,0x85,0x77,0x0A,0xEF,0x3A,0x37,0xCB,0x60,0x4C,0x45,0x73,0x7F,0x90,0x3E,0x86,0x1D,0xFA,0xC3,0xFC,0x50,0x8A,0xB2,0xC5,0x8A,0x34,0xF0,0xF2,0x43,0xEE,0x3C,0x56,0xBA,0x24,0xE9,0xE0,0xA5,0x87,0x1E,0x7C,0x30,0x33,0x77,0xFD,0x5D,0xE0,0x57,0x0D,0x6C,0x19,0x39,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "3082010A0282010100D4DC3EBAE194F7BECDED2177CFDA8858510E8FF4DA00141E0DA7ADB6965AC6D3EC25EDD8430B6E7F3F9E1E74A01E977630CA6F0A63C0A331402580B8BD28EB7D750B4E4134C42000C2CBF49A200058D9F4401318770CB504DEB7B6438BA4CC367679C50B17CB7E88A133B0D33427BF3B61DAC520EBF9949A8B79B2A88ECBC1D9944A99665055B283287D223DECDCA3E839DB8354C989A9DF59529F7AEF7C116252ECE667BA3DEAAB47DBE4F41F73C33DEC7E847D2F29FE6C173F756D566EC04EB5BF2A208AE457AEC02E68C909CF85770AEF3A37CB604C45737F903E861DFAC3FC508AB2C58A34F0F243EE3C56BA24E9E0A5871E7C303377FD5DE0570D6C19390203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x6A };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "6A", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x53,0x45,0x54,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,
		0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x36,0x41,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,
		0x31,0x30,0x41,0x30,0x32,0x38,0x32,0x30,0x31,0x30,0x31,0x30,0x30,0x44,0x34,0x44,0x43,0x33,0x45,0x42,0x41,0x45,0x31,0x39,0x34,0x46,0x37,0x42,0x45,0x43,0x44,0x45,0x44,0x32,0x31,0x37,0x37,0x43,0x46,0x44,0x41,0x38,0x38,0x35,0x38,0x35,0x31,0x30,0x45,0x38,0x46,0x46,0x34,0x44,0x41,0x30,0x30,0x31,0x34,0x31,0x45,0x30,0x44,0x41,0x37,0x41,0x44,0x42,0x36,0x39,0x36,0x35,0x41,0x43,0x36,0x44,0x33,0x45,0x43,0x32,0x35,0x45,0x44,0x44,0x38,0x34,0x33,0x30,0x42,0x36,0x45,0x37,0x46,0x33,0x46,0x39,0x45,0x31,0x45,0x37,
		0x34,0x41,0x30,0x31,0x45,0x39,0x37,0x37,0x36,0x33,0x30,0x43,0x41,0x36,0x46,0x30,0x41,0x36,0x33,0x43,0x30,0x41,0x33,0x33,0x31,0x34,0x30,0x32,0x35,0x38,0x30,0x42,0x38,0x42,0x44,0x32,0x38,0x45,0x42,0x37,0x44,0x37,0x35,0x30,0x42,0x34,0x45,0x34,0x31,0x33,0x34,0x43,0x34,0x32,0x30,0x30,0x30,0x43,0x32,0x43,0x42,0x46,0x34,0x39,0x41,0x32,0x30,0x30,0x30,0x35,0x38,0x44,0x39,0x46,0x34,0x34,0x30,0x31,0x33,0x31,0x38,0x37,0x37,0x30,0x43,0x42,0x35,0x30,0x34,0x44,0x45,0x42,0x37,0x42,0x36,0x34,0x33,0x38,0x42,0x41,
		0x34,0x43,0x43,0x33,0x36,0x37,0x36,0x37,0x39,0x43,0x35,0x30,0x42,0x31,0x37,0x43,0x42,0x37,0x45,0x38,0x38,0x41,0x31,0x33,0x33,0x42,0x30,0x44,0x33,0x33,0x34,0x32,0x37,0x42,0x46,0x33,0x42,0x36,0x31,0x44,0x41,0x43,0x35,0x32,0x30,0x45,0x42,0x46,0x39,0x39,0x34,0x39,0x41,0x38,0x42,0x37,0x39,0x42,0x32,0x41,0x38,0x38,0x45,0x43,0x42,0x43,0x31,0x44,0x39,0x39,0x34,0x34,0x41,0x39,0x39,0x36,0x36,0x35,0x30,0x35,0x35,0x42,0x32,0x38,0x33,0x32,0x38,0x37,0x44,0x32,0x32,0x33,0x44,0x45,0x43,0x44,0x43,0x41,0x33,0x45,
		0x38,0x33,0x39,0x44,0x42,0x38,0x33,0x35,0x34,0x43,0x39,0x38,0x39,0x41,0x39,0x44,0x46,0x35,0x39,0x35,0x32,0x39,0x46,0x37,0x41,0x45,0x46,0x37,0x43,0x31,0x31,0x36,0x32,0x35,0x32,0x45,0x43,0x45,0x36,0x36,0x37,0x42,0x41,0x33,0x44,0x45,0x41,0x41,0x42,0x34,0x37,0x44,0x42,0x45,0x34,0x46,0x34,0x31,0x46,0x37,0x33,0x43,0x33,0x33,0x44,0x45,0x43,0x37,0x45,0x38,0x34,0x37,0x44,0x32,0x46,0x32,0x39,0x46,0x45,0x36,0x43,0x31,0x37,0x33,0x46,0x37,0x35,0x36,0x44,0x35,0x36,0x36,0x45,0x43,0x30,0x34,0x45,0x42,0x35,0x42,
		0x46,0x32,0x41,0x32,0x30,0x38,0x41,0x45,0x34,0x35,0x37,0x41,0x45,0x43,0x30,0x32,0x45,0x36,0x38,0x43,0x39,0x30,0x39,0x43,0x46,0x38,0x35,0x37,0x37,0x30,0x41,0x45,0x46,0x33,0x41,0x33,0x37,0x43,0x42,0x36,0x30,0x34,0x43,0x34,0x35,0x37,0x33,0x37,0x46,0x39,0x30,0x33,0x45,0x38,0x36,0x31,0x44,0x46,0x41,0x43,0x33,0x46,0x43,0x35,0x30,0x38,0x41,0x42,0x32,0x43,0x35,0x38,0x41,0x33,0x34,0x46,0x30,0x46,0x32,0x34,0x33,0x45,0x45,0x33,0x43,0x35,0x36,0x42,0x41,0x32,0x34,0x45,0x39,0x45,0x30,0x41,0x35,0x38,0x37,0x31,
		0x45,0x37,0x43,0x33,0x30,0x33,0x33,0x37,0x37,0x46,0x44,0x35,0x44,0x45,0x30,0x35,0x37,0x30,0x44,0x36,0x43,0x31,0x39,0x33,0x39,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
public void Certificate6 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xDF,0x30,0x82,0x01,0x48,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x31,0x31,0x38,0x32,0x31,0x30,0x33,0x35,0x32,
		0x5A,0x17,0x0D,0x30,0x31,0x30,0x31,0x31,0x36,0x32,0x31,0x30,0x33,0x35,0x32,0x5A,0x30,0x39,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x0D,0x30,0x0B,0x06,0x03,0x55,0x04,0x0A,0x14,0x04,0x41,0x54,0x26,0x54,0x31,0x1B,0x30,0x19,0x06,0x03,0x55,0x04,0x0B,0x14,0x12,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x30,0x81,0x9D,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8B,0x00,0x30,0x81,0x87,
		0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,0xB8,0xA4,
		0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x38,0x50,0x1D,0x0A,0xD3,0x1B,0xBB,0xA2,0x9F,0x6C,0x8D,0x10,0xAA,0x42,0x1B,0x05,0x8D,0xE4,0x25,0xAB,0xFB,0x55,0xAE,0x6D,0xBA,0x53,0x67,0x15,0x07,0x9A,0xEC,0x55,0x9F,0x72,0x89,0x5F,0x24,0xB0,0xDB,0xCA,0x64,0xBD,0x64,0xAA,0xC2,0x8C,
		0xD9,0x3D,0xA2,0x45,0xB7,0xC6,0x92,0x71,0x51,0xEF,0xED,0xE1,0x51,0x54,0x97,0x56,0x35,0xA1,0xCE,0xE4,0x44,0xC4,0x47,0x66,0xFF,0x91,0xDA,0x88,0x9C,0x23,0xC2,0xB3,0xD4,0x62,0x4A,0xBC,0x94,0x55,0x9C,0x80,0x8E,0xB3,0xDD,0x4F,0x1A,0xED,0x12,0x5A,0xB5,0x2E,0xBC,0xF8,0x4B,0xCE,0xC6,0xD4,0x70,0xB3,0xB3,0x22,0xF8,0x5E,0x5C,0x36,0x7A,0xA6,0xB8,0x39,0x73,0x46,0x43,0x5C,0x9B,0x9A,0xBD,0x1E,0x7E,0xA7,0x04,0xCF,0x25,0x35 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x95,0xD4,0xE2,0xEA,0x34,0x0B,0xBF,0x33,0x27,0x1C,0x1F,0xBA,0x8B,0x52,0x9F,0x17,0x72,0x1F,0x8A,0x99 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "95D4E2EA340BBF33271C1FBA8B529F17721F8A99", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "01/18/1996 13:03:52", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "01/16/2001 13:03:52", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", -1781210390, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=AT&T, OU=Directory Services", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, O=AT&T, OU=Directory Services", x509.GetName ());
	byte[] pubkey = { 0x30,0x81,0x87,0x02,0x81,0x81,0x00,0x87,0x64,0x72,0x89,0x0B,0x20,0x8F,0x87,0x27,0xAC,0xC6,0x22,0xFE,0x00,0x40,0x69,0x48,0xAF,0xC6,0x86,0xCD,0x23,0x33,0xE3,0x11,0xC5,0x31,0x1A,0x1F,0x7E,0x9E,0x92,0x13,0xB6,0xA2,0xAC,0xE3,0xB0,0x1F,0x2A,0x07,0x6C,0xB6,0xD4,0xDE,0x4B,0xFA,0xF1,0xA2,0xA0,0x7D,0xCE,0x4B,0xBE,0xBE,0x26,0x48,0x09,0x8C,0x85,0x11,0xDE,0xCB,0x22,0xE7,0xC2,0xEE,0x44,0x51,0xFE,0x67,0xD5,0x5B,0x5A,0xE0,0x16,0x37,0x54,0x04,0xB8,0x3B,0x32,0x12,0x94,0x83,0x9E,0xB1,0x4D,0x80,0x6C,0xA4,0xA9,0x76,0xAC,
		0xB8,0xA4,0x97,0xF7,0xAB,0x0B,0x6C,0xA5,0x43,0xBA,0x6E,0x4F,0xC5,0x4E,0x00,0x30,0x16,0x3C,0x3F,0x99,0x14,0xDA,0xA2,0x20,0x08,0x8B,0xBA,0xED,0x76,0xAC,0x97,0x00,0xD5,0x6D,0x02,0x01,0x0F };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "30818702818100876472890B208F8727ACC622FE00406948AFC686CD2333E311C5311A1F7E9E9213B6A2ACE3B01F2A076CB6D4DE4BFAF1A2A07DCE4BBEBE2648098C8511DECB22E7C2EE4451FE67D55B5AE016375404B83B321294839EB14D806CA4A976ACB8A497F7AB0B6CA543BA6E4FC54E0030163C3F9914DAA220088BBAED76AC9700D56D02010F", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x00 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "00", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x41,0x54,0x26,0x54,
		0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x72,0x65,0x63,0x74,0x6F,0x72,0x79,0x20,0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,
		0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x37,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x38,0x37,0x36,0x34,0x37,0x32,0x38,0x39,0x30,0x42,0x32,0x30,0x38,0x46,0x38,0x37,0x32,0x37,0x41,0x43,0x43,0x36,0x32,0x32,0x46,0x45,0x30,0x30,0x34,0x30,0x36,0x39,0x34,0x38,0x41,0x46,0x43,0x36,0x38,0x36,0x43,0x44,0x32,0x33,0x33,0x33,0x45,0x33,0x31,0x31,0x43,0x35,0x33,
		0x31,0x31,0x41,0x31,0x46,0x37,0x45,0x39,0x45,0x39,0x32,0x31,0x33,0x42,0x36,0x41,0x32,0x41,0x43,0x45,0x33,0x42,0x30,0x31,0x46,0x32,0x41,0x30,0x37,0x36,0x43,0x42,0x36,0x44,0x34,0x44,0x45,0x34,0x42,0x46,0x41,0x46,0x31,0x41,0x32,0x41,0x30,0x37,0x44,0x43,0x45,0x34,0x42,0x42,0x45,0x42,0x45,0x32,0x36,0x34,0x38,0x30,0x39,0x38,0x43,0x38,0x35,0x31,0x31,0x44,0x45,0x43,0x42,0x32,0x32,0x45,0x37,0x43,0x32,0x45,0x45,0x34,0x34,0x35,0x31,0x46,0x45,0x36,0x37,0x44,0x35,0x35,0x42,0x35,0x41,0x45,0x30,0x31,0x36,0x33,
		0x37,0x35,0x34,0x30,0x34,0x42,0x38,0x33,0x42,0x33,0x32,0x31,0x32,0x39,0x34,0x38,0x33,0x39,0x45,0x42,0x31,0x34,0x44,0x38,0x30,0x36,0x43,0x41,0x34,0x41,0x39,0x37,0x36,0x41,0x43,0x42,0x38,0x41,0x34,0x39,0x37,0x46,0x37,0x41,0x42,0x30,0x42,0x36,0x43,0x41,0x35,0x34,0x33,0x42,0x41,0x36,0x45,0x34,0x46,0x43,0x35,0x34,0x45,0x30,0x30,0x33,0x30,0x31,0x36,0x33,0x43,0x33,0x46,0x39,0x39,0x31,0x34,0x44,0x41,0x41,0x32,0x32,0x30,0x30,0x38,0x38,0x42,0x42,0x41,0x45,0x44,0x37,0x36,0x41,0x43,0x39,0x37,0x30,0x30,0x44,
		0x35,0x36,0x44,0x30,0x32,0x30,0x31,0x30,0x46,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
		public void Reset ()
		{
			X509Certificate x = new X509Certificate (cert1);
			Assert.AreEqual ("02720006E8", x.GetSerialNumberString (), "GetSerialNumberString");
			x.Reset ();
			Assert.AreEqual ("X509", x.GetFormat (), "GetFormat");
			Assert.AreEqual (0, x.GetHashCode (), "GetHashCode");
			Assert.AreEqual (IntPtr.Zero, x.Handle, "Handle");
			Assert.AreEqual ("System.Security.Cryptography.X509Certificates.X509Certificate", x.ToString (true), "ToString(true)");
			Assert.AreEqual ("System.Security.Cryptography.X509Certificates.X509Certificate", x.ToString (false), "ToString(false)");
		}
public void Certificate9 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x09,0xB9,0x30,0x82,0x09,0x22,0xA0,0x03,0x02,0x01,0x02,0x02,0x10,0x20,0x0B,0x35,0x5E,0xCE,0xC4,0xB0,0x63,0xB7,0xDE,0xC6,0x34,0xB9,0x70,0x34,0x44,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x62,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,
		0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x38,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5A,0x17,0x0D,0x39,0x37,0x30,0x38,0x32,0x30,0x32,0x33,0x35,0x39,0x35,0x39,0x5A,0x30,0x82,0x01,0x0A,0x31,0x11,0x30,0x0F,0x06,0x03,0x55,0x04,0x07,0x13,0x08,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,
		0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0A,0x13,0x0E,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x34,0x30,0x32,0x06,0x03,0x55,0x04,0x0B,0x13,0x2B,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x31,0x46,0x30,0x44,0x06,0x03,0x55,0x04,0x0B,0x13,0x3D,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,
		0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x31,0x26,0x30,0x24,0x06,0x03,0x55,0x04,0x0B,0x13,0x1D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x03,
		0x13,0x0D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x31,0x1E,0x30,0x1C,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,0x16,0x0F,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x30,0x5C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x4B,0x00,0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,
		0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,0x07,0x08,0x30,0x82,0x07,0x04,0x30,0x09,0x06,0x03,0x55,0x1D,0x13,0x04,0x02,0x30,0x00,0x30,0x82,0x02,0x1F,0x06,0x03,0x55,0x1D,0x03,0x04,0x82,0x02,0x16,0x30,0x82,0x02,0x12,0x30,0x82,0x02,0x0E,0x30,0x82,0x02,0x0A,0x06,0x0B,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x30,0x82,
		0x01,0xF9,0x16,0x82,0x01,0xA7,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,
		0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x20,0x61,0x74,0x3A,0x20,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x43,0x50,0x53,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x43,0x50,0x53,0x2D,
		0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x20,0x54,0x65,
		0x6C,0x2E,0x20,0x2B,0x31,0x20,0x28,0x34,0x31,0x35,0x29,0x20,0x39,0x36,0x31,0x2D,0x38,0x38,0x33,0x30,0x20,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
		0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x61,0x6E,0x64,0x20,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0xA0,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x01,0xA1,0x0E,0x06,0x0C,0x60,0x86,0x48,0x01,0x86,0xF8,0x45,0x01,0x07,0x01,0x01,0x02,0x30,0x2C,0x30,0x2A,0x16,0x28,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,
		0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x36,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,0x04,0x29,0x16,0x27,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x30,0x82,0x04,0x87,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,0x04,0x82,0x04,
		0x78,0x16,0x82,0x04,0x74,0x43,0x41,0x55,0x54,0x49,0x4F,0x4E,0x3A,0x20,0x54,0x68,0x65,0x20,0x43,0x6F,0x6D,0x6D,0x6F,0x6E,0x20,0x4E,0x61,0x6D,0x65,0x20,0x69,0x6E,0x20,0x74,0x68,0x69,0x73,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x0A,0x49,0x44,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,0x61,0x75,0x74,0x68,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2E,0x20,0x49,0x74,0x20,0x6D,0x61,0x79,0x20,0x62,
		0x65,0x20,0x74,0x68,0x65,0x0A,0x68,0x6F,0x6C,0x64,0x65,0x72,0x27,0x73,0x20,0x72,0x65,0x61,0x6C,0x20,0x6E,0x61,0x6D,0x65,0x20,0x6F,0x72,0x20,0x61,0x6E,0x20,0x61,0x6C,0x69,0x61,0x73,0x2E,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x64,0x6F,0x65,0x73,0x20,0x61,0x75,0x74,0x68,0x2D,0x0A,0x65,0x6E,0x74,0x69,0x63,0x61,0x74,0x65,0x20,0x74,0x68,0x65,0x20,0x65,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x64,0x64,0x72,0x65,0x73,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x68,0x6F,0x6C,0x64,0x65,0x72,0x2E,
		0x0A,0x0A,0x54,0x68,0x69,0x73,0x20,0x63,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x65,0x20,0x69,0x6E,0x63,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x65,0x73,0x20,0x62,0x79,0x20,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x2C,0x20,0x61,0x6E,0x64,0x20,0x0A,0x69,0x74,0x73,0x20,0x75,0x73,0x65,0x20,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x63,0x74,0x6C,0x79,0x20,0x73,0x75,0x62,0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x2C,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x0A,0x43,0x65,0x72,
		0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x50,0x72,0x61,0x63,0x74,0x69,0x63,0x65,0x20,0x53,0x74,0x61,0x74,0x65,0x6D,0x65,0x6E,0x74,0x20,0x28,0x43,0x50,0x53,0x29,0x2C,0x20,0x61,0x76,0x61,0x69,0x6C,0x61,0x62,0x6C,0x65,0x0A,0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x20,0x61,0x74,0x3A,0x20,0x0A,0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,
		0x63,0x6F,0x6D,0x3B,0x20,0x62,0x79,0x20,0x45,0x2D,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x0A,0x43,0x50,0x53,0x2D,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x73,0x40,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x3B,0x20,0x6F,0x72,0x20,0x62,0x79,0x20,0x6D,0x61,0x69,0x6C,0x20,0x61,0x74,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x0A,0x49,0x6E,0x63,0x2E,0x2C,0x20,0x32,0x35,0x39,0x33,0x20,0x43,0x6F,0x61,0x73,0x74,0x20,0x41,0x76,0x65,0x2E,0x2C,0x20,0x4D,0x6F,0x75,0x6E,0x74,0x61,0x69,0x6E,
		0x20,0x56,0x69,0x65,0x77,0x2C,0x20,0x43,0x41,0x20,0x39,0x34,0x30,0x34,0x33,0x20,0x55,0x53,0x41,0x0A,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x31,0x39,0x39,0x36,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x20,0x20,0x41,0x6C,0x6C,0x20,0x52,0x69,0x67,0x68,0x74,0x73,0x20,0x0A,0x52,0x65,0x73,0x65,0x72,0x76,0x65,0x64,0x2E,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x20,0x44,0x49,0x53,0x43,
		0x4C,0x41,0x49,0x4D,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x0A,0x4C,0x49,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4C,0x49,0x4D,0x49,0x54,0x45,0x44,0x2E,0x0A,0x0A,0x57,0x41,0x52,0x4E,0x49,0x4E,0x47,0x3A,0x20,0x54,0x48,0x45,0x20,0x55,0x53,0x45,0x20,0x4F,0x46,0x20,0x54,0x48,0x49,0x53,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x20,0x49,0x53,0x20,0x53,0x54,0x52,0x49,0x43,0x54,0x4C,0x59,0x0A,0x53,0x55,0x42,0x4A,0x45,0x43,0x54,0x20,0x54,0x4F,0x20,0x54,0x48,0x45,0x20,0x56,0x45,0x52,0x49,
		0x53,0x49,0x47,0x4E,0x20,0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4F,0x4E,0x20,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x0A,0x53,0x54,0x41,0x54,0x45,0x4D,0x45,0x4E,0x54,0x2E,0x20,0x20,0x54,0x48,0x45,0x20,0x49,0x53,0x53,0x55,0x49,0x4E,0x47,0x20,0x41,0x55,0x54,0x48,0x4F,0x52,0x49,0x54,0x59,0x20,0x44,0x49,0x53,0x43,0x4C,0x41,0x49,0x4D,0x53,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x0A,0x49,0x4D,0x50,0x4C,0x49,0x45,0x44,0x20,0x41,0x4E,0x44,0x20,0x45,0x58,0x50,0x52,0x45,0x53,0x53,0x20,
		0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x2C,0x20,0x49,0x4E,0x43,0x4C,0x55,0x44,0x49,0x4E,0x47,0x20,0x57,0x41,0x52,0x52,0x41,0x4E,0x54,0x49,0x45,0x53,0x0A,0x4F,0x46,0x20,0x4D,0x45,0x52,0x43,0x48,0x41,0x4E,0x54,0x41,0x42,0x49,0x4C,0x49,0x54,0x59,0x20,0x4F,0x52,0x20,0x46,0x49,0x54,0x4E,0x45,0x53,0x53,0x20,0x46,0x4F,0x52,0x20,0x41,0x20,0x50,0x41,0x52,0x54,0x49,0x43,0x55,0x4C,0x41,0x52,0x0A,0x50,0x55,0x52,0x50,0x4F,0x53,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x57,0x49,0x4C,0x4C,0x20,0x4E,0x4F,
		0x54,0x20,0x42,0x45,0x20,0x4C,0x49,0x41,0x42,0x4C,0x45,0x20,0x46,0x4F,0x52,0x20,0x43,0x4F,0x4E,0x53,0x45,0x51,0x55,0x45,0x4E,0x54,0x49,0x41,0x4C,0x2C,0x0A,0x50,0x55,0x4E,0x49,0x54,0x49,0x56,0x45,0x2C,0x20,0x41,0x4E,0x44,0x20,0x43,0x45,0x52,0x54,0x41,0x49,0x4E,0x20,0x4F,0x54,0x48,0x45,0x52,0x20,0x44,0x41,0x4D,0x41,0x47,0x45,0x53,0x2E,0x20,0x53,0x45,0x45,0x20,0x54,0x48,0x45,0x20,0x43,0x50,0x53,0x0A,0x46,0x4F,0x52,0x20,0x44,0x45,0x54,0x41,0x49,0x4C,0x53,0x2E,0x0A,0x0A,0x43,0x6F,0x6E,0x74,0x65,0x6E,
		0x74,0x73,0x20,0x6F,0x66,0x20,0x74,0x68,0x65,0x20,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x65,0x64,0x0A,0x6E,0x6F,0x6E,0x76,0x65,0x72,0x69,0x66,0x69,0x65,0x64,0x53,0x75,0x62,0x6A,0x65,0x63,0x74,0x41,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x73,0x20,0x65,0x78,0x74,0x65,0x6E,0x73,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x75,0x65,0x20,0x73,0x68,0x61,0x6C,0x6C,0x20,0x0A,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x63,0x6F,0x6E,0x73,0x69,0x64,0x65,0x72,0x65,0x64,0x20,
		0x61,0x73,0x20,0x61,0x63,0x63,0x75,0x72,0x61,0x74,0x65,0x20,0x69,0x6E,0x66,0x6F,0x72,0x6D,0x61,0x74,0x69,0x6F,0x6E,0x20,0x76,0x61,0x6C,0x69,0x64,0x61,0x74,0x65,0x64,0x20,0x0A,0x62,0x79,0x20,0x74,0x68,0x65,0x20,0x49,0x41,0x2E,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x2B,0x3D,0x44,0xC7,0x32,0x59,0xAE,0xF1,0x5F,0x8F,0x3F,0x87,0xE3,0x3E,0xEB,0x81,0x30,0xF8,0xA9,0x96,0xDB,0x01,0x42,0x0B,0x04,0xEF,0x37,0x02,0x3F,0xD4,0x20,0x61,0x58,0xC4,0x4A,0x3A,
		0x39,0xB3,0xFB,0xD9,0xF8,0xA5,0xC4,0x5E,0x33,0x5A,0x0E,0xFA,0x93,0x56,0x2F,0x6F,0xD6,0x61,0xA2,0xAF,0xA5,0x0C,0x1D,0xE2,0x41,0x65,0xF3,0x40,0x75,0x66,0x83,0xD2,0x5A,0xB4,0xB7,0x56,0x0B,0x8E,0x0D,0xA1,0x33,0x13,0x7D,0x49,0xC3,0xB1,0x00,0x68,0x83,0x7F,0xB5,0x66,0xD4,0x32,0x32,0xFE,0x8B,0x9A,0x5A,0xD6,0x01,0x72,0x31,0x5D,0x85,0x91,0xBC,0x93,0x9B,0x65,0x60,0x25,0xC6,0x1F,0xBC,0xDD,0x69,0x44,0x62,0xC2,0xB2,0x6F,0x46,0xAB,0x2F,0x20,0xA5,0x6F,0xDA,0x48,0x6C,0x9C };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x52,0xD1,0x84,0x8F,0x6A,0x16,0x1B,0xA5,0xC6,0xC1,0x90,0x07,0xF8,0x16,0x46,0x68,0xF5,0xA3,0xB2,0xCF };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "52D1848F6A161BA5C6C19007F8164668F5A3B2CF", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "08/20/1996 16:00:00", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "08/20/1997 15:59:59", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 1389462671, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "L=Internet, O=\"VeriSign, Inc.\", OU=VeriSign Class 1 CA - Individual Subscriber, OU=\"www.verisign.com/repository/CPS Incorp. by Ref.,LIAB.LTD(c)96\", OU=Digital ID Class 1 - Netscape, CN=David T. Gray, [email protected]", x509.GetName ());
	byte[] pubkey = { 0x30,0x48,0x02,0x41,0x00,0xC5,0x81,0x07,0xA2,0xEB,0x0F,0xB8,0xFF,0xF8,0xF8,0x1C,0xEE,0x32,0xFF,0xBF,0x12,0x35,0x6A,0xF9,0x6B,0xC8,0xBE,0x2F,0xFB,0x3E,0xAF,0x04,0x51,0x4A,0xAC,0xDD,0x10,0x29,0xA8,0xCD,0x40,0x5B,0x66,0x1E,0x98,0xEF,0xF2,0x4C,0x77,0xFA,0x8F,0x86,0xD1,0x21,0x67,0x92,0x44,0x4A,0xC4,0x89,0xC9,0x83,0xCF,0x88,0x9F,0x6F,0xE2,0x32,0x35,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "3048024100C58107A2EB0FB8FFF8F81CEE32FFBF12356AF96BC8BE2FFB3EAF04514AACDD1029A8CD405B661E98EFF24C77FA8F86D1216792444AC489C983CF889F6FE232350203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x44,0x34,0x70,0xB9,0x34,0xC6,0xDE,0xB7,0x63,0xB0,0xC4,0xCE,0x5E,0x35,0x0B,0x20 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "443470B934C6DEB763B0C4CE5E350B20", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,
		0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x2C,0x20,0x4F,0x55,0x3D,0x22,0x77,0x77,0x77,0x2E,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6E,0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x65,0x70,0x6F,0x73,0x69,0x74,0x6F,0x72,0x79,0x2F,0x43,0x50,0x53,0x20,0x49,0x6E,0x63,0x6F,0x72,0x70,0x2E,0x20,0x62,0x79,0x20,0x52,0x65,0x66,0x2E,0x2C,0x4C,0x49,0x41,0x42,0x2E,0x4C,0x54,0x44,0x28,0x63,0x29,0x39,0x36,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x44,0x69,0x67,0x69,0x74,0x61,0x6C,0x20,0x49,0x44,0x20,0x43,
		0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x2D,0x20,0x4E,0x65,0x74,0x73,0x63,0x61,0x70,0x65,0x2C,0x20,0x43,0x4E,0x3D,0x44,0x61,0x76,0x69,0x64,0x20,0x54,0x2E,0x20,0x47,0x72,0x61,0x79,0x2C,0x20,0x45,0x3D,0x64,0x61,0x76,0x69,0x64,0x40,0x66,0x6F,0x72,0x6D,0x61,0x6C,0x2E,0x69,0x65,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x4C,0x3D,0x49,0x6E,0x74,0x65,0x72,0x6E,0x65,0x74,0x2C,0x20,0x4F,0x3D,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,
		0x2C,0x20,0x4F,0x55,0x3D,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6E,0x20,0x43,0x6C,0x61,0x73,0x73,0x20,0x31,0x20,0x43,0x41,0x20,0x2D,0x20,0x49,0x6E,0x64,0x69,0x76,0x69,0x64,0x75,0x61,0x6C,0x20,0x53,0x75,0x62,0x73,0x63,0x72,0x69,0x62,0x65,0x72,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,
		0x62,0x65,0x72,0x3A,0x20,0x20,0x34,0x34,0x33,0x34,0x37,0x30,0x42,0x39,0x33,0x34,0x43,0x36,0x44,0x45,0x42,0x37,0x36,0x33,0x42,0x30,0x43,0x34,0x43,0x45,0x35,0x45,0x33,0x35,0x30,0x42,0x32,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x34,0x38,0x30,0x32,0x34,0x31,0x30,0x30,0x43,0x35,
		0x38,0x31,0x30,0x37,0x41,0x32,0x45,0x42,0x30,0x46,0x42,0x38,0x46,0x46,0x46,0x38,0x46,0x38,0x31,0x43,0x45,0x45,0x33,0x32,0x46,0x46,0x42,0x46,0x31,0x32,0x33,0x35,0x36,0x41,0x46,0x39,0x36,0x42,0x43,0x38,0x42,0x45,0x32,0x46,0x46,0x42,0x33,0x45,0x41,0x46,0x30,0x34,0x35,0x31,0x34,0x41,0x41,0x43,0x44,0x44,0x31,0x30,0x32,0x39,0x41,0x38,0x43,0x44,0x34,0x30,0x35,0x42,0x36,0x36,0x31,0x45,0x39,0x38,0x45,0x46,0x46,0x32,0x34,0x43,0x37,0x37,0x46,0x41,0x38,0x46,0x38,0x36,0x44,0x31,0x32,0x31,0x36,0x37,0x39,0x32,
		0x34,0x34,0x34,0x41,0x43,0x34,0x38,0x39,0x43,0x39,0x38,0x33,0x43,0x46,0x38,0x38,0x39,0x46,0x36,0x46,0x45,0x32,0x33,0x32,0x33,0x35,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
Ejemplo n.º 24
0
public void Certificate11 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xF5,0x30,0x82,0x01,0x5E,0x02,0x01,0x00,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x1A,0x17,0x0B,
		0x39,0x36,0x30,0x32,0x32,0x33,0x31,0x39,0x31,0x35,0x5A,0x17,0x0B,0x39,0x39,0x31,0x32,0x33,0x31,0x32,0x33,0x35,0x39,0x5A,0x30,0x45,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x18,0x30,0x16,0x06,0x03,0x55,0x04,0x0A,0x13,0x0F,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x1C,0x30,0x1A,0x06,0x03,0x55,0x04,0x03,0x13,0x13,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x30,0x81,0x9F,0x30,0x0D,
		0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8D,0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,
		0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,0x05,0x00,0x03,0x81,0x81,0x00,0x34,0x9B,0x09,0x05,0x9D,0x42,0x48,0x7F,0x7C,0x24,0x8E,0xC2,0x88,0x65,0x78,0x6B,0x4D,0x2A,0x0E,0xAF,0xED,0xED,0xF0,0x6A,
		0x2D,0x37,0xEB,0x57,0x51,0x0E,0x8A,0xAD,0x2D,0x13,0x02,0xA1,0x40,0x6A,0x41,0xF6,0x69,0x72,0xBF,0x0F,0xA0,0x4E,0x55,0xE7,0x82,0xA6,0x57,0x91,0x8B,0x5D,0x43,0x08,0xC9,0xF8,0x71,0x07,0x82,0xE3,0x3E,0x14,0x01,0x24,0x0C,0x39,0xEB,0x61,0x22,0xF7,0xA2,0x0B,0x42,0x23,0x14,0xCA,0x10,0x18,0x36,0x0A,0x05,0xD1,0xC8,0x4A,0xF1,0x0E,0xB3,0xFD,0x00,0xD0,0xC6,0xEE,0x55,0xF2,0x4C,0x62,0xB4,0x19,0x73,0x1F,0x48,0x18,0xD8,0xB0,0x4E,0xB0,0x75,0xBC,0xB9,0x84,0x8B,0x1F,0x96,0x8A,0x83,0xF1,0xA0,0x1A,0xA2,0xED,0xFF,0x87,
		0x8C,0xA3,0x4F,0xA2 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assert.IsTrue (x509.Equals (clone), "Equals");
	Assert.IsTrue (clone.Equals (x509), "Equals");

	FileStream fs = File.OpenWrite (temp_certificate_filename);
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile (temp_certificate_filename);
	Assert.IsTrue (disk.Equals (clone), "Equals");
	Assert.IsTrue (disk.Equals (x509), "Equals");
	byte[] hash = { 0xA2,0x75,0xE0,0x26,0xAC,0xD8,0x54,0x79,0x4A,0x4A,0xA2,0xCB,0x53,0xF6,0x62,0x33,0x12,0x9C,0x55,0xB6 };
	Assert.AreEqual (hash, x509.GetCertHash (), "GetCertHash");
	Assert.AreEqual ("A275E026ACD854794A4AA2CB53F66233129C55B6", x509.GetCertHashString (), "GetCertHashString");
#if NET_2_0
	DateTime from = DateTime.ParseExact (x509.GetEffectiveDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("02/23/1996 19:15:00", from.ToString (), "GetEffectiveDateString");
	DateTime until = DateTime.ParseExact (x509.GetExpirationDateString (), "MM/dd/yyyy HH:mm:ss", null).ToUniversalTime ();
	Assert.AreEqual ("12/31/1999 23:59:00", until.ToString (), "GetExpirationDateString");
#else
	// fx 1.x has a bug where the returned dates were always in the Seattle time zone
	Assert.AreEqual ("02/23/1996 11:15:00", x509.GetEffectiveDateString (), "GetEffectiveDateString");
	Assert.AreEqual ("12/31/1999 15:59:00", x509.GetExpirationDateString (), "GetExpirationDateString");
	// which was making it easier to test the dates ;-)
#endif
	Assert.AreEqual ("X509", x509.GetFormat (), "GetFormat");
	Assert.AreEqual (-1569333210, x509.GetHashCode (), "GetHashCode");
	Assert.AreEqual ("C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetIssuerName (), "GetIssuerName");
	Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
	byte[] keyparams = { 0x05,0x00 };
	Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
	Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
	Assert.AreEqual ("C=US, O=GTE Corporation, CN=GTE CyberTrust Root", x509.GetName (), "GetName");
	byte[] pubkey = { 0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xB8,0xE6,0x4F,0xBA,0xDB,0x98,0x7C,0x71,0x7C,0xAF,0x44,0xB7,0xD3,0x0F,0x46,0xD9,0x64,0xE5,0x93,0xC1,0x42,0x8E,0xC7,0xBA,0x49,0x8D,0x35,0x2D,0x7A,0xE7,0x8B,0xBD,0xE5,0x05,0x31,0x59,0xC6,0xB1,0x2F,0x0A,0x0C,0xFB,0x9F,0xA7,0x3F,0xA2,0x09,0x66,0x84,0x56,0x1E,0x37,0x29,0x1B,0x87,0xE9,0x7E,0x0C,0xCA,0x9A,0x9F,0xA5,0x7F,0xF5,0x15,0x94,0xA3,0xD5,0xA2,0x46,0x82,0xD8,0x68,0x4C,0xD1,0x37,0x15,0x06,0x68,0xAF,0xBD,0xF8,0xB0,0xB3,0xF0,0x29,0xF5,0x95,0x5A,0x09,0x16,0x61,0x77,0x0A,
		0x22,0x25,0xD4,0x4F,0x45,0xAA,0xC7,0xBD,0xE5,0x96,0xDF,0xF9,0xD4,0xA8,0x8E,0x42,0xCC,0x24,0xC0,0x1E,0x91,0x27,0x4A,0xB5,0x6D,0x06,0x80,0x63,0x39,0xC4,0xA2,0x5E,0x38,0x03,0x02,0x03,0x01,0x00,0x01 };
	Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
	Assert.AreEqual ("30818902818100B8E64FBADB987C717CAF44B7D30F46D964E593C1428EC7BA498D352D7AE78BBDE5053159C6B12F0A0CFB9FA73FA2096684561E37291B87E97E0CCA9A9FA57FF51594A3D5A24682D8684CD137150668AFBDF8B0B3F029F5955A091661770A2225D44F45AAC7BDE596DFF9D4A88E42CC24C01E91274AB56D06806339C4A25E38030203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
	Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
	Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
	byte[] serial = { 0x00 };
	Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
	Assert.AreEqual ("00", x509.GetSerialNumberString (), "GetSerialNumberString");
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,
		0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x47,0x54,0x45,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x43,0x4E,0x3D,0x47,0x54,0x45,0x20,0x43,0x79,0x62,0x65,0x72,0x54,0x72,0x75,0x73,0x74,0x20,0x52,0x6F,0x6F,0x74,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,
		0x65,0x72,0x3A,0x20,0x20,0x30,0x30,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x31,0x38,0x39,0x30,0x32,0x38,0x31,0x38,0x31,0x30,0x30,0x42,0x38,0x45,0x36,0x34,0x46,0x42,0x41,0x44,0x42,0x39,0x38,0x37,0x43,0x37,0x31,0x37,0x43,0x41,0x46,0x34,0x34,0x42,0x37,0x44,0x33,0x30,0x46,0x34,
		0x36,0x44,0x39,0x36,0x34,0x45,0x35,0x39,0x33,0x43,0x31,0x34,0x32,0x38,0x45,0x43,0x37,0x42,0x41,0x34,0x39,0x38,0x44,0x33,0x35,0x32,0x44,0x37,0x41,0x45,0x37,0x38,0x42,0x42,0x44,0x45,0x35,0x30,0x35,0x33,0x31,0x35,0x39,0x43,0x36,0x42,0x31,0x32,0x46,0x30,0x41,0x30,0x43,0x46,0x42,0x39,0x46,0x41,0x37,0x33,0x46,0x41,0x32,0x30,0x39,0x36,0x36,0x38,0x34,0x35,0x36,0x31,0x45,0x33,0x37,0x32,0x39,0x31,0x42,0x38,0x37,0x45,0x39,0x37,0x45,0x30,0x43,0x43,0x41,0x39,0x41,0x39,0x46,0x41,0x35,0x37,0x46,0x46,0x35,0x31,
		0x35,0x39,0x34,0x41,0x33,0x44,0x35,0x41,0x32,0x34,0x36,0x38,0x32,0x44,0x38,0x36,0x38,0x34,0x43,0x44,0x31,0x33,0x37,0x31,0x35,0x30,0x36,0x36,0x38,0x41,0x46,0x42,0x44,0x46,0x38,0x42,0x30,0x42,0x33,0x46,0x30,0x32,0x39,0x46,0x35,0x39,0x35,0x35,0x41,0x30,0x39,0x31,0x36,0x36,0x31,0x37,0x37,0x30,0x41,0x32,0x32,0x32,0x35,0x44,0x34,0x34,0x46,0x34,0x35,0x41,0x41,0x43,0x37,0x42,0x44,0x45,0x35,0x39,0x36,0x44,0x46,0x46,0x39,0x44,0x34,0x41,0x38,0x38,0x45,0x34,0x32,0x43,0x43,0x32,0x34,0x43,0x30,0x31,0x45,0x39,
		0x31,0x32,0x37,0x34,0x41,0x42,0x35,0x36,0x44,0x30,0x36,0x38,0x30,0x36,0x33,0x33,0x39,0x43,0x34,0x41,0x32,0x35,0x45,0x33,0x38,0x30,0x33,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assert.AreEqual (tsa, x509.ToString (true), "ToString(true)");
#if NET_2_0
	Assert.AreEqual ("CN=GTE CyberTrust Root, O=GTE Corporation, C=US", x509.Issuer, "Issuer");
	Assert.AreEqual ("CN=GTE CyberTrust Root, O=GTE Corporation, C=US", x509.Subject, "Subject");
#endif
}
public void Certificate1 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
		0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x37,0x5A,0x17,0x0D,0x39,0x37,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x36,0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x31,0x14,0x30,0x12,0x06,0x03,
		0x55,0x04,0x0A,0x13,0x0B,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x70,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x5F,0x00,0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,
		0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x54,0x20,0x67,0x12,0xBB,0x66,0x14,0xC3,0x26,0x6B,0x7F,
		0xDA,0x4A,0x25,0x4D,0x8B,0xE0,0xFD,0x1E,0x53,0x6D,0xAC,0xA2,0xD0,0x89,0xB8,0x2E,0x90,0xA0,0x27,0x43,0xA4,0xEE,0x4A,0x26,0x86,0x40,0xFF,0xB8,0x72,0x8D,0x1E,0xE7,0xB7,0x77,0xDC,0x7D,0xD8,0x3F,0x3A,0x6E,0x55,0x10,0xA6,0x1D,0xB5,0x58,0xF2,0xF9,0x0F,0x2E,0xB4,0x10,0x55,0x48,0xDC,0x13,0x5F,0x0D,0x08,0x26,0x88,0xC9,0xAF,0x66,0xF2,0x2C,0x9C,0x6F,0x3D,0xC3,0x2B,0x69,0x28,0x89,0x40,0x6F,0x8F,0x35,0x3B,0x9E,0xF6,0x8E,0xF1,0x11,0x17,0xFB,0x0C,0x98,0x95,0xA1,0xC2,0xBA,0x89,0x48,0xEB,0xB4,0x06,0x6A,0x22,0x54,
		0xD7,0xBA,0x18,0x3A,0x48,0xA6,0xCB,0xC2,0xFD,0x20,0x57,0xBC,0x63,0x1C };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0xD6,0x2F,0x48,0xD0,0x13,0xEE,0x7F,0xB5,0x8B,0x79,0x07,0x45,0x12,0x67,0x0D,0x9C,0x5B,0x3A,0x5D,0xA9 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "D62F48D013EE7FB58B79074512670D9C5B3A5DA9", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "03/12/1996 10:38:47", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "03/12/1997 10:38:46", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", -701544240, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, O=\"RSA Data Security, Inc.\", OU=Secure Server Certification Authority", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.GetName ());
	byte[] pubkey = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "305C02552D58E9BFF031CD7906505AD59E0E2CE6C2F7F9D2CE556485B1909A92B336C1BCEAC823B7AB3AA76463775F84228EE5B645DD46AE0ADD00C21FBAD9ADC07562F89582A280B18269FAE1AF7FBC7DE27C76D5BC2A80FB0203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "E806007202", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x2C,0x20,0x4F,0x3D,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,
		0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x4F,0x3D,0x22,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x22,0x2C,0x20,0x4F,0x55,0x3D,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x0D,0x0A,0x09,0x4B,
		0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x45,0x38,0x30,0x36,0x30,0x30,0x37,0x32,0x30,0x32,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,
		0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x35,0x43,0x30,0x32,0x35,0x35,0x32,0x44,0x35,0x38,0x45,0x39,0x42,0x46,0x46,0x30,0x33,0x31,0x43,0x44,0x37,0x39,0x30,0x36,0x35,0x30,0x35,0x41,0x44,0x35,0x39,0x45,0x30,0x45,0x32,0x43,0x45,0x36,0x43,0x32,0x46,0x37,0x46,0x39,0x44,0x32,0x43,0x45,0x35,0x35,0x36,0x34,0x38,0x35,0x42,0x31,0x39,0x30,0x39,0x41,0x39,0x32,0x42,0x33,0x33,0x36,0x43,0x31,0x42,0x43,0x45,0x41,0x43,0x38,0x32,0x33,0x42,0x37,0x41,0x42,0x33,0x41,0x41,0x37,
		0x36,0x34,0x36,0x33,0x37,0x37,0x35,0x46,0x38,0x34,0x32,0x32,0x38,0x45,0x45,0x35,0x42,0x36,0x34,0x35,0x44,0x44,0x34,0x36,0x41,0x45,0x30,0x41,0x44,0x44,0x30,0x30,0x43,0x32,0x31,0x46,0x42,0x41,0x44,0x39,0x41,0x44,0x43,0x30,0x37,0x35,0x36,0x32,0x46,0x38,0x39,0x35,0x38,0x32,0x41,0x32,0x38,0x30,0x42,0x31,0x38,0x32,0x36,0x39,0x46,0x41,0x45,0x31,0x41,0x46,0x37,0x46,0x42,0x43,0x37,0x44,0x45,0x32,0x37,0x43,0x37,0x36,0x44,0x35,0x42,0x43,0x32,0x41,0x38,0x30,0x46,0x42,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,
		0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
Ejemplo n.º 26
0
		public void ConstructorIntPtr ()
		{
			byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
				0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x1E,0x17,0x0D,0x39,0x36,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x37,0x5A,0x17,0x0D,0x39,0x37,0x30,0x33,0x31,0x32,0x31,0x38,0x33,0x38,0x34,0x36,0x5A,0x30,0x61,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x43,0x61,0x6C,0x69,0x66,0x6F,0x72,0x6E,0x69,0x61,0x31,0x14,0x30,0x12,0x06,0x03,
				0x55,0x04,0x0A,0x13,0x0B,0x43,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x65,0x4E,0x65,0x74,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x0B,0x13,0x1E,0x53,0x65,0x72,0x76,0x65,0x72,0x20,0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x30,0x70,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x5F,0x00,0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,
				0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x03,0x7E,0x00,0x54,0x20,0x67,0x12,0xBB,0x66,0x14,0xC3,0x26,0x6B,0x7F,
				0xDA,0x4A,0x25,0x4D,0x8B,0xE0,0xFD,0x1E,0x53,0x6D,0xAC,0xA2,0xD0,0x89,0xB8,0x2E,0x90,0xA0,0x27,0x43,0xA4,0xEE,0x4A,0x26,0x86,0x40,0xFF,0xB8,0x72,0x8D,0x1E,0xE7,0xB7,0x77,0xDC,0x7D,0xD8,0x3F,0x3A,0x6E,0x55,0x10,0xA6,0x1D,0xB5,0x58,0xF2,0xF9,0x0F,0x2E,0xB4,0x10,0x55,0x48,0xDC,0x13,0x5F,0x0D,0x08,0x26,0x88,0xC9,0xAF,0x66,0xF2,0x2C,0x9C,0x6F,0x3D,0xC3,0x2B,0x69,0x28,0x89,0x40,0x6F,0x8F,0x35,0x3B,0x9E,0xF6,0x8E,0xF1,0x11,0x17,0xFB,0x0C,0x98,0x95,0xA1,0xC2,0xBA,0x89,0x48,0xEB,0xB4,0x06,0x6A,0x22,0x54,
				0xD7,0xBA,0x18,0x3A,0x48,0xA6,0xCB,0xC2,0xFD,0x20,0x57,0xBC,0x63,0x1C };

			// will only work on Windows (MS or Mono)
			// this isn't much of a problem because the structure CERT_CONTEXT (IntPtr)
			// is specific to CryptoAPI/Windows.
			IntPtr handle = IntPtr.Zero;

			if (Path.DirectorySeparatorChar == '\\') {
				handle = GetHandle (cert);
			} else {
				handle = GetHandleEx (cert);
			}

			X509Certificate x509 = new X509Certificate (handle);
			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");
			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");
			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");
			Assert.AreEqual ("1.2.840.113549.1.1.1", x509.GetKeyAlgorithm (), "GetKeyAlgorithm");
			byte[] keyparams = { 0x05,0x00 };
			Assert.AreEqual (keyparams, x509.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
			Assert.AreEqual ("0500", x509.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
			Assert.AreEqual ("C=US, S=California, O=CommerceNet, OU=Server Certification Authority", x509.GetName (), "GetName");
			byte[] pubkey = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
			Assert.AreEqual (pubkey, x509.GetPublicKey (), "GetPublicKey");
			Assert.AreEqual ("305C02552D58E9BFF031CD7906505AD59E0E2CE6C2F7F9D2CE556485B1909A92B336C1BCEAC823B7AB3AA76463775F84228EE5B645DD46AE0ADD00C21FBAD9ADC07562F89582A280B18269FAE1AF7FBC7DE27C76D5BC2A80FB0203010001", x509.GetPublicKeyString (), "GetPublicKeyString");
			Assert.AreEqual (cert, x509.GetRawCertData (), "GetRawCertData");
			Assert.AreEqual (ToString (cert), x509.GetRawCertDataString (), "GetRawCertDataString");
			byte[] serial = { 0xE8,0x06,0x00,0x72,0x02 };
			Assert.AreEqual (serial, x509.GetSerialNumber (), "GetSerialNumber");
			Assert.AreEqual ("02720006E8", x509.GetSerialNumberString (), "GetSerialNumberString");
		}
public void Certificate12 ()
{
	// certificate can be loaded by constructor
	byte[] cert = { 0x30,0x82,0x05,0x0F,0x30,0x82,0x03,0xF7,0xA0,0x03,0x02,0x01,0x02,0x02,0x0A,0x61,0x07,0x11,0x43,0x00,0x00,0x00,0x00,0x00,0x34,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x30,0x81,0xA6,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x31,0x1E,0x30,0x1C,0x06,0x03,
		0x55,0x04,0x0A,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x30,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x23,0x30,0x21,0x06,0x03,0x55,0x04,0x03,0x13,0x1A,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x64,0x65,0x20,0x53,0x69,0x67,
		0x6E,0x69,0x6E,0x67,0x20,0x50,0x43,0x41,0x30,0x1E,0x17,0x0D,0x30,0x32,0x30,0x35,0x32,0x35,0x30,0x30,0x35,0x35,0x34,0x38,0x5A,0x17,0x0D,0x30,0x33,0x31,0x31,0x32,0x35,0x30,0x31,0x30,0x35,0x34,0x38,0x5A,0x30,0x81,0xA1,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x08,0x13,0x0A,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x31,0x10,0x30,0x0E,0x06,0x03,0x55,0x04,0x07,0x13,0x07,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x31,0x1E,0x30,0x1C,0x06,
		0x03,0x55,0x04,0x0A,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x32,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x03,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,
		0x74,0x69,0x6F,0x6E,0x30,0x82,0x01,0x22,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0F,0x00,0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAA,0x99,0xBD,0x39,0xA8,0x18,0x27,0xF4,0x2B,0x3D,0x0B,0x4C,0x3F,0x7C,0x77,0x2E,0xA7,0xCB,0xB5,0xD1,0x8C,0x0D,0xC2,0x3A,0x74,0xD7,0x93,0xB5,0xE0,0xA0,0x4B,0x3F,0x59,0x5E,0xCE,0x45,0x4F,0x9A,0x79,0x29,0xF1,0x49,0xCC,0x1A,0x47,0xEE,0x55,0xC2,0x08,0x3E,0x12,0x20,0xF8,0x55,0xF2,0xEE,0x5F,0xD3,0xE0,0xCA,0x96,0xBC,0x30,
		0xDE,0xFE,0x58,0xC8,0x27,0x32,0xD0,0x85,0x54,0xE8,0xF0,0x91,0x10,0xBB,0xF3,0x2B,0xBE,0x19,0xE5,0x03,0x9B,0x0B,0x86,0x1D,0xF3,0xB0,0x39,0x8C,0xB8,0xFD,0x0B,0x1D,0x3C,0x73,0x26,0xAC,0x57,0x2B,0xCA,0x29,0xA2,0x15,0x90,0x82,0x15,0xE2,0x77,0xA3,0x40,0x52,0x03,0x8B,0x9D,0xC2,0x70,0xBA,0x1F,0xE9,0x34,0xF6,0xF3,0x35,0x92,0x4E,0x55,0x83,0xF8,0xDA,0x30,0xB6,0x20,0xDE,0x57,0x06,0xB5,0x5A,0x42,0x06,0xDE,0x59,0xCB,0xF2,0xDF,0xA6,0xBD,0x15,0x47,0x71,0x19,0x25,0x23,0xD2,0xCB,0x6F,0x9B,0x19,0x79,0xDF,0x6A,0x5B,
		0xF1,0x76,0x05,0x79,0x29,0xFC,0xC3,0x56,0xCA,0x8F,0x44,0x08,0x85,0x55,0x8A,0xCB,0xC8,0x0F,0x46,0x4B,0x55,0xCB,0x8C,0x96,0x77,0x4A,0x87,0xE8,0xA9,0x41,0x06,0xC7,0xFF,0x0D,0xE9,0x68,0x57,0x63,0x72,0xC3,0x69,0x57,0xB4,0x43,0xCF,0x32,0x3A,0x30,0xDC,0x1B,0xE9,0xD5,0x43,0x26,0x2A,0x79,0xFE,0x95,0xDB,0x22,0x67,0x24,0xC9,0x2F,0xD0,0x34,0xE3,0xE6,0xFB,0x51,0x49,0x86,0xB8,0x3C,0xD0,0x25,0x5F,0xD6,0xEC,0x9E,0x03,0x61,0x87,0xA9,0x68,0x40,0xC7,0xF8,0xE2,0x03,0xE6,0xCF,0x05,0x02,0x03,0x01,0x00,0x01,0xA3,0x82,
		0x01,0x40,0x30,0x82,0x01,0x3C,0x30,0x0E,0x06,0x03,0x55,0x1D,0x0F,0x01,0x01,0xFF,0x04,0x04,0x03,0x02,0x06,0xC0,0x30,0x13,0x06,0x03,0x55,0x1D,0x25,0x04,0x0C,0x30,0x0A,0x06,0x08,0x2B,0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x1D,0x06,0x03,0x55,0x1D,0x0E,0x04,0x16,0x04,0x14,0x6B,0xC8,0xC6,0x51,0x20,0xF0,0xB4,0x2F,0xD3,0xA0,0xB6,0xAE,0x7F,0x5E,0x26,0xB2,0xB8,0x87,0x52,0x29,0x30,0x81,0xA9,0x06,0x03,0x55,0x1D,0x23,0x04,0x81,0xA1,0x30,0x81,0x9E,0x80,0x14,0x29,0x5C,0xB9,0x1B,0xB6,0xCD,0x33,0xEE,0xBB,0x9E,
		0x59,0x7D,0xF7,0xE5,0xCA,0x2E,0xC4,0x0D,0x34,0x28,0xA1,0x74,0xA4,0x72,0x30,0x70,0x31,0x2B,0x30,0x29,0x06,0x03,0x55,0x04,0x0B,0x13,0x22,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x31,0x39,0x39,0x37,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x31,0x1E,0x30,0x1C,0x06,0x03,0x55,0x04,0x0B,0x13,0x15,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x31,0x21,0x30,0x1F,0x06,0x03,0x55,
		0x04,0x03,0x13,0x18,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x52,0x6F,0x6F,0x74,0x20,0x41,0x75,0x74,0x68,0x6F,0x72,0x69,0x74,0x79,0x82,0x10,0x6A,0x0B,0x99,0x4F,0xC0,0x00,0xDE,0xAA,0x11,0xD4,0xD8,0x40,0x9A,0xA8,0xBE,0xE6,0x30,0x4A,0x06,0x03,0x55,0x1D,0x1F,0x04,0x43,0x30,0x41,0x30,0x3F,0xA0,0x3D,0xA0,0x3B,0x86,0x39,0x68,0x74,0x74,0x70,0x3A,0x2F,0x2F,0x63,0x72,0x6C,0x2E,0x6D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x2E,0x63,0x6F,0x6D,0x2F,0x70,0x6B,0x69,0x2F,0x63,0x72,0x6C,0x2F,0x70,0x72,
		0x6F,0x64,0x75,0x63,0x74,0x73,0x2F,0x43,0x6F,0x64,0x65,0x53,0x69,0x67,0x6E,0x50,0x43,0x41,0x2E,0x63,0x72,0x6C,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x35,0x23,0xFD,0x13,0x54,0xFC,0xE9,0xDC,0xF0,0xDD,0x0C,0x14,0x7A,0xFA,0xA7,0xB3,0xCE,0xFD,0xA7,0x3A,0xC8,0xBA,0xE5,0xE7,0xF6,0x03,0xFB,0x53,0xDB,0xA7,0x99,0xA9,0xA0,0x9B,0x36,0x9C,0x03,0xEB,0x82,0x47,0x1C,0x21,0xBD,0x14,0xCB,0xE7,0x67,0x40,0x09,0xC7,0x16,0x91,0x02,0x55,0xCE,0x43,0x42,0xB4,
		0xCD,0x1B,0x5D,0xB0,0xF3,0x32,0x04,0x3D,0x12,0xE5,0x1D,0xA7,0x07,0xA7,0x8F,0xA3,0x7E,0x45,0x55,0x76,0x1B,0x96,0x95,0x91,0x69,0xF0,0xDD,0x38,0xF3,0x48,0x89,0xEF,0x70,0x40,0xB7,0xDB,0xB5,0x55,0x80,0xC0,0x03,0xC4,0x2E,0xB6,0x28,0xDC,0x0A,0x82,0x0E,0xC7,0x43,0xE3,0x7A,0x48,0x5D,0xB8,0x06,0x89,0x92,0x40,0x6C,0x6E,0xC5,0xDC,0xF8,0x9A,0xEF,0x0B,0xBE,0x21,0x0A,0x8C,0x2F,0x3A,0xB5,0xED,0xA7,0xCE,0x71,0x87,0x68,0x23,0xE1,0xB3,0xE4,0x18,0x7D,0xB8,0x47,0x01,0xA5,0x2B,0xC4,0x58,0xCB,0xB2,0x89,0x6C,0x5F,0xFD,
		0xD3,0x2C,0xC4,0x6F,0xB8,0x23,0xB2,0x0D,0xFF,0x3C,0xF2,0x11,0x45,0x74,0xF2,0x09,0x06,0x99,0x18,0xDD,0x6F,0xC0,0x86,0x01,0x18,0x12,0x1D,0x2B,0x16,0xAF,0x56,0xEF,0x65,0x33,0xA1,0xEA,0x67,0x4E,0xF4,0x4B,0x82,0xAB,0xE9,0x0F,0xDC,0x01,0xFA,0xDF,0x60,0x7F,0x66,0x47,0x5D,0xCB,0x2C,0x70,0xCC,0x7B,0x4E,0xD9,0x06,0xB8,0x6E,0x8C,0x0C,0xFE,0x62,0x1E,0x42,0xF9,0x93,0x7C,0xA2,0xAB,0x0A,0x9E,0xD0,0x23,0x10,0xAE,0x4D,0x7B,0x27,0x91,0x6F,0x26,0xBE,0x68,0xFA,0xA6,0x3F,0x9F,0x23,0xEB,0xC8,0x9D,0xBB,0x87 };

	X509Certificate x509 = new X509Certificate (cert);
	X509Certificate clone = new X509Certificate (x509);

	Assertion.Assert ("Equals", x509.Equals (clone));
	Assertion.Assert ("Equals", clone.Equals (x509));

	FileStream fs = File.OpenWrite ("temp.cer");
	fs.Write (cert, 0, cert.Length);
	fs.Close ();

	X509Certificate disk = X509Certificate.CreateFromCertFile ("temp.cer");
	Assertion.Assert ("Equals", disk.Equals (clone));
	Assertion.Assert ("Equals", disk.Equals (x509));
	byte[] hash = { 0x28,0x2D,0x98,0x06,0xC3,0xDF,0x73,0x45,0x92,0x9F,0x64,0xF5,0x89,0x5E,0xF2,0xEA,0x4A,0xC2,0x93,0x02 };
	AssertEquals ("GetCertHash", hash, x509.GetCertHash ());
	Assertion.AssertEquals ("GetCertHashString", "282D9806C3DF7345929F64F5895EF2EA4AC29302", x509.GetCertHashString ());
	Assertion.AssertEquals ("GetEffectiveDateString", "05/24/2002 16:55:48", x509.GetEffectiveDateString ());
	Assertion.AssertEquals ("GetExpirationDateString", "11/24/2003 17:05:48", x509.GetExpirationDateString ());
	Assertion.AssertEquals ("GetFormat", "X509", x509.GetFormat ());
	Assertion.AssertEquals ("GetHashCode", 674076678, x509.GetHashCode ());
	Assertion.AssertEquals ("GetIssuerName", "C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Copyright (c) 2000 Microsoft Corp., CN=Microsoft Code Signing PCA", x509.GetIssuerName ());
	Assertion.AssertEquals ("GetKeyAlgorithm", "1.2.840.113549.1.1.1", x509.GetKeyAlgorithm ());
	byte[] keyparams = { 0x05,0x00 };
	AssertEquals ("GetKeyAlgorithmParameters", keyparams, x509.GetKeyAlgorithmParameters ());
	Assertion.AssertEquals ("GetKeyAlgorithmParametersString", "0500", x509.GetKeyAlgorithmParametersString ());
	Assertion.AssertEquals ("GetName", "C=US, S=Washington, L=Redmond, O=Microsoft Corporation, OU=Copyright (c) 2002 Microsoft Corp., CN=Microsoft Corporation", x509.GetName ());
	byte[] pubkey = { 0x30,0x82,0x01,0x0A,0x02,0x82,0x01,0x01,0x00,0xAA,0x99,0xBD,0x39,0xA8,0x18,0x27,0xF4,0x2B,0x3D,0x0B,0x4C,0x3F,0x7C,0x77,0x2E,0xA7,0xCB,0xB5,0xD1,0x8C,0x0D,0xC2,0x3A,0x74,0xD7,0x93,0xB5,0xE0,0xA0,0x4B,0x3F,0x59,0x5E,0xCE,0x45,0x4F,0x9A,0x79,0x29,0xF1,0x49,0xCC,0x1A,0x47,0xEE,0x55,0xC2,0x08,0x3E,0x12,0x20,0xF8,0x55,0xF2,0xEE,0x5F,0xD3,0xE0,0xCA,0x96,0xBC,0x30,0xDE,0xFE,0x58,0xC8,0x27,0x32,0xD0,0x85,0x54,0xE8,0xF0,0x91,0x10,0xBB,0xF3,0x2B,0xBE,0x19,0xE5,0x03,0x9B,0x0B,0x86,0x1D,0xF3,0xB0,0x39,0x8C,0xB8,
		0xFD,0x0B,0x1D,0x3C,0x73,0x26,0xAC,0x57,0x2B,0xCA,0x29,0xA2,0x15,0x90,0x82,0x15,0xE2,0x77,0xA3,0x40,0x52,0x03,0x8B,0x9D,0xC2,0x70,0xBA,0x1F,0xE9,0x34,0xF6,0xF3,0x35,0x92,0x4E,0x55,0x83,0xF8,0xDA,0x30,0xB6,0x20,0xDE,0x57,0x06,0xB5,0x5A,0x42,0x06,0xDE,0x59,0xCB,0xF2,0xDF,0xA6,0xBD,0x15,0x47,0x71,0x19,0x25,0x23,0xD2,0xCB,0x6F,0x9B,0x19,0x79,0xDF,0x6A,0x5B,0xF1,0x76,0x05,0x79,0x29,0xFC,0xC3,0x56,0xCA,0x8F,0x44,0x08,0x85,0x55,0x8A,0xCB,0xC8,0x0F,0x46,0x4B,0x55,0xCB,0x8C,0x96,0x77,0x4A,0x87,0xE8,0xA9,
		0x41,0x06,0xC7,0xFF,0x0D,0xE9,0x68,0x57,0x63,0x72,0xC3,0x69,0x57,0xB4,0x43,0xCF,0x32,0x3A,0x30,0xDC,0x1B,0xE9,0xD5,0x43,0x26,0x2A,0x79,0xFE,0x95,0xDB,0x22,0x67,0x24,0xC9,0x2F,0xD0,0x34,0xE3,0xE6,0xFB,0x51,0x49,0x86,0xB8,0x3C,0xD0,0x25,0x5F,0xD6,0xEC,0x9E,0x03,0x61,0x87,0xA9,0x68,0x40,0xC7,0xF8,0xE2,0x03,0xE6,0xCF,0x05,0x02,0x03,0x01,0x00,0x01 };
	AssertEquals ("GetPublicKey", pubkey, x509.GetPublicKey ());
	Assertion.AssertEquals ("GetPublicKeyString", "3082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001", x509.GetPublicKeyString ());
	AssertEquals ("GetRawCertData", cert, x509.GetRawCertData ());
	Assertion.AssertEquals ("GetRawCertDataString", ToString (cert), x509.GetRawCertDataString ());
	byte[] serial = { 0x34,0x00,0x00,0x00,0x00,0x00,0x43,0x11,0x07,0x61 };
	AssertEquals ("GetSerialNumber", serial, x509.GetSerialNumber ());
	Assertion.AssertEquals ("GetSerialNumberString", "34000000000043110761", x509.GetSerialNumberString ());
	byte[] ToStringArray = { 0x43,0x45,0x52,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x45,0x3A,0x0D,0x0A,0x09,0x46,0x6F,0x72,0x6D,0x61,0x74,0x3A,0x20,0x20,0x58,0x35,0x30,0x39,0x0D,0x0A,0x09,0x4E,0x61,0x6D,0x65,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x2C,0x20,0x4C,0x3D,0x52,0x65,0x64,0x6D,0x6F,0x6E,0x64,0x2C,0x20,0x4F,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x4F,0x55,0x3D,0x43,0x6F,0x70,0x79,
		0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x32,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x2C,0x20,0x43,0x4E,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x0D,0x0A,0x09,0x49,0x73,0x73,0x75,0x69,0x6E,0x67,0x20,0x43,0x41,0x3A,0x20,0x20,0x43,0x3D,0x55,0x53,0x2C,0x20,0x53,0x3D,0x57,0x61,0x73,0x68,0x69,0x6E,0x67,0x74,0x6F,0x6E,0x2C,0x20,0x4C,0x3D,0x52,0x65,0x64,0x6D,0x6F,0x6E,
		0x64,0x2C,0x20,0x4F,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x6F,0x72,0x61,0x74,0x69,0x6F,0x6E,0x2C,0x20,0x4F,0x55,0x3D,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x30,0x20,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x72,0x70,0x2E,0x2C,0x20,0x43,0x4E,0x3D,0x4D,0x69,0x63,0x72,0x6F,0x73,0x6F,0x66,0x74,0x20,0x43,0x6F,0x64,0x65,0x20,0x53,0x69,0x67,0x6E,0x69,0x6E,0x67,0x20,0x50,0x43,0x41,0x0D,0x0A,0x09,0x4B,
		0x65,0x79,0x20,0x41,0x6C,0x67,0x6F,0x72,0x69,0x74,0x68,0x6D,0x3A,0x20,0x20,0x31,0x2E,0x32,0x2E,0x38,0x34,0x30,0x2E,0x31,0x31,0x33,0x35,0x34,0x39,0x2E,0x31,0x2E,0x31,0x2E,0x31,0x0D,0x0A,0x09,0x53,0x65,0x72,0x69,0x61,0x6C,0x20,0x4E,0x75,0x6D,0x62,0x65,0x72,0x3A,0x20,0x20,0x33,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x34,0x33,0x31,0x31,0x30,0x37,0x36,0x31,0x0D,0x0A,0x09,0x4B,0x65,0x79,0x20,0x41,0x6C,0x6F,0x67,0x72,0x69,0x74,0x68,0x6D,0x20,0x50,0x61,0x72,0x61,0x6D,0x65,0x74,0x65,0x72,
		0x73,0x3A,0x20,0x20,0x30,0x35,0x30,0x30,0x0D,0x0A,0x09,0x50,0x75,0x62,0x6C,0x69,0x63,0x20,0x4B,0x65,0x79,0x3A,0x20,0x20,0x33,0x30,0x38,0x32,0x30,0x31,0x30,0x41,0x30,0x32,0x38,0x32,0x30,0x31,0x30,0x31,0x30,0x30,0x41,0x41,0x39,0x39,0x42,0x44,0x33,0x39,0x41,0x38,0x31,0x38,0x32,0x37,0x46,0x34,0x32,0x42,0x33,0x44,0x30,0x42,0x34,0x43,0x33,0x46,0x37,0x43,0x37,0x37,0x32,0x45,0x41,0x37,0x43,0x42,0x42,0x35,0x44,0x31,0x38,0x43,0x30,0x44,0x43,0x32,0x33,0x41,0x37,0x34,0x44,0x37,0x39,0x33,0x42,0x35,0x45,0x30,
		0x41,0x30,0x34,0x42,0x33,0x46,0x35,0x39,0x35,0x45,0x43,0x45,0x34,0x35,0x34,0x46,0x39,0x41,0x37,0x39,0x32,0x39,0x46,0x31,0x34,0x39,0x43,0x43,0x31,0x41,0x34,0x37,0x45,0x45,0x35,0x35,0x43,0x32,0x30,0x38,0x33,0x45,0x31,0x32,0x32,0x30,0x46,0x38,0x35,0x35,0x46,0x32,0x45,0x45,0x35,0x46,0x44,0x33,0x45,0x30,0x43,0x41,0x39,0x36,0x42,0x43,0x33,0x30,0x44,0x45,0x46,0x45,0x35,0x38,0x43,0x38,0x32,0x37,0x33,0x32,0x44,0x30,0x38,0x35,0x35,0x34,0x45,0x38,0x46,0x30,0x39,0x31,0x31,0x30,0x42,0x42,0x46,0x33,0x32,0x42,
		0x42,0x45,0x31,0x39,0x45,0x35,0x30,0x33,0x39,0x42,0x30,0x42,0x38,0x36,0x31,0x44,0x46,0x33,0x42,0x30,0x33,0x39,0x38,0x43,0x42,0x38,0x46,0x44,0x30,0x42,0x31,0x44,0x33,0x43,0x37,0x33,0x32,0x36,0x41,0x43,0x35,0x37,0x32,0x42,0x43,0x41,0x32,0x39,0x41,0x32,0x31,0x35,0x39,0x30,0x38,0x32,0x31,0x35,0x45,0x32,0x37,0x37,0x41,0x33,0x34,0x30,0x35,0x32,0x30,0x33,0x38,0x42,0x39,0x44,0x43,0x32,0x37,0x30,0x42,0x41,0x31,0x46,0x45,0x39,0x33,0x34,0x46,0x36,0x46,0x33,0x33,0x35,0x39,0x32,0x34,0x45,0x35,0x35,0x38,0x33,
		0x46,0x38,0x44,0x41,0x33,0x30,0x42,0x36,0x32,0x30,0x44,0x45,0x35,0x37,0x30,0x36,0x42,0x35,0x35,0x41,0x34,0x32,0x30,0x36,0x44,0x45,0x35,0x39,0x43,0x42,0x46,0x32,0x44,0x46,0x41,0x36,0x42,0x44,0x31,0x35,0x34,0x37,0x37,0x31,0x31,0x39,0x32,0x35,0x32,0x33,0x44,0x32,0x43,0x42,0x36,0x46,0x39,0x42,0x31,0x39,0x37,0x39,0x44,0x46,0x36,0x41,0x35,0x42,0x46,0x31,0x37,0x36,0x30,0x35,0x37,0x39,0x32,0x39,0x46,0x43,0x43,0x33,0x35,0x36,0x43,0x41,0x38,0x46,0x34,0x34,0x30,0x38,0x38,0x35,0x35,0x35,0x38,0x41,0x43,0x42,
		0x43,0x38,0x30,0x46,0x34,0x36,0x34,0x42,0x35,0x35,0x43,0x42,0x38,0x43,0x39,0x36,0x37,0x37,0x34,0x41,0x38,0x37,0x45,0x38,0x41,0x39,0x34,0x31,0x30,0x36,0x43,0x37,0x46,0x46,0x30,0x44,0x45,0x39,0x36,0x38,0x35,0x37,0x36,0x33,0x37,0x32,0x43,0x33,0x36,0x39,0x35,0x37,0x42,0x34,0x34,0x33,0x43,0x46,0x33,0x32,0x33,0x41,0x33,0x30,0x44,0x43,0x31,0x42,0x45,0x39,0x44,0x35,0x34,0x33,0x32,0x36,0x32,0x41,0x37,0x39,0x46,0x45,0x39,0x35,0x44,0x42,0x32,0x32,0x36,0x37,0x32,0x34,0x43,0x39,0x32,0x46,0x44,0x30,0x33,0x34,
		0x45,0x33,0x45,0x36,0x46,0x42,0x35,0x31,0x34,0x39,0x38,0x36,0x42,0x38,0x33,0x43,0x44,0x30,0x32,0x35,0x35,0x46,0x44,0x36,0x45,0x43,0x39,0x45,0x30,0x33,0x36,0x31,0x38,0x37,0x41,0x39,0x36,0x38,0x34,0x30,0x43,0x37,0x46,0x38,0x45,0x32,0x30,0x33,0x45,0x36,0x43,0x46,0x30,0x35,0x30,0x32,0x30,0x33,0x30,0x31,0x30,0x30,0x30,0x31,0x0D,0x0A,0x0D,0x0A };
	string tsa = Encoding.Default.GetString (ToStringArray).Replace ("\r\n", Environment.NewLine);
	//Assertion.AssertEquals ("ToString(true)", tsa, x509.ToString (true));
}
Ejemplo n.º 28
0
		public void ConstructorIntPtrZero ()
		{
			X509Certificate spc = new X509Certificate (IntPtr.Zero);
			Assert.AreEqual (0, spc.GetHashCode (), "ConstructorIntPtrZero");
		}
Ejemplo n.º 29
0
		static internal Evidence GetDefaultHostEvidence (Assembly a) 
		{
			Evidence e = new Evidence ();
			string aname = a.EscapedCodeBase;

			// by default all assembly have the Zone, Url and Hash evidences
			e.AddHost (Zone.CreateFromUrl (aname));
			e.AddHost (new Url (aname));
			e.AddHost (new Hash (a));

			// non local files (e.g. http://) also get a Site evidence
			if (String.Compare ("FILE://", 0, aname, 0, 7, true, CultureInfo.InvariantCulture) != 0) {
				e.AddHost (Site.CreateFromUrl (aname));
			}

			// strongnamed assemblies gets a StrongName evidence
			AssemblyName an = a.GetName ();
			byte[] pk = an.GetPublicKey ();
			if ((pk != null) && (pk.Length > 0)) {
				StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (pk);
				e.AddHost (new StrongName (blob, an.Name, an.Version));
			}

			// Authenticode(r) signed assemblies get a Publisher evidence
			if (IsAuthenticodePresent (a)) {
				// Note: The certificate is part of the evidences even if it is not trusted!
				// so we can't call X509Certificate.CreateFromSignedFile
				AuthenticodeDeformatter ad = new AuthenticodeDeformatter (a.Location);
				if (ad.SigningCertificate != null) {
					X509Certificate x509 = new X509Certificate (ad.SigningCertificate.RawData);
					if (x509.GetHashCode () != 0) {
						e.AddHost (new Publisher (x509));
					}
				}
			}
			// assemblies loaded from the GAC also get a Gac evidence (new in Fx 2.0)
			if (a.GlobalAssemblyCache) {
				e.AddHost (new GacInstalled ());
			}

			// the current HostSecurityManager may add/remove some evidence
			AppDomainManager dommgr = AppDomain.CurrentDomain.DomainManager;
			if (dommgr != null) {
				if ((dommgr.HostSecurityManager.Flags & HostSecurityManagerOptions.HostAssemblyEvidence) ==
					HostSecurityManagerOptions.HostAssemblyEvidence) {
					e = dommgr.HostSecurityManager.ProvideAssemblyEvidence (a, e);
				}
			}

			return e;
		}
		private void CheckPkcs12 (X509Certificate x)
		{
			byte[] cert = { 0x30, 0x82, 0x02, 0x1E, 0x30, 0x82, 0x01, 0x8B, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x74, 0x8B, 0xCD, 0xD9, 0x86, 0x99, 0x9A, 0x91, 0x4A, 0x0C, 0xC3, 0xF4, 0xE1, 0x2F, 0xF5, 0x95, 0x30, 0x09, 
				0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x23, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x6F, 0x6E, 0x6F, 0x20, 0x53, 0x53, 0x4C, 0x20, 0x49, 0x6E, 0x74, 
				0x65, 0x72, 0x6D, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x20, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x31, 0x32, 0x37, 0x30, 0x32, 0x35, 0x37, 0x34, 0x32, 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 
				0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08, 0x46, 0x41, 0x52, 0x53, 0x43, 0x41, 0x50, 0x45, 0x30, 0x81, 0x9F, 
				0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xC4, 0x26, 0x3B, 0xE9, 0x49, 0x07, 0x39, 0x8C, 
				0x51, 0x34, 0x3B, 0x84, 0x4C, 0x27, 0x98, 0x70, 0x15, 0x79, 0xF1, 0xF4, 0x2A, 0x32, 0x82, 0xC3, 0xFA, 0xCF, 0x6E, 0x72, 0x37, 0xCE, 0x37, 0x55, 0x1F, 0xFA, 0x8F, 0x78, 0x4A, 0xA0, 0x0C, 0x9D, 0x44, 0x29, 
				0xF2, 0x81, 0xD9, 0x87, 0xD5, 0x94, 0x1A, 0xFC, 0x8D, 0xF8, 0x9D, 0xE0, 0xC5, 0xD2, 0x4A, 0x4F, 0x68, 0xD3, 0xAD, 0x65, 0x23, 0xB2, 0x4F, 0x48, 0x35, 0xB9, 0xFE, 0xE1, 0xDB, 0x6B, 0xE7, 0x41, 0x76, 0xEC, 
				0x0C, 0x5B, 0x3A, 0xE3, 0x07, 0xC9, 0x3D, 0x94, 0x48, 0xF2, 0xCF, 0x71, 0xAC, 0x2F, 0x71, 0x60, 0x15, 0x0E, 0xD5, 0x9A, 0xF8, 0x6C, 0x7F, 0xE9, 0xC0, 0x19, 0x18, 0x72, 0x09, 0xA1, 0xD6, 0xB8, 0xA9, 0x60, 
				0xD1, 0xC3, 0x18, 0x91, 0x98, 0xCE, 0x9A, 0x44, 0x3D, 0xCF, 0x63, 0x79, 0x41, 0x27, 0x18, 0xB3, 0x8E, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x6B, 0x30, 0x69, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 
				0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x52, 0x06, 0x03, 0x55, 0x1D, 0x01, 0x04, 0x4B, 0x30, 0x49, 0x80, 0x10, 0x7C, 0x13, 0x05, 0xC9, 0xB9, 0x5A, 0xA3, 
				0x19, 0x3E, 0x7C, 0x0D, 0x7C, 0xE3, 0xF2, 0xD3, 0x36, 0xA1, 0x23, 0x30, 0x21, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x16, 0x4D, 0x6F, 0x6E, 0x6F, 0x20, 0x55, 0x6E, 0x69, 0x74, 0x20, 
				0x54, 0x65, 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43, 0x41, 0x82, 0x10, 0x1B, 0xFC, 0x61, 0x41, 0xD0, 0xCF, 0x41, 0xB9, 0x47, 0xEF, 0x21, 0x7D, 0x6A, 0x53, 0x32, 0x76, 0x30, 0x09, 0x06, 0x05, 
				0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x94, 0xF8, 0xDA, 0xEF, 0x93, 0x6A, 0x23, 0x04, 0x6B, 0x2D, 0xC3, 0x1E, 0x57, 0xC9, 0x7E, 0xE1, 0xF6, 0x6C, 0x55, 0xB6, 0xAC, 0xAB, 0xA8, 
				0x67, 0x19, 0xCD, 0x1D, 0x32, 0x1C, 0xD7, 0x63, 0x13, 0x4F, 0x41, 0x85, 0xB0, 0x62, 0xB8, 0x04, 0x38, 0xD0, 0xD8, 0x18, 0x36, 0x80, 0xE2, 0x70, 0xE7, 0x11, 0x05, 0x7A, 0x2D, 0x5D, 0xC8, 0xAD, 0x29, 0x2E, 
				0x05, 0x54, 0x66, 0xE2, 0x8E, 0xCC, 0xDA, 0xEE, 0x19, 0x10, 0xB9, 0x37, 0x30, 0x83, 0x62, 0x9A, 0x10, 0xDB, 0x19, 0x41, 0x57, 0x37, 0x1A, 0x39, 0x54, 0x59, 0xE6, 0x6D, 0xDF, 0x1B, 0xCE, 0x6E, 0x78, 0x6A, 
				0x5F, 0x06, 0x26, 0x8D, 0xE0, 0x94, 0x52, 0xF4, 0x86, 0x9C, 0x42, 0x58, 0xF0, 0xEB, 0x71, 0xEB, 0xB8, 0x8E, 0xC9, 0x20, 0x84, 0xD5, 0x11, 0x58, 0x40, 0x4A, 0xE9, 0xD1, 0x8E, 0x2F, 0x9D, 0xD9, 0x8B, 0xD0, 
				0x55, 0xB8, 0x96 };
			Assert.AreEqual ("CN=Mono SSL Intermediate CA", x.Issuer, "Issuer");
			Assert.AreEqual ("CN=Mono SSL Intermediate CA", x.GetIssuerName (), "GetIssuerName");
			Assert.AreEqual ("CN=FARSCAPE", x.Subject, "Subject");
			Assert.AreEqual ("CN=FARSCAPE", x.GetName (), "GetName");
			byte[] hash = { 0x30, 0x29, 0x69, 0x4B, 0x22, 0xB2, 0xEE, 0x6A, 0xEC, 0x9B, 0x78, 0x44, 0x9E, 0x51, 0x0F, 0x7C, 0x34, 0x8D, 0xBA, 0x33 };
			Assert.AreEqual (hash, x.GetCertHash (), "GetCertHash");
			Assert.AreEqual ("3029694B22B2EE6AEC9B78449E510F7C348DBA33", x.GetCertHashString (), "GetCertHashString");
			long from = DateTime.Parse (x.GetEffectiveDateString ()).ToUniversalTime ().Ticks;
			Assert.AreEqual (632054986620000000, from, "GetEffectiveDateString");
			long until = DateTime.Parse (x.GetExpirationDateString ()).ToUniversalTime ().Ticks;
			Assert.AreEqual (643445855990000000, until, "GetExpirationDateString");
			Assert.AreEqual ("X509", x.GetFormat (), "GetFormat");
			Assert.AreEqual (808020299, x.GetHashCode (), "GetHashCode");
			Assert.AreEqual ("1.2.840.113549.1.1.1", x.GetKeyAlgorithm (), "GetKeyAlgorithm");
			byte[] keyparams = { 0x05,0x00 };
			Assert.AreEqual (keyparams, x.GetKeyAlgorithmParameters (), "GetKeyAlgorithmParameters");
			Assert.AreEqual ("0500", x.GetKeyAlgorithmParametersString (), "GetKeyAlgorithmParametersString");
			byte[] pubkey = { 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xC4, 0x26, 0x3B, 0xE9, 0x49, 0x07, 0x39, 0x8C, 0x51, 0x34, 0x3B, 0x84, 0x4C, 0x27, 0x98, 0x70, 0x15, 0x79, 0xF1, 0xF4, 0x2A, 0x32, 0x82, 0xC3, 0xFA, 0xCF, 0x6E, 0x72, 0x37, 0xCE, 0x37, 0x55, 0x1F, 0xFA, 0x8F, 0x78, 0x4A, 0xA0, 0x0C, 0x9D, 0x44, 0x29, 0xF2, 0x81, 0xD9, 0x87, 0xD5, 0x94, 
				0x1A, 0xFC, 0x8D, 0xF8, 0x9D, 0xE0, 0xC5, 0xD2, 0x4A, 0x4F, 0x68, 0xD3, 0xAD, 0x65, 0x23, 0xB2, 0x4F, 0x48, 0x35, 0xB9, 0xFE, 0xE1, 0xDB, 0x6B, 0xE7, 0x41, 0x76, 0xEC, 0x0C, 0x5B, 0x3A, 0xE3, 0x07, 0xC9, 0x3D, 0x94, 0x48, 0xF2, 0xCF, 0x71, 0xAC, 0x2F, 0x71, 0x60, 0x15, 0x0E, 0xD5, 0x9A, 0xF8, 0x6C, 0x7F, 0xE9, 0xC0, 0x19, 0x18, 0x72, 
				0x09, 0xA1, 0xD6, 0xB8, 0xA9, 0x60, 0xD1, 0xC3, 0x18, 0x91, 0x98, 0xCE, 0x9A, 0x44, 0x3D, 0xCF, 0x63, 0x79, 0x41, 0x27, 0x18, 0xB3, 0x8E, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01 };
			Assert.AreEqual (pubkey, x.GetPublicKey (), "GetPublicKey");
			Assert.AreEqual ("30818902818100C4263BE94907398C51343B844C2798701579F1F42A3282C3FACF6E7237CE37551FFA8F784AA00C9D4429F281D987D5941AFC8DF89DE0C5D24A4F68D3AD6523B24F4835B9FEE1DB6BE74176EC0C5B3AE307C93D9448F2CF71AC2F7160150ED59AF86C7FE9C019187209A1D6B8A960D1C3189198CE9A443DCF6379412718B38E050203010001", x.GetPublicKeyString (), "GetPublicKeyString");
			Assert.AreEqual (cert, x.GetRawCertData (), "GetRawCertData");
			byte[] serial = { 0x95, 0xF5, 0x2F, 0xE1, 0xF4, 0xC3, 0x0C, 0x4A, 0x91, 0x9A, 0x99, 0x86, 0xD9, 0xCD, 0x8B, 0x74 };
			Assert.AreEqual (serial, x.GetSerialNumber (), "GetSerialNumber");
			Assert.AreEqual ("748BCDD986999A914A0CC3F4E12FF595", x.GetSerialNumberString (), "GetSerialNumberString");
		}