Show / Hide Table of Contents

SetPassword Method

SetPassword(ReadOnlyMemory<char>)

Set the static password the slot on the YubiKey should be configured with.

C#
public ConfigureStaticPassword SetPassword(ReadOnlyMemory<char> password)

Parameters

Type Name Description
ReadOnlyMemory<char> password

The static password to configure the YubiKey with.

Returns

ConfigureStaticPassword

The ConfigureStaticPassword instance

Exceptions

Type Condition
InvalidOperationException

You cannot both generate and specify a static password.

ArgumentException

Thrown if your password is too long or zero-length.

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.

In this article
Back to top Generated by DocFX