Muokkaa

Jaa


TripleDESCryptoServiceProvider.CreateEncryptor Method

Definition

Creates a symmetric encryptor object.

Overloads

CreateEncryptor()

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

CreateEncryptor(Byte[], Byte[])

Creates a symmetric TripleDES encryptor object with the specified key (Key) and initialization vector (IV).

CreateEncryptor()

Source:
TripleDESCryptoServiceProvider.Wrap.cs
Source:
TripleDESCryptoServiceProvider.Wrap.cs
Source:
TripleDESCryptoServiceProvider.Wrap.cs

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

public:
 override System::Security::Cryptography::ICryptoTransform ^ CreateEncryptor();
public override System.Security.Cryptography.ICryptoTransform CreateEncryptor();
override this.CreateEncryptor : unit -> System.Security.Cryptography.ICryptoTransform
Public Overrides Function CreateEncryptor () As ICryptoTransform

Returns

A symmetric encryptor object.

Remarks

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

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

Applies to

CreateEncryptor(Byte[], Byte[])

Source:
TripleDESCryptoServiceProvider.Wrap.cs
Source:
TripleDESCryptoServiceProvider.Wrap.cs
Source:
TripleDESCryptoServiceProvider.Wrap.cs

Creates a symmetric TripleDES encryptor object with the specified key (Key) and initialization vector (IV).

public:
 override System::Security::Cryptography::ICryptoTransform ^ CreateEncryptor(cli::array <System::Byte> ^ rgbKey, cli::array <System::Byte> ^ rgbIV);
public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[]? rgbIV);
public override System.Security.Cryptography.ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV);
override this.CreateEncryptor : byte[] * byte[] -> System.Security.Cryptography.ICryptoTransform
Public Overrides Function CreateEncryptor (rgbKey As Byte(), rgbIV As Byte()) As ICryptoTransform

Parameters

rgbKey
Byte[]

The secret key to use for the symmetric algorithm.

rgbIV
Byte[]

The initialization vector to use for the symmetric algorithm.

Note: The initialization vector must be 8 bytes long. If it is longer than 8 bytes, it is truncated and an exception is not thrown. Before you call CreateEncryptor(Byte[], Byte[]), check the length of the initialization vector and throw an exception if it is too long.

Returns

A symmetric TripleDES encryptor object.

Exceptions

The value of the Mode property is OFB.

-or-

The value of the Mode property is CFB and the value of the FeedbackSize property is not 8.

-or-

An invalid key size was used.

-or-

The algorithm key size was not available.

Remarks

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

See also

Applies to