C# Class KeePassLib.Keys.CompositeKey

Represents a key. A key can be build up using several user key data sources like a password, a key file, the currently logged on user credentials, the current computer ID, etc.
Datei anzeigen Open project: cappert/keepass2 Class Usage Examples

Public Methods

Method Description
AddUserKey ( IUserKey pKey ) : void

/// Deconstructor, clears up the key. ///

/// Clears the key. This function also erases all previously stored /// user key data objects. ///

Add a user key.

CompositeKey ( ) : Org.BouncyCastle.Crypto

Construct a new, empty key object.

ContainsType ( Type tUserKeyType ) : bool

Test whether the composite key contains a specific type of user keys (password, key file, ...). If at least one user key of that type is present, the function returns true.

EqualsValue ( CompositeKey ckOther ) : bool
GenerateKey32 ( byte pbKeySeed32, ulong uNumRounds ) : KeePassLib.Security.ProtectedBinary

Generate a 32-bit wide key out of the composite key.

GetUserKey ( Type tUserKeyType ) : IUserKey

Get the first user key of a specified type.

RemoveUserKey ( IUserKey pKey ) : bool

Remove a user key.

TransformKeyBenchmark ( uint uMilliseconds, ulong uStep ) : ulong

Benchmark the TransformKey method. Within uMilliseconds ms, random keys will be transformed and the number of performed transformations are returned.

TransformKeyManaged ( byte pbNewKey32, byte pbKeySeed32, ulong uNumRounds ) : bool

Private Methods

Method Description
CreateRawCompositeKey32 ( ) : byte[]

Creates the composite key from the supplied user key sources (password, key file, user account, computer ID, etc.).

TransformKey ( byte pbOriginalKey32, byte pbKeySeed32, ulong uNumRounds ) : byte[]

Transform the current key uNumRounds times.

ValidateUserKeys ( ) : void

Method Details

AddUserKey() public method

/// Deconstructor, clears up the key. /// /// Clears the key. This function also erases all previously stored /// user key data objects. /// Add a user key.
public AddUserKey ( IUserKey pKey ) : void
pKey IUserKey User key to add.
return void

CompositeKey() public method

Construct a new, empty key object.
public CompositeKey ( ) : Org.BouncyCastle.Crypto
return Org.BouncyCastle.Crypto

ContainsType() public method

Test whether the composite key contains a specific type of user keys (password, key file, ...). If at least one user key of that type is present, the function returns true.
public ContainsType ( Type tUserKeyType ) : bool
tUserKeyType System.Type User key type.
return bool

EqualsValue() public method

public EqualsValue ( CompositeKey ckOther ) : bool
ckOther CompositeKey
return bool

GenerateKey32() public method

Generate a 32-bit wide key out of the composite key.
public GenerateKey32 ( byte pbKeySeed32, ulong uNumRounds ) : KeePassLib.Security.ProtectedBinary
pbKeySeed32 byte Seed used in the key transformation /// rounds. Must be a byte array containing exactly 32 bytes; must /// not be null.
uNumRounds ulong Number of key transformation rounds.
return KeePassLib.Security.ProtectedBinary

GetUserKey() public method

Get the first user key of a specified type.
public GetUserKey ( Type tUserKeyType ) : IUserKey
tUserKeyType System.Type Type of the user key to get.
return IUserKey

RemoveUserKey() public method

Remove a user key.
public RemoveUserKey ( IUserKey pKey ) : bool
pKey IUserKey User key to remove.
return bool

TransformKeyBenchmark() public static method

Benchmark the TransformKey method. Within uMilliseconds ms, random keys will be transformed and the number of performed transformations are returned.
public static TransformKeyBenchmark ( uint uMilliseconds, ulong uStep ) : ulong
uMilliseconds uint Test duration in ms.
uStep ulong Stepping. /// should be a prime number. For fast processors /// (PCs) a value of 3001 is recommended, for slower processors (PocketPC) /// a value of 401 is recommended.
return ulong

TransformKeyManaged() public static method

public static TransformKeyManaged ( byte pbNewKey32, byte pbKeySeed32, ulong uNumRounds ) : bool
pbNewKey32 byte
pbKeySeed32 byte
uNumRounds ulong
return bool