Show / Hide Table of Contents

TryChangePin Method

TryChangePin()

For a version 4 FIPS series YubiKey that has a PIN set on the U2F application, this will call on the KeyCollector to obtain the current and a new PIN and use them to change the U2F PIN. If the caller cancels (the return from the KeyCollector is false), this will return false.

C#
public bool TryChangePin()

Returns

bool

A boolean, true if the PIN is changed, false if the user cancels PIN collection.

Exceptions

Type Condition
SecurityException

The YubiKey is not version 4 FIPS series, or the PIN is blocked.

Remarks

See the documentation for ChangePin() for more information on changing a PIN.

TryChangePin(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

For a version 4 FIPS series YubiKey that has a PIN set on the U2F application, this will use the provided current and new PINs to change the U2F PIN. If the current PIN given is not correct, or the new PIN is not a correct length, this method will return false.

C#
public bool TryChangePin(ReadOnlyMemory<byte> currentPin, ReadOnlyMemory<byte> newPin)

Parameters

Type Name Description
ReadOnlyMemory<byte> currentPin
ReadOnlyMemory<byte> newPin

Returns

bool

A boolean, true if the PIN is changed, false otherwise.

Exceptions

Type Condition
SecurityException

The PIN is blocked.

NotSupportedException

The YubiKey is not version 4 FIPS series.

Remarks

See the documentation for ChangePin() for more information on changing a PIN.

In this article
Back to top Generated by DocFX