System.Security.Cryptography.SymmetricAlgorithm.CreateEncryptor Method

Creates a symmetric encryptor object with the current SymmetricAlgorithm.Key property and initialization vector (SymmetricAlgorithm.IV).

Syntax

public virtual ICryptoTransform CreateEncryptor ()

Returns

A symmetric encryptor object.

Remarks

If the current SymmetricAlgorithm.Key property is null, the SymmetricAlgorithm.GenerateKey method is called to create a new random SymmetricAlgorithm.Key. If the current SymmetricAlgorithm.IV property is null, the SymmetricAlgorithm.GenerateIV method is called to create a new random SymmetricAlgorithm.IV.

Use the SymmetricAlgorithm.CreateDecryptor overload with the same signature to decrypt the result of this method.

Requirements

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0