Share via


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.

Inheritance Hierarchy

System. . :: . .Object
  Microsoft.SPOT.Cryptoki. . :: . .SessionContainer
    System.Security.Cryptography..::..SymmetricAlgorithm
      System.Security.Cryptography. . :: . .AesCryptoServiceProvider
      System.Security.Cryptography. . :: . .TripleDESCryptoServiceProvider

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

Syntax

'Declaration
Public MustInherit Class SymmetricAlgorithm _
    Inherits SessionContainer
public abstract class SymmetricAlgorithm : SessionContainer
public ref class SymmetricAlgorithm abstract : public SessionContainer
[<AbstractClass>]
type SymmetricAlgorithm =  
    class
        inherit SessionContainer
    end
public abstract class SymmetricAlgorithm extends SessionContainer

The SymmetricAlgorithm type exposes the following members.

Constructors

  Name Description
Protected method SymmetricAlgorithm Initializes a new instance of the SymmetricAlgorithm class.

Top

Properties

  Name Description
Public property BlockSize Gets or sets the block size, in bits, of the cryptographic operation.
Public property FeedbackSize Gets or sets the feedback size, in bits, of the cryptographic operation.
Public property IsDisposed (Inherited from SessionContainer.)
Public property IV Gets or sets the initialization vector (IV) for the symmetric algorithm.
Public property Key Gets or sets the secret key for the symmetric algorithm.
Public property KeySize Gets or sets the size, in bits, of the secret key used by the symmetric algorithm.
Public property LegalBlockSizes Gets the block sizes, in bits, that are supported by the symmetric algorithm.
Public property LegalKeySizes Gets the key sizes, in bits, that are supported by the symmetric algorithm.
Protected property MechanismType Gets the symmetric algorithm type.
Public property Mode Gets or sets the mode for operation of the symmetric algorithm.
Public property Padding Gets or sets the padding mode used in the symmetric algorithm.
Public property Session (Inherited from SessionContainer.)

Top

Methods

  Name Description
Public method Clear Releases all resources used by the SymmetricAlgorithm class.
Public method CreateDecryptor() () () () Creates a symmetric decryptor object with the current Key property and initialization vector (IV).
Public method CreateDecryptor(CryptoKey, array<Byte> [] () [] []) When overridden in a derived class, creates a symmetric decryptor object with the specified Key property and initialization vector (IV).
Public method CreateEncryptor() () () () Creates a symmetric encryptor object with the current Key property and initialization vector (IV).
Public method CreateEncryptor(CryptoKey, array<Byte> [] () [] []) When overridden in a derived class, creates a symmetric encryptor object with the specified Key property and initialization vector (IV).
Public method Dispose() () () () (Inherited from SessionContainer.)
Protected method Dispose(Boolean) Releases the unmanaged resources used by the SymmetricAlgorithm and optionally releases the managed resources. (Overrides SessionContainer. . :: . .Dispose(Boolean).)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize (Inherited from SessionContainer.)
Public method GenerateIV When overridden in a derived class, generates a random initialization vector (IV) to use for the algorithm.
Public method GenerateKey When overridden in a derived class, generates a random key (Key) to use for the algorithm.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method ValidKeySize Determines whether the specified key size is valid for the current algorithm.

Top

Fields

  Name Description
Protected field BlockSizeValue Represents the block size, in bits, of the cryptographic operation.
Protected field FeedbackSizeValue Represents the feedback size, in bits, of the cryptographic operation.
Protected field IVValue Represents the initialization vector (IV) for the symmetric algorithm.
Protected field KeySizeValue Represents the size, in bits, of the secret key used by the symmetric algorithm.
Protected field KeyValue Represents the secret key for the symmetric algorithm.
Protected field LegalBlockSizesValue Specifies the block sizes, in bits, that are supported by the symmetric algorithm.
Protected field LegalKeySizesValue Specifies the key sizes, in bits, that are supported by the symmetric algorithm.
Protected field m_isDisposed (Inherited from SessionContainer.)
Protected field m_isSessionClosing (Inherited from SessionContainer.)
Protected field m_ownsSession (Inherited from SessionContainer.)
Protected field m_session (Inherited from SessionContainer.)
Protected field ModeValue Represents the cipher mode used in the symmetric algorithm.
Protected field OwnsKey Represents the value that indicates whether the algorithm object owns the key.
Protected field PaddingValue Represents the padding mode used in the symmetric algorithm.

Top

Remarks

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.

Thread Safety

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

See Also

Reference

System.Security.Cryptography Namespace