(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / Microsoft.Web.Services / Test / Microsoft.Web.Services.Security / DecryptionKeyProviderTest.cs
blob07b3ba5bf85234e0f6dbb2ef459dbd02786bb12b
1 //
2 // DecryptionKeyProviderTest.cs - NUnit Test Cases for DecryptionKeyProvider
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
10 using NUnit.Framework;
11 using Microsoft.Web.Services.Security;
12 using System;
13 using System.Security.Cryptography.Xml;
14 using System.Xml;
16 namespace MonoTests.MS.Web.Services.Security {
18 // Note: Test ONLY for WSE1 - the class is obsolete in WSE2 and throw an error when compiling
20 [TestFixture]
21 public class DecryptionKeyProviderTest : Assertion {
23 [Test]
24 public void NullAlgorithmUri ()
26 DecryptionKeyProvider dkp = new DecryptionKeyProvider ();
27 DecryptionKey key = dkp.GetDecryptionKey (null, new KeyInfo ());
28 AssertNull ("NullAlgorithmUri", key);
31 [Test]
32 [Ignore ("Only works if you have the required certificate in your own store")]
33 public void RSAPkcs1v15 ()
35 DecryptionKeyProvider dkp = new DecryptionKeyProvider ();
36 DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSA15, new KeyInfo ());
39 [Test]
40 public void UnsupportedAlgorithmUri ()
42 DecryptionKeyProvider dkp = new DecryptionKeyProvider ();
43 DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES128, new KeyInfo ());
44 AssertNull ("AES128", key);
45 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES128KeyWrap, new KeyInfo ());
46 AssertNull ("AES128KeyWrap", key);
47 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES192, new KeyInfo ());
48 AssertNull ("AES192", key);
49 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES192KeyWrap, new KeyInfo ());
50 AssertNull ("AES192KeyWrap", key);
51 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES256, new KeyInfo ());
52 AssertNull ("AES256", key);
53 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.AES256KeyWrap, new KeyInfo ());
54 AssertNull ("AES256KeyWrap", key);
55 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.DES, new KeyInfo ());
56 AssertNull ("DES", key);
57 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSAOAEP, new KeyInfo ());
58 AssertNull ("RSAOAEP", key);
59 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA1, new KeyInfo ());
60 AssertNull ("SHA1", key);
61 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA256, new KeyInfo ());
62 AssertNull ("SHA256", key);
63 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.SHA512, new KeyInfo ());
64 AssertNull ("SHA512", key);
65 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.TripleDES, new KeyInfo ());
66 AssertNull ("TripleDES", key);
67 key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.TripleDESKeyWrap, new KeyInfo ());
68 AssertNull ("TripleDESKeyWrap", key);
71 [Test]
72 [ExpectedException (typeof (ArgumentNullException))]
73 public void ConstructorByteArrayNull ()
75 DecryptionKeyProvider dkp = new DecryptionKeyProvider ();
76 DecryptionKey key = dkp.GetDecryptionKey (XmlEncryption.AlgorithmURI.RSA15, null);