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
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtensions.UpdateProperties<KeyHelper>(KeyHelper, KeyHelper), ObjectExtensions.UpdateProperties(object, object)
Methods
GenerateKey()
Generates a random key.
public string GenerateKey()
Returns
The key.
GetMasterKey()
Gets the master key.
public byte[] GetMasterKey()
Returns
byte[]
An array of byte.
Exceptions
Thrown when the requested operation is invalid.
GetNumParts()
Gets the number parts.
public int GetNumParts()
Returns
The number parts.
Exceptions
Thrown when one or more arguments have unsupported or illegal values.
GetSaltSize()
Gets the salt size.
public int GetSaltSize()
Returns
The salt size.
SetMasterKeyAccessor(Func<byte[]>)
Sets the master key.
public void SetMasterKeyAccessor(Func<byte[]> accessor)
Parameters
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
The accessor function.
SetSaltSizeAccessor(Func<int>)
Sets the salt size (in bytes). Default is 4.
public void SetSaltSizeAccessor(Func<int> accessor)
Parameters
The accessor function.
ValidateKey(string)
Validates the provided key.
public bool ValidateKey(string providedKey)
Parameters
providedKey string
The provided key.
Returns
True if it succeeds, false if it fails.
See Also
KeyHelper.GetMasterKey(), KeyHelper.SetMasterKeyAccessor(Func<byte[]>), KeyHelper.masterKeyAccessor