Table of Contents

Class AesCipher

Namespace
Renci.SshNet.Security.Cryptography.Ciphers
Assembly
Renci.SshNet.dll

AES cipher implementation.

public sealed class AesCipher : BlockCipher, IDisposable

Inheritance

Implements

Inherited Members

Constructors

AesCipher(byte[], byte[], AesCipherMode, bool)

Initializes a new instance of the Renci.SshNet.Security.Cryptography.Ciphers.AesCipher class.

public AesCipher(byte[] key, byte[] iv, AesCipherMode mode, bool pkcs7Padding = false)

Parameters

key byte[]

The key.

iv byte[]

The IV.

mode AesCipherMode

The mode.

pkcs7Padding bool

Enable PKCS7 padding.

Exceptions

ArgumentNullException

key is null.

ArgumentException

Keysize is not valid for this algorithm.

Methods

Decrypt(byte[], int, int)

Decrypts the specified input.

public override byte[] Decrypt(byte[] input, int offset, int length)

Parameters

input byte[]

The input.

offset int

The zero-based offset in input at which to begin decrypting.

length int

The number of bytes to decrypt from input.

Returns

byte[]

The decrypted data.

DecryptBlock(byte[], int, int, byte[], int)

Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array.

public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)

Parameters

inputBuffer byte[]

The input data to decrypt.

inputOffset int

The offset into the input byte array from which to begin using data.

inputCount int

The number of bytes in the input byte array to use as data.

outputBuffer byte[]

The output to which to write decrypted data.

outputOffset int

The offset into the output byte array from which to begin writing data.

Returns

int

The number of bytes decrypted.

Dispose(bool)

Dispose the instance.

public void Dispose(bool disposing)

Parameters

disposing bool

Set to True to dispose of resouces.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Encrypt(byte[], int, int)

Encrypts the specified data.

public override byte[] Encrypt(byte[] input, int offset, int length)

Parameters

input byte[]

The data.

offset int

The zero-based offset in input at which to begin encrypting.

length int

The number of bytes to encrypt from input.

Returns

byte[]

The encrypted data.

EncryptBlock(byte[], int, int, byte[], int)

Encrypts the specified region of the input byte array and copies the encrypted data to the specified region of the output byte array.

public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)

Parameters

inputBuffer byte[]

The input data to encrypt.

inputOffset int

The offset into the input byte array from which to begin using data.

inputCount int

The number of bytes in the input byte array to use as data.

outputBuffer byte[]

The output to which to write encrypted data.

outputOffset int

The offset into the output byte array from which to begin writing data.

Returns

int

The number of bytes encrypted.