C# Class DotNetCrypt.ManagedTransformBase

An abstract base class for managed implementations of ICryptoTransform.

This class deals with the various forms of padding available. Unlike the classes built into the .NET framework, however, for modes which effectively operate in stream cipher mode (CFB, OFB), it is permissible to encrypt a message which is not an exact number of bytes without specifying a padding mode other than System.Security.Cryptography.PaddingMode.None

It also takes into account the cipher mode to be used. For increased compatibility with other systems, counter mode (CTR) is also supported via the ExtendedCipherMode enumeration.

Inheritance: ICryptoTransform
Datei anzeigen Open project: drizzt/KeePass-SerpentCipher

Private Properties

Property Type Description
Decrypt void
DecryptData int
Encrypt void
EncryptData int
IncrementCounter void

Public Methods

Method Description
Clear ( ) : void

Releases all resources used by the ManagedTransformBase class.

Dispose ( ) : void

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

TransformBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int

Transforms the specified region of the input byte array and copies the resulting transform to the specified region of the output byte array.

TransformFinalBlock ( byte inputBuffer, int inputOffset, int inputCount ) : byte[]

Transforms the specified region of the specified byte array.

Protected Methods

Method Description
DecryptBlock ( byte block ) : void

Decrypts a single block of bytes, writing the result into the provided array.

Dispose ( bool disposing ) : void

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.

If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.

EncryptBlock ( byte block ) : void

Encrypts a single block of bytes, writing the result into the provided array.

ManagedTransformBase ( ISymmetricAlgorithm algorithm, byte rgbIv, TransformDirection transformDirection, Endianness endianness ) : System

Creates a new managed transform instance, reading necessary setting values from the provided ISymmetricAlgorithm instance.

Reset ( ) : void

Clears all potentially sensitive data stores.

Private Methods

Method Description
Decrypt ( uint cipher ) : void
DecryptData ( byte inputBuffer, int inputOffset, int inputCount, byte &outputBuffer, int outputOffset, PaddingMode paddingMode, bool final ) : int
Encrypt ( uint plain ) : void
EncryptData ( byte inputBuffer, int inputOffset, int inputCount, byte &outputBuffer, int outputOffset, PaddingMode paddingMode, bool final ) : int
IncrementCounter ( ) : void

Method Details

Clear() public method

Releases all resources used by the ManagedTransformBase class.
public Clear ( ) : void
return void

DecryptBlock() protected method

Decrypts a single block of bytes, writing the result into the provided array.
protected DecryptBlock ( byte block ) : void
block byte /// The block of bytes to be decrypted. ///
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.

If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.

protected Dispose ( bool disposing ) : void
disposing bool /// Indicates whether this method is being called by a user's code. ///
return void

EncryptBlock() protected method

Encrypts a single block of bytes, writing the result into the provided array.
protected EncryptBlock ( byte block ) : void
block byte /// The block of bytes to be encrypted. ///
return void

ManagedTransformBase() protected method

Creates a new managed transform instance, reading necessary setting values from the provided ISymmetricAlgorithm instance.
protected ManagedTransformBase ( ISymmetricAlgorithm algorithm, byte rgbIv, TransformDirection transformDirection, Endianness endianness ) : System
algorithm ISymmetricAlgorithm /// A instance from which to take /// setting values. ///
rgbIv byte /// The initialization vector to use. ///
transformDirection TransformDirection /// The direction of the transform (encryption or decryption). ///
endianness Endianness /// The endianness convention for the algorithm. ///
return System

Reset() protected method

Clears all potentially sensitive data stores.
protected Reset ( ) : void
return void

TransformBlock() public method

Transforms the specified region of the input byte array and copies the resulting transform to the specified region of the output byte array.
public TransformBlock ( byte inputBuffer, int inputOffset, int inputCount, byte outputBuffer, int outputOffset ) : int
inputBuffer byte /// The input for which to compute the transform. ///
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 the transform. ///
outputOffset int /// The offset into the output byte array from which to begin writing /// data. ///
return int

TransformFinalBlock() public method

Transforms the specified region of the specified byte array.
public TransformFinalBlock ( byte inputBuffer, int inputOffset, int inputCount ) : byte[]
inputBuffer byte /// The input for which to compute the transform. ///
inputOffset int /// The offset into the byte array from which to begin using data. ///
inputCount int /// The number of bytes in the byte array to use as data. ///
return byte[]