SetPassword Method
SetPassword(ReadOnlyMemory<Char>)
Set the static password the slot on the YubiKey should be configured with.
public ConfigureStaticPassword SetPassword(ReadOnlyMemory<char> password)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Char> | password | The static password to configure the YubiKey with. |
Returns
The ConfigureStaticPassword instance
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | You cannot both generate and specify a static password. |
System.ArgumentException | Thrown if your password is too long or zero-length. |
System.InvalidOperationException | Thrown if your password has characters that are not available in your selected KeyboardLayout. |
Remarks
This API can take explicit passwords set by this method, or it can generate a password. These are mutually exclusive options, so if you call both GeneratePassword(Memory<Char>) and this method, an exception will happen.
Because this method needs to know which KeyboardLayout you're using before we can know if there are any invalid characters, this method will only check that if you have already specified the layout.
If you specify the password before you specify the KeyboardLayout, the when you set the layout, that operation will check the characters and throw an System.InvalidOperationException if there are invalid characters.