2 // System.Security.Cryptography.RC2.cs
5 // Andrew Birkett (andy@nobugs.org)
6 // Sebastien Pouliot (spouliot@motus.com)
11 namespace System.Security.Cryptography {
13 public abstract class RC2 : SymmetricAlgorithm {
15 public static new RC2 Create ()
17 return Create ("System.Security.Cryptography.RC2");
20 public static new RC2 Create (string algName)
22 return (RC2) CryptoConfig.CreateFromName (algName);
25 protected int EffectiveKeySizeValue;
27 public virtual int EffectiveKeySize {
29 if (EffectiveKeySizeValue == 0)
32 return EffectiveKeySizeValue;
35 if (!KeySizes.IsLegalKeySize (LegalKeySizesValue, value))
36 throw new CryptographicException ("key size not supported by algorithm");
37 EffectiveKeySizeValue = value;
41 // Overridden, which makes me suspect it changes effective keysize too?
42 public override int KeySize {
43 get { return KeySizeValue; }
44 set { KeySizeValue = value; }
51 FeedbackSizeValue = 64;
53 // The RFC allows keys of 1 to 128 bytes, but MS impl only supports
54 // 40 to 128 bits, sigh.
55 LegalKeySizesValue = new KeySizes[1];
56 LegalKeySizesValue[0] = new KeySizes(40, 128, 8);
58 LegalBlockSizesValue = new KeySizes[1];
59 LegalBlockSizesValue[0] = new KeySizes(64, 64, 0);