Author: spouliot
Date: 2005-05-03 13:49:30 -0400 (Tue, 03 May 2005)
New Revision: 43962
Added:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoCollectionTest.cs
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ChangeLog
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/EnvelopedCmsTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/KeyTransRecipientInfoTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9ContentTypeTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescriptionTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9MessageDigestTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs
Log:
2005-05-03 Sebastien Pouliot <[EMAIL PROTECTED]>
* ContentInfoTest.cs: Addd test cases for data, envelopedData and
other "bad" cases.
* EnvelopedCmsTest.cs: Added [Category ("NotWorking")] to tests for
which Mono isn't complete enough to execute.
* KeyTransRecipientInfoTest.cs: Added test for EncryptedKey (reference
not copy).
* Pkcs9ContentTypeTest.cs: Removed FIXME (fixed in beta2). Added
CopyFrom tests.
* Pkcs9DocumentDescriptionTest.cs: Removed FIXME (fixed in beta2).
* Pkcs9MessageDigestTest.cs: Added CopyFrom tests.
* SignerInfoCollectionTest.cs: New. Tests for SignerInfoCollection.
* SignerInfoTest.cs: Mark some method/data internal so they can be
reused for other tests.
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ChangeLog
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ChangeLog
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ChangeLog
2005-05-03 17:49:30 UTC (rev 43962)
@@ -1,3 +1,19 @@
+2005-05-03 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * ContentInfoTest.cs: Addd test cases for data, envelopedData and
+ other "bad" cases.
+ * EnvelopedCmsTest.cs: Added [Category ("NotWorking")] to tests for
+ which Mono isn't complete enough to execute.
+ * KeyTransRecipientInfoTest.cs: Added test for EncryptedKey (reference
+ not copy).
+ * Pkcs9ContentTypeTest.cs: Removed FIXME (fixed in beta2). Added
+ CopyFrom tests.
+ * Pkcs9DocumentDescriptionTest.cs: Removed FIXME (fixed in beta2).
+ * Pkcs9MessageDigestTest.cs: Added CopyFrom tests.
+ * SignerInfoCollectionTest.cs: New. Tests for SignerInfoCollection.
+ * SignerInfoTest.cs: Mark some method/data internal so they can be
+ reused for other tests.
+
2005-04-26 Sebastien Pouliot <[EMAIL PROTECTED]>
* AlgorithmIdentifierTest.cs: Complete some test cases. Updated to
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -35,25 +35,22 @@
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
-using Mono.Security;
-
namespace MonoTests.System.Security.Cryptography.Pkcs {
[TestFixture]
- public class ContentInfoTest : Assertion {
+ public class ContentInfoTest {
static string defaultOid = "1.2.840.113549.1.7.1";
static string defaultName = "PKCS 7 Data";
static byte[] asnNull = { 0x05, 0x00 };
- static string asnNullString = "05-00";
[Test]
public void ConstructorContent ()
{
ContentInfo ci = new ContentInfo (asnNull);
- AssertEquals ("Content", asnNullString,
BitConverter.ToString (ci.Content));
- AssertEquals ("ContentType.FriendlyName", defaultName,
ci.ContentType.FriendlyName);
- AssertEquals ("ContentType.Value", defaultOid,
ci.ContentType.Value);
+ Assert.AreEqual (asnNull, ci.Content, "Content");
+ Assert.AreEqual (defaultName,
ci.ContentType.FriendlyName, "ContentType.FriendlyName");
+ Assert.AreEqual (defaultOid, ci.ContentType.Value,
"ContentType.Value");
}
[Test]
@@ -68,12 +65,21 @@
{
Oid o = new Oid (defaultOid);
ContentInfo ci = new ContentInfo (o, asnNull);
- AssertEquals ("Content", asnNullString,
BitConverter.ToString (ci.Content));
- AssertEquals ("ContentType.FriendlyName", defaultName,
ci.ContentType.FriendlyName);
- AssertEquals ("ContentType.Value", defaultOid,
ci.ContentType.Value);
+ Assert.AreEqual (asnNull, ci.Content, "Content");
+ Assert.AreEqual (defaultName,
ci.ContentType.FriendlyName, "ContentType.FriendlyName");
+ Assert.AreEqual (defaultOid, ci.ContentType.Value,
"ContentType.Value");
}
[Test]
+ public void ConstructorNonPkcs7Oid ()
+ {
+ Oid o = new Oid ("1.2.3.4");
+ ContentInfo ci = new ContentInfo (o, asnNull);
+ Assert.AreEqual (asnNull, ci.Content, "Content");
+ Assert.AreEqual ("1.2.3.4", ci.ContentType.Value,
"ContentType.Value");
+ }
+
+ [Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ConstructorOidNullContent ()
{
@@ -89,31 +95,138 @@
}
[Test]
- public void GetContentType_Signature ()
+ public void Oid_ModifyContent ()
{
- byte[] signature = { 0x30, 0x82, 0x03, 0x4C, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02, 0xA0, 0x82, 0x03,
0x3D, 0x30, 0x82, 0x03, 0x39, 0x02, 0x01, 0x01, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x11, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x04, 0x04, 0x02, 0x05,
0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A, 0x30, 0x82, 0x01, 0x97,
0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8,
0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x09, 0x06,
0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x28, 0x31, 0x26, 0x30,
0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73,
0x20, 0x54, 0x65,
+ ContentInfo ci = new ContentInfo (asnNull);
+ Assert.AreEqual (asnNull, ci.Content, "Content-Before");
+ ci.Content[0] = 0x04;
+ Assert.AreEqual (asnNull, ci.Content, "Content-After");
+ // this means we get a copy (not a reference)
+ }
+
+ [Test]
+ [ExpectedException (typeof (CryptographicException))]
+ public void GetContentType_invalid ()
+ {
+ byte[] invalid = { 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x00, 0xA0, 0x0D, 0x04, 0x0B, 0x48, 0x65,
0x6C, 0x6C, 0x6F, 0x20, 0x4D, 0x6F, 0x6E, 0x6F, 0x21 };
+ Oid o = ContentInfo.GetContentType (invalid);
+ Assert.AreEqual ("1.2.840.113549.1.7.0", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ public void GetContentType_data ()
+ {
+ // ASN1 a0 = new ASN1 (0xA0);
+ // a0.Add (new ASN1 (0x04, Encoding.ASCII.GetBytes
("Hello Mono!")));
+ // ASN1 contentInfo = new ASN1 (0x30);
+ // contentInfo.Add (ASN1Convert.FromOid
("1.2.840.113549.1.7.1"));
+ // contentInfo.Add (a0);
+ // byte[] data = contentInfo.GetBytes ();
+ byte[] data = { 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x0D, 0x04, 0x0B, 0x48, 0x65,
0x6C, 0x6C, 0x6F, 0x20, 0x4D, 0x6F, 0x6E, 0x6F, 0x21 };
+ Oid o = ContentInfo.GetContentType (data);
+ Assert.AreEqual ("1.2.840.113549.1.7.1", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ public void GetContentType_signedData ()
+ {
+ byte[] signedData = { 0x30, 0x82, 0x03, 0x4C, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02, 0xA0, 0x82, 0x03,
0x3D, 0x30, 0x82, 0x03, 0x39, 0x02, 0x01, 0x01, 0x31, 0x0B, 0x30, 0x09, 0x06,
0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x11, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x04, 0x04, 0x02, 0x05,
0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A, 0x30, 0x82, 0x01, 0x97,
0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8,
0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x09, 0x06,
0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x28, 0x31, 0x26, 0x30,
0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73,
0x20, 0x54, 0x65,
0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69,
0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29,
0x30, 0x1E, 0x17, 0x0D, 0x30, 0x33, 0x30, 0x38, 0x31, 0x33, 0x30, 0x30, 0x34,
0x33, 0x34, 0x37, 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, 0xD2, 0xCB, 0x47, 0x21, 0xF5, 0x62, 0xDD, 0x35, 0xBF,
0x1D, 0xEC, 0x9A, 0x4C, 0x07, 0x2C, 0x01, 0xF0, 0x28, 0xC2, 0x82, 0x17, 0x8E,
0x58, 0x32,
0xD5, 0x4C, 0xAC, 0x86, 0xB4, 0xC9, 0xEB, 0x21,
0x26, 0xF3, 0x22, 0x30, 0xC5, 0x7A, 0xA3, 0x5A, 0xDD, 0x53, 0xAB, 0x1C, 0x06,
0x3E, 0xB2, 0x13, 0xC4, 0x05, 0x1D, 0x95, 0x8B, 0x0A, 0x71, 0x71, 0x11, 0xA7,
0x47, 0x26, 0x61, 0xF1, 0x76, 0xBE, 0x35, 0x72, 0x32, 0xC5, 0xCB, 0x47, 0xA4,
0x22, 0x41, 0x1E, 0xAD, 0x29, 0x11, 0x0D, 0x39, 0x22, 0x0C, 0x79, 0x90, 0xC6,
0x52, 0xA1, 0x10, 0xF6, 0x55, 0x09, 0x4E, 0x51, 0x26, 0x47, 0x0E, 0x94, 0xE6,
0x81, 0xF5, 0x18, 0x6B, 0x99, 0xF0, 0x76, 0xF3, 0xB2, 0x4C, 0x91, 0xE9, 0xBA,
0x3B, 0x3F, 0x6E, 0x63, 0xDA, 0x12, 0xD1, 0x0B, 0x73, 0x0E, 0x12, 0xC7, 0x70,
0x77, 0x22, 0x03, 0x9D, 0x5D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x72, 0x30,
0x70, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06,
0x08, 0x2B,
0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30,
0x59, 0x06, 0x03, 0x55, 0x1D, 0x01, 0x04, 0x52, 0x30, 0x50, 0x80, 0x10, 0xAE,
0xD7, 0x80, 0x88, 0xA6, 0x3D, 0xBA, 0x50, 0xA1, 0x7E, 0x57, 0xE5, 0x40, 0xC9,
0x6F, 0xC5, 0xA1, 0x2A, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63,
0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63,
0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x82, 0x10, 0x9D, 0xAE, 0xA3, 0x39,
0x47, 0x0E, 0xD4, 0xA2, 0x49, 0x78, 0xEA, 0x6C, 0xBA, 0x0D, 0xDE, 0x9C, 0x30,
0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x03, 0x81, 0x81,
0x00, 0x32, 0x8A, 0x7E, 0xAD, 0xE7, 0x67, 0x9E, 0x5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0x97, 0xB5, 0x00, 0x97, 0x30, 0x09,
0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81,
0x80, 0x45, 0x88, 0x80, 0x58, 0xC7, 0x4F, 0xE4, 0xD8, 0x88, 0xB0, 0xC0, 0x08,
0x70, 0x84, 0xCC, 0x8E, 0xA7, 0xF1, 0xA4, 0x07, 0x41, 0x14, 0x3E, 0xF5, 0xEA,
0x6E, 0x05, 0x75, 0xB8, 0x58, 0xAA, 0x5C, 0x0E, 0xFD, 0x7A, 0x07, 0x09, 0xE1,
0x80, 0x94,
0xBD, 0xAA, 0x45, 0xBB, 0x55, 0x9C, 0xC2, 0xD9,
0x72, 0x14, 0x4B, 0xA4, 0x64, 0xFB, 0x38, 0x9F, 0xD3, 0x22, 0xED, 0xB3, 0x0B,
0xF7, 0xAE, 0x4D, 0xE6, 0x65, 0x4D, 0x2A, 0x31, 0x18, 0xB5, 0xB4, 0x2D, 0x9E,
0x4E, 0xD7, 0xC0, 0x44, 0x5F, 0xAC, 0x43, 0xDC, 0x4F, 0x3D, 0x6D, 0x2C, 0x8C,
0xA1, 0xFE, 0x08, 0x38, 0xB7, 0xC4, 0xC4, 0x08, 0xDB, 0xF8, 0xF0, 0xC1, 0x55,
0x54, 0x49, 0x9D, 0xA4, 0x7F, 0x76, 0xDE, 0xF4, 0x29, 0x1C, 0x0B, 0x95, 0x10,
0x90, 0xB5, 0x0A, 0x9A, 0xEC, 0xCA, 0x89, 0x9A, 0x85, 0x92, 0x76, 0x78, 0x6F,
0x97, 0x67 };
- Oid o = ContentInfo.GetContentType (signature);
- AssertEquals ("GetContentType", "1.2.840.113549.1.7.2",
o.Value);
+ Oid o = ContentInfo.GetContentType (signedData);
+ Assert.AreEqual ("1.2.840.113549.1.7.2", o.Value,
"GetContentType");
}
[Test]
+ public void GetContentType_envelopedData ()
+ {
+ byte[] envelopedData = { 0x30, 0x82, 0x01, 0x1C, 0x06,
0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x03, 0xA0, 0x82, 0x01,
0x0D, 0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6, 0x30, 0x81,
0xD3, 0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06,
0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54,
0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69,
0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 0x10, 0x91, 0xC4,
0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00,
0x97, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01,
0x01, 0x05, 0x00, 0x04, 0x81, 0x80, 0xCA, 0x4B, 0x97, 0x9C, 0xAB, 0x79, 0xC6,
0xDF, 0x6A, 0x27, 0xC7, 0x24, 0xC4, 0x5E, 0x3B, 0x31, 0xAD, 0xBC, 0x25, 0xE6,
0x38, 0x5E, 0x79, 0x26, 0x0E, 0x68, 0x46, 0x1D, 0x21, 0x81, 0x38, 0x92, 0xEC,
0xCB, 0x7C, 0x91, 0xD6, 0x09, 0x38, 0x91, 0xCE, 0x50, 0x5B, 0x70, 0x31, 0
xB0, 0x9F, 0xFC, 0xE2, 0xEE, 0x45, 0xBC, 0x4B, 0xF8, 0x9A, 0xD9, 0xEE, 0xE7,
0x4A, 0x3D, 0xCD, 0x8D, 0xFF, 0x10, 0xAB, 0xC8, 0x19, 0x05, 0x54, 0x5E, 0x40,
0x7A, 0xBE, 0x2B, 0xD7, 0x22, 0x97, 0xF3, 0x23, 0xAF, 0x50, 0xF5, 0xEB, 0x43,
0x06, 0xC3, 0xFB, 0x17, 0xCA, 0xBD, 0xAD, 0x28, 0xD8, 0x10, 0x0F, 0x61, 0xCE,
0xF8, 0x25, 0x70, 0xF6, 0xC8, 0x1E, 0x7F, 0x82, 0xE5, 0x94, 0xEB, 0x11, 0xBF,
0xB8, 0x6F, 0xEE, 0x79, 0xCD, 0x63, 0xDD, 0x59, 0x8D, 0x25, 0x0E, 0x78, 0x55,
0xCE, 0x21, 0xBA, 0x13, 0x6B, 0x30, 0x2B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x07, 0x01, 0x30, 0x14, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88, 0x9C, 0x05,
0x72, 0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 };
+ Oid o = ContentInfo.GetContentType (envelopedData);
+ Assert.AreEqual ("1.2.840.113549.1.7.3", o.Value,
"GetContentType");
+ }
+
+ [Test]
[ExpectedException (typeof (CryptographicException))]
+ public void GetContentType_signedAndEnvelopedData ()
+ {
+ // Note: signedAndEnvelopedData isn't defined in RFC2630
+ byte[] signedAndEnvelopedData = { 0x30, 0x82, 0x01,
0x1C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x04, 0xA0,
0x82, 0x01, 0x0D, 0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6,
0x30, 0x81, 0xD3, 0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30,
0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4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, 0x55, 0xCE, 0x21, 0xBA, 0x13, 0x6B, 0x30, 0x2B, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0x30, 0x14, 0x06, 0x08, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88,
0x9C, 0x05, 0x72, 0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 };
+ Oid o = ContentInfo.GetContentType
(signedAndEnvelopedData);
+ Assert.AreEqual ("1.2.840.113549.1.7.4", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ [Ignore ("need a working sample")]
+ public void GetContentType_digestedData ()
+ {
+ /*ASN1 eci = new ASN1 (0x30);
+ eci.Add (ASN1Convert.FromOid ("1.2.840.113549.1.7.1"));
+ eci.Add (new ASN1 (0x05));
+ ASN1 dData = new ASN1 (0x30);
+ dData.Add (new ASN1 (0x02, new byte[1] { 2 }));
+ dData.Add (PKCS7.AlgorithmIdentifier
(CryptoConfig.MapNameToOID ("SHA1")));
+ ASN1 a0 = new ASN1 (0xA0);
+ a0.Add (dData);
+ ASN1 contentInfo = new ASN1 (0x30);
+ contentInfo.Add (ASN1Convert.FromOid
("1.2.840.113549.1.7.5"));
+ contentInfo.Add (a0);
+ byte[] digestedData = contentInfo.GetBytes ();*/
+
+ byte[] digestedData = null;
+ Oid o = ContentInfo.GetContentType (digestedData);
+ Assert.AreEqual ("1.2.840.113549.1.7.5", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ [Ignore ("need a working sample")]
+ public void GetContentType_encryptedData ()
+ {
+ /* ASN1 eci = new ASN1 (0x30);
+ eci.Add (ASN1Convert.FromOid ("1.2.840.113549.1.7.1"));
+ eci.Add (PKCS7.AlgorithmIdentifier
("1.2.840.113549.1.1.1"));
+ ASN1 eData = new ASN1 (0x30);
+ eData.Add (new ASN1 (0x02, new byte[1] { 2 }));
+ eData.Add (eci);
+ ASN1 a0 = new ASN1 (0xA0);
+ a0.Add (eci);
+ ASN1 contentInfo = new ASN1 (0x30);
+ contentInfo.Add (ASN1Convert.FromOid
("1.2.840.113549.1.7.6"));
+ contentInfo.Add (a0);
+ byte[] encryptedData = contentInfo.GetBytes (); */
+
+ byte[] encryptedData = null;
+ Oid o = ContentInfo.GetContentType (encryptedData);
+ Assert.AreEqual ("1.2.840.113549.1.7.6", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ [ExpectedException (typeof (CryptographicException))]
+ public void GetContentType_unknown ()
+ {
+ byte[] unknown = { 0x30, 0x1A, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x07, 0xA0, 0x0D, 0x04, 0x0B, 0x48, 0x65,
0x6C, 0x6C, 0x6F, 0x20, 0x4D, 0x6F, 0x6E, 0x6F, 0x21 };
+ Oid o = ContentInfo.GetContentType (unknown);
+ Assert.AreEqual ("1.2.840.113549.1.7.7", o.Value,
"GetContentType");
+ }
+
+ [Test]
+ [ExpectedException (typeof (CryptographicException))]
public void GetContentTypeBadASN1 ()
{
// ContentInfo ::= SEQUENCE {
- ASN1 contentInfo = new ASN1 (0x30);
// contentType ContentType, -> ContentType ::= OBJECT
IDENTIFIER
- contentInfo.Add (ASN1Convert.FromOid (defaultOid));
// content [0] EXPLICIT ANY DEFINED BY contentType
OPTIONAL
- contentInfo.Add (new ASN1 (asnNull));
+
+ // Generated using Mono.Security.dll and the following
code
+ byte [] badasn = new byte [] { 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0x05, 0x00 };
+ // ASN1 contentInfo = new ASN1 (0x30);
+ // contentInfo.Add (ASN1Convert.FromOid (defaultOid));
+ // contentInfo.Add (new ASN1 (asnNull));
- Oid o = ContentInfo.GetContentType
(contentInfo.GetBytes ());
+ Oid o = ContentInfo.GetContentType (badasn);
}
[Test]
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/EnvelopedCmsTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/EnvelopedCmsTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/EnvelopedCmsTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -41,7 +41,7 @@
namespace MonoTests.System.Security.Cryptography.Pkcs {
[TestFixture]
- public class EnvelopedPkcs7Test : Assertion {
+ public class EnvelopedCmsTest : Assertion {
static byte[] asnNull = { 0x05, 0x00 };
static string tdesOid = "1.2.840.113549.3.7";
@@ -189,6 +189,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void Decode ()
{
byte[] encoded = { 0x30, 0x82, 0x01, 0x1C, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x03, 0xA0, 0x82, 0x01, 0x0D,
0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6, 0x30, 0x81, 0xD3,
0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03,
0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E,
0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 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, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88, 0x9C, 0x05, 0x72,
0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 };
@@ -227,6 +228,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void Decrypt ()
{
byte[] encoded = { 0x30, 0x82, 0x01, 0x1C, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x03, 0xA0, 0x82, 0x01, 0x0D,
0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6, 0x30, 0x81, 0xD3,
0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03,
0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E,
0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 0x10, 0x91, 0xC4, 0x4B,
0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97,
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
0x05, 0x00, 0x04, 0x81, 0x80, 0xCA, 0x4B, 0x97, 0x9C, 0xAB, 0x79, 0xC6, 0xDF,
0x6A, 0x27, 0xC7, 0x24, 0xC4, 0x5E, 0x3B, 0x31, 0xAD, 0xBC, 0x25, 0xE6, 0x38,
0x5E, 0x79, 0x26, 0x0E, 0x68, 0x46, 0x1D, 0x21, 0x81, 0x38, 0x92, 0xEC, 0xCB,
0x7C, 0x91, 0xD6, 0x09, 0x38, 0x91, 0xCE, 0x50, 0x5B, 0x70, 0x31, 0xB0, 0
x9F, 0xFC, 0xE2, 0xEE, 0x45, 0xBC, 0x4B, 0xF8, 0x9A, 0xD9, 0xEE, 0xE7, 0x4A,
0x3D, 0xCD, 0x8D, 0xFF, 0x10, 0xAB, 0xC8, 0x19, 0x05, 0x54, 0x5E, 0x40, 0x7A,
0xBE, 0x2B, 0xD7, 0x22, 0x97, 0xF3, 0x23, 0xAF, 0x50, 0xF5, 0xEB, 0x43, 0x06,
0xC3, 0xFB, 0x17, 0xCA, 0xBD, 0xAD, 0x28, 0xD8, 0x10, 0x0F, 0x61, 0xCE, 0xF8,
0x25, 0x70, 0xF6, 0xC8, 0x1E, 0x7F, 0x82, 0xE5, 0x94, 0xEB, 0x11, 0xBF, 0xB8,
0x6F, 0xEE, 0x79, 0xCD, 0x63, 0xDD, 0x59, 0x8D, 0x25, 0x0E, 0x78, 0x55, 0xCE,
0x21, 0xBA, 0x13, 0x6B, 0x30, 0x2B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x01, 0x07, 0x01, 0x30, 0x14, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7,
0x0D, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88, 0x9C, 0x05, 0x72,
0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 };
@@ -306,6 +308,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void EncryptCmsRecipientIssuerAndSerialNumber ()
{
ContentInfo ci = new ContentInfo (asnNull);
@@ -324,6 +327,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void EncryptCmsRecipientSubjectKeyIdentifier ()
{
ContentInfo ci = new ContentInfo (asnNull);
@@ -342,6 +346,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void EncryptCmsRecipientUnknown ()
{
ContentInfo ci = new ContentInfo (asnNull);
@@ -360,6 +365,7 @@
}
[Test]
+ [Category ("NotWorking")]
[ExpectedException (typeof (CryptographicException))]
public void EncryptEmpty ()
{
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/KeyTransRecipientInfoTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/KeyTransRecipientInfoTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/KeyTransRecipientInfoTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -71,6 +71,7 @@
}
[Test]
+ [Category ("NotWorking")]
public void SubjectKeyIdentifier ()
{
KeyTransRecipientInfo ktri = GetKeyTransRecipientInfo
(subjectKeyIdentifier);
@@ -84,6 +85,16 @@
AssertEquals ("Type", RecipientInfoType.KeyTransport,
ktri.Type);
AssertEquals ("Version", 2, ktri.Version);
}
+
+ [Test]
+ public void EncryptedKey_ModifyContent ()
+ {
+ KeyTransRecipientInfo ktri = GetKeyTransRecipientInfo
(issuerAndSerialNumber);
+ AssertEquals ("EncryptedKey",
"CA-4B-97-9C-AB-79-C6-DF-6A-27-C7-24-C4-5E-3B-31-AD-BC-25-E6-38-5E-79-26-0E-68-46-1D-21-81-38-92-EC-CB-7C-91-D6-09-38-91-CE-50-5B-70-31-B0-9F-FC-E2-EE-45-BC-4B-F8-9A-D9-EE-E7-4A-3D-CD-8D-FF-10-AB-C8-19-05-54-5E-40-7A-BE-2B-D7-22-97-F3-23-AF-50-F5-EB-43-06-C3-FB-17-CA-BD-AD-28-D8-10-0F-61-CE-F8-25-70-F6-C8-1E-7F-82-E5-94-EB-11-BF-B8-6F-EE-79-CD-63-DD-59-8D-25-0E-78-55-CE-21-BA-13-6B",
BitConverter.ToString (ktri.EncryptedKey));
+ ktri.EncryptedKey[0] = 0x00;
+ AssertEquals ("EncryptedKey",
"00-4B-97-9C-AB-79-C6-DF-6A-27-C7-24-C4-5E-3B-31-AD-BC-25-E6-38-5E-79-26-0E-68-46-1D-21-81-38-92-EC-CB-7C-91-D6-09-38-91-CE-50-5B-70-31-B0-9F-FC-E2-EE-45-BC-4B-F8-9A-D9-EE-E7-4A-3D-CD-8D-FF-10-AB-C8-19-05-54-5E-40-7A-BE-2B-D7-22-97-F3-23-AF-50-F5-EB-43-06-C3-FB-17-CA-BD-AD-28-D8-10-0F-61-CE-F8-25-70-F6-C8-1E-7F-82-E5-94-EB-11-BF-B8-6F-EE-79-CD-63-DD-59-8D-25-0E-78-55-CE-21-BA-13-6B",
BitConverter.ToString (ktri.EncryptedKey));
+ // this is a reference (not a copy) of the key
+ }
}
}
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9ContentTypeTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9ContentTypeTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9ContentTypeTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -35,6 +35,8 @@
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
+using Mono.Security;
+
namespace MonoTests.System.Security.Cryptography.Pkcs {
[TestFixture]
@@ -47,26 +49,49 @@
Assert.AreEqual ("1.2.840.113549.1.9.3", ct.Oid.Value,
"Oid.Value");
Assert.AreEqual ("Content Type", ct.Oid.FriendlyName,
"Oid.FriendlyName");
Assert.IsNull (ct.RawData, "RawData");
+ Assert.IsNull (ct.ContentType, "ContentType");
Assert.AreEqual (String.Empty, ct.Format (true),
"Format(true)");
Assert.AreEqual (String.Empty, ct.Format (false),
"Format(false)");
}
[Test]
- [Category ("NotDotNet")] // MS throws [ExpectedException
(typeof (NullReferenceException))]
- public void Constructor_Empty_ContentType ()
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CopyFrom_Null ()
{
+ new Pkcs9ContentType ().CopyFrom (null);
+ }
+
+ [Test]
+ public void CopyFrom ()
+ {
+ /* byte[] data = ASN1Convert.FromOid
("1.2.840.113549.1.7.1").GetBytes (); */
+ byte[] data = { 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x01, 0x07, 0x01 };
+ AsnEncodedData aed = new AsnEncodedData (data);
Pkcs9ContentType ct = new Pkcs9ContentType ();
- Assert.IsNull (ct.ContentType, "ContentType");
+ ct.CopyFrom (aed);
+ Assert.AreEqual ("1.2.840.113549.1.7.1",
ct.ContentType.Value, "ContentType");
+ Assert.IsNull (ct.Oid, "Oid");
+ Assert.AreEqual (data, ct.RawData, "RawData");
}
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void CopyFrom_Null ()
+ [ExpectedException (typeof (CryptographicException))]
+ public void CopyFrom_BadData ()
{
- new Pkcs9ContentType ().CopyFrom (null);
+ /* Note: this is the full structure (but only the OID
part is required)
+ ASN1 set = new ASN1 (0x30);
+ set.Add (ASN1Convert.FromOid ("1.2.840.113549.1.7.1"));
+ ASN1 p9 = new ASN1 (0x30);
+ p9.Add (ASN1Convert.FromOid ("1.2.840.113549.1.9.3"));
+ p9.Add (set);
+ byte[] data = p9.GetBytes ();*/
+ byte[] data = { 0x30, 0x18, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01 };
+ AsnEncodedData aed = new AsnEncodedData (data);
+ Pkcs9ContentType ct = new Pkcs9ContentType ();
+ ct.CopyFrom (aed);
+ // CopyFrom works, but the exception comes when
accessing the ContentType property
+ Assert.IsNull (ct.ContentType);
}
-
- // TODO - more tests were Pkcs9ContentType is created indirectly
}
}
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescriptionTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescriptionTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescriptionTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -48,20 +48,12 @@
Assert.AreEqual ("1.3.6.1.4.1.311.88.2.2",
dd.Oid.Value, "Oid.Value");
Assert.IsNull (dd.Oid.FriendlyName, "Oid.FriendlyName");
Assert.IsNull (dd.RawData, "RawData");
+ Assert.IsNull (dd.DocumentDescription,
"DocumentDescription");
Assert.AreEqual (String.Empty, dd.Format (true),
"Format(true)");
Assert.AreEqual (String.Empty, dd.Format (false),
"Format(false)");
}
[Test]
- // FIXME: throws a NullReferenceException in beta 1 - still
true in Dec CTP
- [Category ("NotDotNet")] // MS throws [ExpectedException
(typeof (NullReferenceException))]
- public void Constructor_Empty_MessageDigest ()
- {
- Pkcs9DocumentDescription dd = new
Pkcs9DocumentDescription ();
- Assert.IsNull (dd.DocumentDescription,
"DocumentDescription");
- }
-
- [Test]
public void Constructor_String ()
{
Pkcs9DocumentDescription dd = new
Pkcs9DocumentDescription ("mono");
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9MessageDigestTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9MessageDigestTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9MessageDigestTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -47,26 +47,58 @@
Assert.AreEqual ("1.2.840.113549.1.9.4", md.Oid.Value,
"Oid.Value");
Assert.AreEqual ("Message Digest", md.Oid.FriendlyName,
"Oid.FriendlyName");
Assert.IsNull (md.RawData, "RawData");
+ Assert.IsNull (md.MessageDigest, "MessageDigest");
Assert.AreEqual (String.Empty, md.Format (true),
"Format(true)");
Assert.AreEqual (String.Empty, md.Format (false),
"Format(false)");
}
[Test]
- [Category ("NotDotNet")] // MS throws [ExpectedException
(typeof (NullReferenceException))]
- public void Constructor_Empty_MessageDigest ()
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CopyFrom_Null ()
{
+ new Pkcs9MessageDigest ().CopyFrom (null);
+ }
+
+ [Test]
+ public void CopyFrom ()
+ {
+ byte[] data = { 0x04, 0x10, 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
+ AsnEncodedData aed = new AsnEncodedData (data);
Pkcs9MessageDigest md = new Pkcs9MessageDigest ();
- Assert.IsNull (md.MessageDigest, "MessageDigest");
+ md.CopyFrom (aed);
+ Assert.AreEqual
("00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F", BitConverter.ToString
(md.MessageDigest), "MessageDigest");
+ Assert.IsNull (md.Oid, "Oid");
+ // null ??? reported as FDBK25795
+ //
http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=15bb72f0-22dd-4911-846e-143d6038c7cf
+ Assert.AreEqual (data, md.RawData, "RawData");
}
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void CopyFrom_Null ()
+ [ExpectedException (typeof (CryptographicException))]
+ public void CopyFrom_BadData ()
{
- new Pkcs9MessageDigest ().CopyFrom (null);
+ byte[] data = { 0x30, 0x18, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86,
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01 };
+ AsnEncodedData aed = new AsnEncodedData (data);
+ Pkcs9MessageDigest md = new Pkcs9MessageDigest ();
+ md.CopyFrom (aed);
+ // CopyFrom works, but the exception comes when
accessing the ContentType property
+ Assert.IsNull (md.MessageDigest);
}
- // TODO - more tests were Pkcs9MessageDigest is created
indirectly
+ [Test]
+ public void MessageDigest_ModifyContent ()
+ {
+ byte[] data = { 0x04, 0x10, 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
+ AsnEncodedData aed = new AsnEncodedData (data);
+ Pkcs9MessageDigest md = new Pkcs9MessageDigest ();
+ md.CopyFrom (aed);
+ Assert.AreEqual
("00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F", BitConverter.ToString
(md.MessageDigest), "MessageDigest-Before");
+ md.MessageDigest[0] = 0xFF;
+ Assert.AreEqual
("FF-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F", BitConverter.ToString
(md.MessageDigest), "MessageDigest-After");
+ // this is a reference - not a copy ?!?!
+ // reported as FDBK25793
+ //
http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=8d95cf6d-24f4-4920-b95d-19fa04994578
+ }
}
}
Added:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoCollectionTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoCollectionTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoCollectionTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -0,0 +1,139 @@
+//
+// SignerInfoCollectionTest.cs - NUnit tests for SignerInfoCollection
+//
+// Author:
+// Sebastien Pouliot <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Security.Cryptography.Pkcs;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography.Xml;
+
+namespace MonoTests.System.Security.Cryptography.Pkcs {
+
+ [TestFixture]
+ public class SignerInfoCollectionTest {
+
+ private SignerInfoCollection GetCollection ()
+ {
+ SignerInfo si = SignerInfoTest.GetSignerInfo
(SignerInfoTest.subjectKeyIdentifierSignature);
+ return si.CounterSignerInfos;
+ }
+
+ [Test]
+ public void EmptyCollection ()
+ {
+ SignerInfoCollection sic = GetCollection ();
+ Assert.AreEqual (0, sic.Count, "Count");
+ Assert.IsFalse (sic.IsSynchronized, "IsSynchronized");
+ Assert.IsNotNull (sic.SyncRoot, "SyncRoot");
+ Assert.IsNotNull (sic.GetEnumerator (),
"GetEnumerator");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void Indexer_MinusOne ()
+ {
+ SignerInfoCollection sic = GetCollection ();
+ Assert.IsNotNull (sic[-1]);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void Indexer_One ()
+ {
+ SignerInfoCollection sic = GetCollection ();
+ Assert.IsNotNull (sic[1]);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CopyTo_ArrayInt_Null ()
+ {
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo ((Array)null, 0);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void CopyTo_ArrayInt_MinusOne ()
+ {
+ ArrayList al = new ArrayList ();
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo (al.ToArray (), -1);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void CopyTo_ArrayInt_One ()
+ {
+ ArrayList al = new ArrayList ();
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo (al.ToArray (), 1);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CopyTo_SignerInfoInt_Null ()
+ {
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo ((SignerInfo[])null, 0);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void CopyTo_SignerInfoInt_MinusOne ()
+ {
+ SignerInfo[] sis = new SignerInfo[1];
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo (sis, -1);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void CopyTo_SignerInfoInt_One ()
+ {
+ SignerInfo[] sis = new SignerInfo[1];
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo (sis, 1);
+ }
+
+ [Test]
+ public void CopyTo_SignerInfoInt_Zero ()
+ {
+ SignerInfo[] sis = new SignerInfo[1];
+ SignerInfoCollection sic = GetCollection ();
+ sic.CopyTo (sis, 0);
+ }
+ }
+}
+
+#endif
\ No newline at end of file
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs
2005-05-03 17:47:24 UTC (rev 43961)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs
2005-05-03 17:49:30 UTC (rev 43962)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -47,7 +47,7 @@
static string sha1Oid = "1.3.14.3.2.26";
static string sha1Name = "sha1";
- static byte[] issuerAndSerialNumberSignature = { 0x30, 0x82,
0x03, 0x4C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02,
0xA0, 0x82, 0x03, 0x3D, 0x30, 0x82, 0x03, 0x39, 0x02, 0x01, 0x01, 0x31, 0x0B,
0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x11,
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x04,
0x04, 0x02, 0x05, 0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A, 0x30,
0x82, 0x01, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4, 0x4B,
0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97,
0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x28,
0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F,
0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
+ static internal byte[] issuerAndSerialNumberSignature = { 0x30,
0x82, 0x03, 0x4C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07,
0x02, 0xA0, 0x82, 0x03, 0x3D, 0x30, 0x82, 0x03, 0x39, 0x02, 0x01, 0x01, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30,
0x11, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0,
0x04, 0x04, 0x02, 0x05, 0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A,
0x30, 0x82, 0x01, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4,
0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00,
0x97, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30,
0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D,
0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65,
0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x30,
0x1E, 0x17, 0x0D, 0x30, 0x33, 0x30, 0x38, 0x31, 0x33, 0x30, 0x30, 0x34, 0x33,
0x34, 0x37, 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, 0xD2, 0xCB, 0x47, 0x21, 0xF5, 0x62, 0xDD, 0x35, 0xBF, 0x1D,
0xEC, 0x9A, 0x4C, 0x07, 0x2C, 0x01, 0xF0, 0x28, 0xC2, 0x82, 0x17, 0x8E, 0x58,
0x32,
0xD5, 0x4C, 0xAC, 0x86, 0xB4, 0xC9, 0xEB, 0x21, 0x26,
0xF3, 0x22, 0x30, 0xC5, 0x7A, 0xA3, 0x5A, 0xDD, 0x53, 0xAB, 0x1C, 0x06, 0x3E,
0xB2, 0x13, 0xC4, 0x05, 0x1D, 0x95, 0x8B, 0x0A, 0x71, 0x71, 0x11, 0xA7, 0x47,
0x26, 0x61, 0xF1, 0x76, 0xBE, 0x35, 0x72, 0x32, 0xC5, 0xCB, 0x47, 0xA4, 0x22,
0x41, 0x1E, 0xAD, 0x29, 0x11, 0x0D, 0x39, 0x22, 0x0C, 0x79, 0x90, 0xC6, 0x52,
0xA1, 0x10, 0xF6, 0x55, 0x09, 0x4E, 0x51, 0x26, 0x47, 0x0E, 0x94, 0xE6, 0x81,
0xF5, 0x18, 0x6B, 0x99, 0xF0, 0x76, 0xF3, 0xB2, 0x4C, 0x91, 0xE9, 0xBA, 0x3B,
0x3F, 0x6E, 0x63, 0xDA, 0x12, 0xD1, 0x0B, 0x73, 0x0E, 0x12, 0xC7, 0x70, 0x77,
0x22, 0x03, 0x9D, 0x5D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x72, 0x30, 0x70,
0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08,
0x2B,
0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x59,
0x06, 0x03, 0x55, 0x1D, 0x01, 0x04, 0x52, 0x30, 0x50, 0x80, 0x10, 0xAE, 0xD7,
0x80, 0x88, 0xA6, 0x3D, 0xBA, 0x50, 0xA1, 0x7E, 0x57, 0xE5, 0x40, 0xC9, 0x6F,
0xC5, 0xA1, 0x2A, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04,
0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68,
0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E,
0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x82, 0x10, 0x9D, 0xAE, 0xA3, 0x39, 0x47,
0x0E, 0xD4, 0xA2, 0x49, 0x78, 0xEA, 0x6C, 0xBA, 0x0D, 0xDE, 0x9C, 0x30, 0x09,
0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00,
0x32, 0x8A, 0x7E, 0xAD, 0xE7, 0x67, 0x9E, 0x5C, 0x4C, 0xD8, 0x33, 0x59, 0x68,
0xCF,
@@ -55,7 +55,7 @@
0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E,
0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28,
0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8,
0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x09, 0x06,
0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x0D, 0x06, 0x09, 0x2A,
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81, 0x80,
0x45, 0x88, 0x80, 0x58, 0xC7, 0x4F, 0xE4, 0xD8, 0x88, 0xB0, 0xC0, 0x08, 0x70,
0x84, 0xCC, 0x8E, 0xA7, 0xF1, 0xA4, 0x07, 0x41, 0x14, 0x3E, 0xF5, 0xEA, 0x6E,
0x05, 0x75, 0xB8, 0x58, 0xAA, 0x5C, 0x0E, 0xFD, 0x7A, 0x07, 0x09, 0xE1, 0x80,
0x94,
0xBD, 0xAA, 0x45, 0xBB, 0x55, 0x9C, 0xC2, 0xD9, 0x72,
0x14, 0x4B, 0xA4, 0x64, 0xFB, 0x38, 0x9F, 0xD3, 0x22, 0xED, 0xB3, 0x0B, 0xF7,
0xAE, 0x4D, 0xE6, 0x65, 0x4D, 0x2A, 0x31, 0x18, 0xB5, 0xB4, 0x2D, 0x9E, 0x4E,
0xD7, 0xC0, 0x44, 0x5F, 0xAC, 0x43, 0xDC, 0x4F, 0x3D, 0x6D, 0x2C, 0x8C, 0xA1,
0xFE, 0x08, 0x38, 0xB7, 0xC4, 0xC4, 0x08, 0xDB, 0xF8, 0xF0, 0xC1, 0x55, 0x54,
0x49, 0x9D, 0xA4, 0x7F, 0x76, 0xDE, 0xF4, 0x29, 0x1C, 0x0B, 0x95, 0x10, 0x90,
0xB5, 0x0A, 0x9A, 0xEC, 0xCA, 0x89, 0x9A, 0x85, 0x92, 0x76, 0x78, 0x6F, 0x97,
0x67 };
- static byte[] subjectKeyIdentifierSignature = { 0x30, 0x82,
0x03, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x02,
0xA0, 0x82, 0x03, 0x15, 0x30, 0x82, 0x03, 0x11, 0x02, 0x01, 0x03, 0x31, 0x0B,
0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30, 0x11,
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0, 0x04,
0x04, 0x02, 0x05, 0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A, 0x30,
0x82, 0x01, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4, 0x4B,
0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97,
0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30, 0x28,
0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F,
0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
+ static internal byte[] subjectKeyIdentifierSignature = { 0x30,
0x82, 0x03, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07,
0x02, 0xA0, 0x82, 0x03, 0x15, 0x30, 0x82, 0x03, 0x11, 0x02, 0x01, 0x03, 0x31,
0x0B, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x30,
0x11, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0xA0,
0x04, 0x04, 0x02, 0x05, 0x00, 0xA0, 0x82, 0x02, 0x2E, 0x30, 0x82, 0x02, 0x2A,
0x30, 0x82, 0x01, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x91, 0xC4,
0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00,
0x97, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x1D, 0x05, 0x00, 0x30,
0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D,
0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65,
0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65,
0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x30,
0x1E, 0x17, 0x0D, 0x30, 0x33, 0x30, 0x38, 0x31, 0x33, 0x30, 0x30, 0x34, 0x33,
0x34, 0x37, 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, 0xD2, 0xCB, 0x47, 0x21, 0xF5, 0x62, 0xDD, 0x35, 0xBF, 0x1D,
0xEC, 0x9A, 0x4C, 0x07, 0x2C, 0x01, 0xF0, 0x28, 0xC2, 0x82, 0x17, 0x8E, 0x58,
0x32,
0xD5, 0x4C, 0xAC, 0x86, 0xB4, 0xC9, 0xEB, 0x21, 0x26,
0xF3, 0x22, 0x30, 0xC5, 0x7A, 0xA3, 0x5A, 0xDD, 0x53, 0xAB, 0x1C, 0x06, 0x3E,
0xB2, 0x13, 0xC4, 0x05, 0x1D, 0x95, 0x8B, 0x0A, 0x71, 0x71, 0x11, 0xA7, 0x47,
0x26, 0x61, 0xF1, 0x76, 0xBE, 0x35, 0x72, 0x32, 0xC5, 0xCB, 0x47, 0xA4, 0x22,
0x41, 0x1E, 0xAD, 0x29, 0x11, 0x0D, 0x39, 0x22, 0x0C, 0x79, 0x90, 0xC6, 0x52,
0xA1, 0x10, 0xF6, 0x55, 0x09, 0x4E, 0x51, 0x26, 0x47, 0x0E, 0x94, 0xE6, 0x81,
0xF5, 0x18, 0x6B, 0x99, 0xF0, 0x76, 0xF3, 0xB2, 0x4C, 0x91, 0xE9, 0xBA, 0x3B,
0x3F, 0x6E, 0x63, 0xDA, 0x12, 0xD1, 0x0B, 0x73, 0x0E, 0x12, 0xC7, 0x70, 0x77,
0x22, 0x03, 0x9D, 0x5D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x72, 0x30, 0x70,
0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08,
0x2B,
0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x59,
0x06, 0x03, 0x55, 0x1D, 0x01, 0x04, 0x52, 0x30, 0x50, 0x80, 0x10, 0xAE, 0xD7,
0x80, 0x88, 0xA6, 0x3D, 0xBA, 0x50, 0xA1, 0x7E, 0x57, 0xE5, 0x40, 0xC9, 0x6F,
0xC5, 0xA1, 0x2A, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04,
0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68,
0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E,
0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x82, 0x10, 0x9D, 0xAE,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 0xC4, 0xC4, 0x08, 0xDB, 0xF8, 0xF0, 0xC1, 0x55, 0x54, 0x49,
0x9D, 0xA4, 0x7F, 0x76, 0xDE, 0xF4, 0x29, 0x1C, 0x0B, 0x95, 0x10, 0x90, 0xB5,
0x0A, 0x9A, 0xEC, 0xCA, 0x89, 0x9A, 0x85, 0x92, 0x76, 0x78, 0x6F, 0x97, 0x67 };
- private SignerInfo GetSignerInfo (byte[] signature)
+ static internal SignerInfo GetSignerInfo (byte[] signature)
{
SignedCms sp = new SignedCms ();
sp.Decode (signature);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches