SetPin Method
SetPin()
Sets the initial FIDO2 PIN using the KeyCollector
. To change an existing PIN, use
the ChangePin() function.
public void SetPin()
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | The YubiKey already has a PIN set. This function cannot be used to change the PIN. |
System.OperationCanceledException | The user cancelled PIN collection. This happens when the application returns |
Remarks
The Yubikey is manufactured with no default PIN set on the FIDO2 application. To configure a YubiKey's initial PIN, use this function. This function will only succeed if no PIN is currently configured. To change an existing PIN, use the ChangePin() method instead. Once set, a PIN cannot be removed without resetting the FIDO2 application. The reset operation will remove the PIN and clear all registered credentials.
Several considerations must be made when collecting the PIN.
- It must be encoded in UTF-8 with Normalization Form C.
- It must be at least 4 Unicode code points in length.
- It must not exceed 63 bytes in encoded length.