Class KeyHelper

Namespace
CapyKit.Helpers
Assembly
CapyKit.dll

A class that contains methods for managing key creation and validation against a master key.

public class KeyHelper
Inheritance
KeyHelper
Inherited Members
Extension Methods

Methods

GenerateKey()

Generates a random key.

public string GenerateKey()

Returns

string

The key.

GetMasterKey()

Gets the master key.

public byte[] GetMasterKey()

Returns

byte[]

An array of byte.

Exceptions

InvalidOperationException

Thrown when the requested operation is invalid.

GetNumParts()

Gets the number parts.

public int GetNumParts()

Returns

int

The number parts.

Exceptions

ArgumentException

Thrown when one or more arguments have unsupported or illegal values.

GetSaltSize()

Gets the salt size.

public int GetSaltSize()

Returns

int

The salt size.

SetMasterKeyAccessor(Func<byte[]>)

Sets the master key.

public void SetMasterKeyAccessor(Func<byte[]> accessor)

Parameters

accessor Func<byte[]>

The accessor function.

SetNumPartsAccessor(Func<int>)

Set and get the number of parts for the formatted key. Default is 2.

public void SetNumPartsAccessor(Func<int> accessor)

Parameters

accessor Func<int>

The accessor function.

SetSaltSizeAccessor(Func<int>)

Sets the salt size (in bytes). Default is 4.

public void SetSaltSizeAccessor(Func<int> accessor)

Parameters

accessor Func<int>

The accessor function.

ValidateKey(string)

Validates the provided key.

public bool ValidateKey(string providedKey)

Parameters

providedKey string

The provided key.

Returns

bool

True if it succeeds, false if it fails.

See Also
masterKeyAccessor