SymmetricAlgorithm Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents the abstract base class from which all implementations of symmetric algorithms must inherit.

Namespace:  System.Security.Cryptography
Assembly:  System.Security (in System.Security.dll)

public abstract class SymmetricAlgorithm : SessionContainer

The SymmetricAlgorithm type exposes the following members.

  NameDescription
Protected methodSymmetricAlgorithmInitializes a new instance of the SymmetricAlgorithm class.
Top

  NameDescription
Public propertyBlockSizeGets or sets the block size, in bits, of the cryptographic operation.
Public propertyFeedbackSizeGets or sets the feedback size, in bits, of the cryptographic operation.
Public propertyIsDisposed (Inherited from SessionContainer.)
Public propertyIVGets or sets the initialization vector (IV) for the symmetric algorithm.
Public propertyKeyGets or sets the secret key for the symmetric algorithm.
Public propertyKeySizeGets or sets the size, in bits, of the secret key used by the symmetric algorithm.
Public propertyLegalBlockSizesGets the block sizes, in bits, that are supported by the symmetric algorithm.
Public propertyLegalKeySizesGets the key sizes, in bits, that are supported by the symmetric algorithm.
Protected propertyMechanismTypeGets the symmetric algorithm type.
Public propertyModeGets or sets the mode for operation of the symmetric algorithm.
Public propertyPaddingGets or sets the padding mode used in the symmetric algorithm.
Public propertySession (Inherited from SessionContainer.)
Top

  NameDescription
Public methodClearReleases all resources used by the SymmetricAlgorithm class.
Public methodCreateDecryptor()()()()Creates a symmetric decryptor object with the current Key property and initialization vector (IV).
Public methodCreateDecryptor(CryptoKey, array<Byte>[]()[][])When overridden in a derived class, creates a symmetric decryptor object with the specified Key property and initialization vector (IV).
Public methodCreateEncryptor()()()()Creates a symmetric encryptor object with the current Key property and initialization vector (IV).
Public methodCreateEncryptor(CryptoKey, array<Byte>[]()[][])When overridden in a derived class, creates a symmetric encryptor object with the specified Key property and initialization vector (IV).
Public methodDispose()()()() (Inherited from SessionContainer.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the SymmetricAlgorithm and optionally releases the managed resources. (Overrides SessionContainer..::..Dispose(Boolean).)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalize (Inherited from SessionContainer.)
Public methodGenerateIVWhen overridden in a derived class, generates a random initialization vector (IV) to use for the algorithm.
Public methodGenerateKeyWhen overridden in a derived class, generates a random key (Key) to use for the algorithm.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodValidKeySizeDetermines whether the specified key size is valid for the current algorithm.
Top

  NameDescription
Protected fieldBlockSizeValueRepresents the block size, in bits, of the cryptographic operation.
Protected fieldFeedbackSizeValueRepresents the feedback size, in bits, of the cryptographic operation.
Protected fieldIVValueRepresents the initialization vector (IV) for the symmetric algorithm.
Protected fieldKeySizeValueRepresents the size, in bits, of the secret key used by the symmetric algorithm.
Protected fieldKeyValueRepresents the secret key for the symmetric algorithm.
Protected fieldLegalBlockSizesValueSpecifies the block sizes, in bits, that are supported by the symmetric algorithm.
Protected fieldLegalKeySizesValueSpecifies the key sizes, in bits, that are supported by the symmetric algorithm.
Protected fieldm_isDisposed (Inherited from SessionContainer.)
Protected fieldm_isSessionClosing (Inherited from SessionContainer.)
Protected fieldm_ownsSession (Inherited from SessionContainer.)
Protected fieldm_session (Inherited from SessionContainer.)
Protected fieldModeValueRepresents the cipher mode used in the symmetric algorithm.
Protected fieldOwnsKeyRepresents the value that indicates whether the algorithm object owns the key.
Protected fieldPaddingValueRepresents the padding mode used in the symmetric algorithm.
Top

The classes that derive from the SymmetricAlgorithm class use a chaining mode called cipher block chaining (CBC), which requires a key (Key) and an initialization vector (IV) to perform cryptographic transformations on data. To decrypt data that was encrypted using one of the SymmetricAlgorithm classes, you must set the Key property and the IV property to the same values that were used for encryption. For a symmetric algorithm to be useful, the secret key must be known only to the sender and the receiver.

All cryptographic classes in the .NET Framework that hold sensitive data implement a Clear method. When called, the Clear method overwrites all sensitive data within the object with zeros and then releases the object so that it can be safely garbage collected. When the object has been zeroed and released, you should then call the Dispose method with the disposing parameter set to True to dispose of all managed and unmanaged resources associated with the object.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: