* FileSystemInfo.cs: corrected COM visibility of UTC properties
[mono.git] / mcs / class / Mono.Security / Mono.Security.Cryptography / RC4.cs
1 //
2 // RC4.cs: RC4(tm) symmetric stream cipher
3 //      RC4 is a trademark of RSA Security
4 //
5 // Author:
6 //      Sebastien Pouliot (spouliot@motus.com)
7 //
8 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
9 //
10
11 using System;
12 using System.Security.Cryptography;
13
14 namespace Mono.Security.Cryptography {
15
16 public abstract class RC4 : SymmetricAlgorithm {
17
18         private static KeySizes[] s_legalBlockSizes = {
19                 new KeySizes (64, 64, 0)
20         };
21
22         private static KeySizes[] s_legalKeySizes = {
23                 new KeySizes (40, 2048, 8)  
24         };
25
26         public RC4() 
27         {
28                 KeySizeValue = 128;
29                 BlockSizeValue = 64;
30                 FeedbackSizeValue = BlockSizeValue;
31                 LegalBlockSizesValue = s_legalBlockSizes;
32                 LegalKeySizesValue = s_legalKeySizes;
33         }
34
35         new static public RC4 Create() 
36         {
37                 return Create ("RC4");
38         }
39
40         new static public RC4 Create (string algName) 
41         {
42                 object o = CryptoConfig.CreateFromName (algName);
43                 // in case machine.config isn't configured to use 
44                 // any RC4 implementation
45                 if (o == null) {
46                         o = new ARC4Managed ();
47                 }
48                 return (RC4) o;
49         }
50 }
51
52 }