C# Class GSF.Security.PBKDF2

Implements a generic PBKDF2 DeriveBytes that will work from a custom cryptographic transform. Rfc2898DeriveBytes only implements a SHA-1 underlying hash function.
It is recommended to use one of the HMAC-SHA implementations unless you understand the implecations of using something differently.
Inheritance: System.Security.Cryptography.DeriveBytes
Exibir arquivo Open project: GridProtectionAlliance/openHistorian

Public Methods

Method Description
ComputeSaltedPassword ( HMACMethod method, byte password, byte salt, int iterations, int length ) : byte[]

Implements a PBKDF2 algorthim with a user definded MAC method.

GetBytes ( int length ) : byte[]

When overridden in a derived class, returns pseudo-random key bytes.

PBKDF2 ( HMACMethod method, byte password, byte salt, int iterations ) : System

Implements a PBKDF2 algorthim with a user definded MAC method.

Reset ( ) : void

When overridden in a derived class, resets the state of the operation.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

When overridden in a derived class, releases the unmanaged resources used by the T:System.Security.Cryptography.DeriveBytes class and optionally releases the managed resources.

Private Methods

Method Description
ComputeNextBlock ( ) : void

Computes the next block of crypto bytes.

ComputeNextBlock ( HMac hash ) : void
Initialize ( HMac hash, byte passwordBytes, byte salt, int iterations ) : void

Method Details

ComputeSaltedPassword() public static method

Implements a PBKDF2 algorthim with a user definded MAC method.
public static ComputeSaltedPassword ( HMACMethod method, byte password, byte salt, int iterations, int length ) : byte[]
method HMACMethod the HMAC method to use.
password byte the password to use
salt byte the salt. Must be at least 64-bit
iterations int the number of iterations. Must be at least 1000
length int the number of bytes to return
return byte[]

Dispose() protected method

When overridden in a derived class, releases the unmanaged resources used by the T:System.Security.Cryptography.DeriveBytes class and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

GetBytes() public method

When overridden in a derived class, returns pseudo-random key bytes.
public GetBytes ( int length ) : byte[]
length int
return byte[]

PBKDF2() public method

Implements a PBKDF2 algorthim with a user definded MAC method.
public PBKDF2 ( HMACMethod method, byte password, byte salt, int iterations ) : System
method HMACMethod the HMAC method to use.
password byte the password to use
salt byte the salt. recommended to be at least 64-bit
iterations int the number of iterations. Recommended to be at least 1000
return System

Reset() public method

When overridden in a derived class, resets the state of the operation.
public Reset ( ) : void
return void