Buffer sizes
[mono.git] / mcs / class / corlib / Test / System.Security.Cryptography / SignatureDescriptionTest.cs
index 80fd2129a93104144e11d8c3c47b639f1a06a251..05822a721172c5d6fd4b423cc609d5f101396808 100644 (file)
@@ -15,14 +15,15 @@ using System.Security.Cryptography;
 
 namespace MonoTests.System.Security.Cryptography {
 
+[TestFixture]
 public class SignatureDescriptionTest : Assertion {
 
        protected SignatureDescription sig;
        protected static DSA dsa;
        protected static RSA rsa;
 
-       [Setup]
-       void SetUp () 
+       [SetUp]
+       public void SetUp () 
        {
                sig = new SignatureDescription();
                // key generation is VERY long so one time is enough
@@ -55,8 +56,7 @@ public class SignatureDescriptionTest : Assertion {
        }
        
        [Test]
-       [Ignore ("Undocumented format - unsupported by Mono")]
-       public void Constructor_SecurityElement () 
+       public void Constructor_SecurityElement_Empty () 
        {
                // (empty) SecurityElement constructor
                SecurityElement se = new SecurityElement ("xml");
@@ -64,6 +64,40 @@ public class SignatureDescriptionTest : Assertion {
                AssertNotNull ("SignatureDescription(SecurityElement)", sig);
        }
 
+       [Test]
+       public void Constructor_SecurityElement_DSA ()
+       {
+               SecurityElement se = new SecurityElement ("DSASignature");
+               se.AddChild (new SecurityElement ("Key", "System.Security.Cryptography.DSACryptoServiceProvider"));
+               se.AddChild (new SecurityElement ("Digest", "System.Security.Cryptography.SHA1CryptoServiceProvider"));
+               se.AddChild (new SecurityElement ("Formatter", "System.Security.Cryptography.DSASignatureFormatter"));
+               se.AddChild (new SecurityElement ("Deformatter", "System.Security.Cryptography.DSASignatureDeformatter"));
+
+               SignatureDescription sig = new SignatureDescription (se);
+               AssertNotNull ("SignatureDescription(SecurityElement)", sig);
+               AssertEquals ("Key", "System.Security.Cryptography.DSACryptoServiceProvider", sig.KeyAlgorithm);
+               AssertEquals ("Digest", "System.Security.Cryptography.SHA1CryptoServiceProvider", sig.DigestAlgorithm);
+               AssertEquals ("Formatter", "System.Security.Cryptography.DSASignatureFormatter", sig.FormatterAlgorithm);
+               AssertEquals ("Deformatter", "System.Security.Cryptography.DSASignatureDeformatter", sig.DeformatterAlgorithm);
+       }
+
+       [Test]
+       public void Constructor_SecurityElement_RSA ()
+       {
+               SecurityElement se = new SecurityElement ("RSASignature");
+               se.AddChild (new SecurityElement ("Key", "System.Security.Cryptography.RSACryptoServiceProvider"));
+               se.AddChild (new SecurityElement ("Digest", "System.Security.Cryptography.SHA1CryptoServiceProvider"));
+               se.AddChild (new SecurityElement ("Formatter", "System.Security.Cryptography.RSAPKCS1SignatureFormatter"));
+               se.AddChild (new SecurityElement ("Deformatter", "System.Security.Cryptography.RSAPKCS1SignatureDeformatter"));
+
+               SignatureDescription sig = new SignatureDescription (se);
+               AssertNotNull ("SignatureDescription(SecurityElement)", sig);
+               AssertEquals ("Key", "System.Security.Cryptography.RSACryptoServiceProvider", sig.KeyAlgorithm);
+               AssertEquals ("Digest", "System.Security.Cryptography.SHA1CryptoServiceProvider", sig.DigestAlgorithm);
+               AssertEquals ("Formatter", "System.Security.Cryptography.RSAPKCS1SignatureFormatter", sig.FormatterAlgorithm);
+               AssertEquals ("Deformatter", "System.Security.Cryptography.RSAPKCS1SignatureDeformatter", sig.DeformatterAlgorithm);
+       }
+
        [Test]
        public void Properties () 
        {