C# Class Org.Mentalis.Security.Cryptography.DiffieHellmanManaged

Implements the Diffie-Hellman algorithm.
Inheritance: DiffieHellman
Show file Open project: ElanHasson/SSIS-Extensions Class Usage Examples

Public Methods

Method Description
CreateKeyExchange ( ) : byte[]

Creates the key exchange data.

DecryptKeyExchange ( byte keyEx ) : byte[]

Extracts secret information from the key exchange data.

DiffieHellmanManaged ( ) : System

Initializes a new DiffieHellmanManaged instance.

The default length of the shared secret is 1024 bits.

DiffieHellmanManaged ( byte p, byte g, byte x ) : System

Initializes a new DiffieHellmanManaged instance.

DiffieHellmanManaged ( byte p, byte g, int l ) : System

Initializes a new DiffieHellmanManaged instance.

DiffieHellmanManaged ( int bitlen, int l, DHKeyGeneration keygen ) : System

Initializes a new DiffieHellmanManaged instance.

The larger the bit length, the more secure the algorithm is. The default is 1024 bits. The minimum bit length is 128 bits.
The size of the private value will be one fourth of the bit length specified.

ExportParameters ( bool includePrivateParameters ) : DHParameters

Exports the DHParameters.

ImportParameters ( DHParameters parameters ) : void

Imports the specified DHParameters.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the SymmetricAlgorithm and optionally releases the managed resources.

Private Methods

Method Description
GenerateKey ( int bitlen, DHKeyGeneration keygen, BigInteger &p, BigInteger &g ) : void
Initialize ( BigInteger p, BigInteger g, BigInteger x, int secretLen, bool checkInput ) : void

Method Details

CreateKeyExchange() public method

Creates the key exchange data.
public CreateKeyExchange ( ) : byte[]
return byte[]

DecryptKeyExchange() public method

Extracts secret information from the key exchange data.
public DecryptKeyExchange ( byte keyEx ) : byte[]
keyEx byte The key exchange data within which the shared key is hidden.
return byte[]

DiffieHellmanManaged() public method

Initializes a new DiffieHellmanManaged instance.
The default length of the shared secret is 1024 bits.
public DiffieHellmanManaged ( ) : System
return System

DiffieHellmanManaged() public method

Initializes a new DiffieHellmanManaged instance.
or is a null reference (Nothing in Visual Basic). or is invalid.
public DiffieHellmanManaged ( byte p, byte g, byte x ) : System
p byte The P parameter of the Diffie-Hellman algorithm. This is a public parameter.
g byte The G parameter of the Diffie-Hellman algorithm. This is a public parameter.
x byte The X parameter of the Diffie-Hellman algorithm. This is a private parameter. If this parameters is a null reference (Nothing in Visual Basic), a secret value of the default size will be generated.
return System

DiffieHellmanManaged() public method

Initializes a new DiffieHellmanManaged instance.
or is a null reference (Nothing in Visual Basic). is invalid. or is invalid.
public DiffieHellmanManaged ( byte p, byte g, int l ) : System
p byte The P parameter of the Diffie-Hellman algorithm.
g byte The G parameter of the Diffie-Hellman algorithm.
l int The length, in bits, of the private value. If 0 is specified, the default value will be used.
return System

DiffieHellmanManaged() public method

Initializes a new DiffieHellmanManaged instance.
The larger the bit length, the more secure the algorithm is. The default is 1024 bits. The minimum bit length is 128 bits.
The size of the private value will be one fourth of the bit length specified.
The specified bit length is invalid.
public DiffieHellmanManaged ( int bitlen, int l, DHKeyGeneration keygen ) : System
bitlen int The length, in bits, of the public P parameter.
l int The length, in bits, of the secret value X. This parameter can be set to 0 to use the default size.
keygen DHKeyGeneration One of the values.
return System

Dispose() protected method

Releases the unmanaged resources used by the SymmetricAlgorithm 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

ExportParameters() public method

Exports the DHParameters.
public ExportParameters ( bool includePrivateParameters ) : DHParameters
includePrivateParameters bool true to include private parameters; otherwise, false.
return DHParameters

ImportParameters() public method

Imports the specified DHParameters.
or is a null reference (Nothing in Visual Basic) -or- is not a prime number.
public ImportParameters ( DHParameters parameters ) : void
parameters DHParameters The parameters for .
return void