2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Security / SymmetricEncryptionKey.cs
1 //
2 // SymmetricEncryptionKey.cs: Handles WS-Security SymmetricEncryptionKey
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 using System;
11 using System.Security.Cryptography;
12 using System.Web.Services.Protocols;
13
14 namespace Microsoft.Web.Services.Security {
15
16         public class SymmetricEncryptionKey : EncryptionKey {
17
18                 private SymmetricAlgorithm algo;
19
20                 public SymmetricEncryptionKey () 
21                 {
22                         // uses TripleDESCryptoServiceProvider - not default (Rjindael)
23                         algo = SymmetricAlgorithm.Create ("TripleDES");
24                 }
25
26                 public SymmetricEncryptionKey (SymmetricAlgorithm key) 
27                 {
28                         if (key == null)
29                                 throw new NullReferenceException ("algo");
30                         algo = key;
31                 }
32
33                 public SymmetricEncryptionKey (SymmetricAlgorithm key, byte[] keyValue) 
34                 {
35                         algo = key;
36                         algo.Key = keyValue;
37                 }
38
39                 internal SymmetricAlgorithm Algorithm {
40                         get { return algo; }
41                 }
42         }
43 }