TripleDESCryptoServiceProvider.CreateEncryptor Method (Byte[], Byte[])

 

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

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

override CreateEncryptor : 
        rgbKey:byte[] *
        rgbIV:byte[] -> ICryptoTransform

Parameters

rgbKey
Type: System.Byte[]

The secret key to use for the symmetric algorithm.

rgbIV
Type: System.Byte[]

The initialization vector to use for the symmetric algorithm.

System_CAPS_noteNote

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, check the length of the initialization vector and throw an exception if it is too long.

Return Value

Type: System.Security.Cryptography.ICryptoTransform

A symmetric TripleDES encryptor object.

Exception Condition
CryptographicException

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.

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

The following code example creates a TripleDESCryptoServiceProvider object and uses it to encrypt and decrypt data in a file.

No code example is currently available or this language may not be supported.

The following code example creates a TripleDESCryptoServiceProvider object and uses it to encrypt and decrypt data in memory.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: