UseKey Method
UseKey(ReadOnlyMemory<Byte>)
Explicitly sets the key of the credential.
C#
public ConfigureHotp UseKey(ReadOnlyMemory<byte> key)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | key | A collection of bytes to use for the key. |
Returns
The current ConfigureHotp instance.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This is thrown when GenerateKey(Memory<Byte>) has been called before this. |
System.ArgumentException | This is thrown when |
Remarks
The System.Memory<> collection containing the key is used by the operation to program the YubiKey, but the source continues to be owned by the caller. This means that the caller is responsible for clearing the memory after use to avoid exposing sensitive information.
Setting an explicit key is not compatible with generating a key. Specifying both will result in an exception.