SymmetricAlgorithm

SymmetricAlgorithmdisposable

System.Security.Cryptography (mscorlib.dll)abstract class
public abstract class SymmetricAlgorithm : IDisposable { // Public Constructors    public SymmetricAlgorithm(  ); // Protected Instance Fields    protected int BlockSizeValue;    protected int FeedbackSizeValue;    protected byte[  ] IVValue;    protected int KeySizeValue;    protected byte[  ] KeyValue;    protected KeySizes[  ] LegalBlockSizesValue;    protected KeySizes[  ] LegalKeySizesValue;    protected CipherMode ModeValue;    protected PaddingMode PaddingValue; // Public Instance Properties    public virtual int BlockSize{set; get; }    public virtual int FeedbackSize{set; get; }    public virtual byte[  ] IV{set; get; }    public virtual byte[  ] Key{set; get; }    public virtual int KeySize{set; get; }    public virtual KeySizes[  ] LegalBlockSizes{get; }    public virtual KeySizes[  ] LegalKeySizes{get; }    public virtual CipherMode Mode{set; get; }    public virtual PaddingMode Padding{set; get; } // Public Static Methods    public static SymmetricAlgorithm Create(  );    public static SymmetricAlgorithm Create(string algName); // Public Instance Methods    public void Clear(  );    public virtual ICryptoTransform CreateDecryptor(  );    public abstract ICryptoTransform CreateDecryptor(byte[  ] rgbKey, byte[  ] rgbIV);    public virtual ICryptoTransform CreateEncryptor(  );    public abstract ICryptoTransform CreateEncryptor(byte[  ] rgbKey, byte[  ] rgbIV);    public abstract void GenerateIV(  );    public abstract void GenerateKey(  );    public bool ValidKeySize(int bitLength); // Protected Instance Methods    protected virtual void Dispose(bool disposing);    protected override void Finalize(  );  // overrides object }

A symmetric algorithm is one where the sender and the recipient share the same knowledge (i.e. both parties know the secret key). All symmetric algorithm implementations inherit from this abstract class. Instances of implementation classes are created using the Create( ) method, which accepts the name of an implementation as a System.String argument. An instance of the default algorithm is created if no name is specified; the system administrator can configure the default algorithm.

The LegalKeySizes and LegalBlockSizes properties return arrays of the KeySizes class, which specify the set of key lengths and cipher block sizes supported by an implementation class. The KeySize and BlockSize properties get or set the current key and block lengths.

The IV and Key properties get or set the initialization vector (IV) and secret key to use for encryption or decryption. New values for these properties are created with the GenerateIV( ) and GenerateKey( ) methods; implementation classes will automatically create a new IV and secret key.

Subclasses of the SymmetricAlgorithm class do not perform encryption and decryption directly; the CreateEncryptor( ) and CreateDecryptor( ) methods return instances of the ICryptoTransform type to which these tasks are delegated.

Subclasses

DES, RC2, Rijndael, TripleDES



Programming. NET Security
Programming .Net Security
ISBN: 0596004427
EAN: 2147483647
Year: 2005
Pages: 346

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net