TryChangePinAndPukRetryCounts Method
TryChangePinAndPukRetryCounts(ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, Byte, Byte, out Nullable<Int32>)
Try to change the retry counts for both the PIN and PUK. This method
will use the managementKey
and pin
provided.
Warning
This will reset the PIN and PUK to their default values as well as set the retry counts.
public bool TryChangePinAndPukRetryCounts(ReadOnlyMemory<byte> managementKey, ReadOnlyMemory<byte> pin, byte newRetryCountPin, byte newRetryCountPuk, out Nullable<int> retriesRemaining)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | managementKey | The current management key. If it is |
System.ReadOnlyMemory<System.Byte> | pin | The current PIN. |
System.Byte | newRetryCountPin | The PIN's new retry count. |
System.Byte | newRetryCountPuk | The PUK's new retry count. |
System.Nullable<System.Int32> | retriesRemaining | An output, it will be set to the number of retries remaining if the PIN is not verified. If the management key is not authenticated or the PIN is verified, this will be set to null. |
Returns
A boolean, true
if the retry counts are changed, false
if not.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The YubiKey had some error, such as unreliable connection. |
System.Security.SecurityException | The remaining retries count indicates the PIN is blocked. |
Remarks
Normally, an application would call the
ChangePinAndPukRetryCounts(int, int)
method and the SDK would
call on the loaded KeyCollector
to retrieve the management key
and PIN. With this method, the caller provides the management key and
PIN and the KeyCollector
is never contacted.
Some applications would like to avoid using a KeyCollector
.
For such situations, this method is provided.
See the ChangePinAndPukRetryCounts(Byte, Byte) method for further documentation on this method.
If the wrong management key or PIN is provided, this method will
return false
.
This method will authenticate the management key provided and verify the PIN provided, even if one or both have already been authenticated/verified.
If the YubiKey is configured for PIN-only, the managementKey
argument will be ignored. In this case, you can pass in an empty
management key: ReadOnlyMemory<byte>.Empty
.