TryAuthenticate Method
TryAuthenticate(ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, TimeSpan, out AuthenticationData, Boolean)
Try to authenticate a credential. If this method can't authenticate
the input data or compute the signature, return false
. Any other
error will throw an exception.
public bool TryAuthenticate(ReadOnlyMemory<byte> applicationId, ReadOnlyMemory<byte> clientDataHash, ReadOnlyMemory<byte> keyHandle, TimeSpan timeout, out AuthenticationData authenticationData, bool requireProofOfPresence = true)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlyMemory<System.Byte> | applicationId | Also known as the origin data. A SHA-256 hash of the UTF-8 encoding of the application or service requesting the authentication. See the user's manual article on How Fido U2F works for more information. |
System.ReadOnlyMemory<System.Byte> | clientDataHash | A SHA-256 hash of the client data, a stringified JSON data structure that the caller prepares. Among other things, the client data contains the challenge from the relying party (the application or service that this registration is for). See the user's manual article on How Fido U2F works for more information. |
System.ReadOnlyMemory<System.Byte> | keyHandle | The key handle the YubiKey returned during registration. That value was sent to the relying party and now is being returned to the YubiKey (via the client). |
System.TimeSpan | timeout | The amount of time this method will wait for user touch. The recommended timeout is 5 seconds. The minimum is 1 second and the maximum is 30 seconds. If the input is greater than 30 seconds, this method will set the timeout to 30. If the timeout is greater than 0 but less than one second, the method will set the timeout to 1 second. If the timeout is zero, this method will set no timeout and wait for touch indefinitely (zero timeout means no timeout). |
AuthenticationData | authenticationData | A structure containing the results of the credential authentication, including the signature. |
System.Boolean | requireProofOfPresence | If |
Returns
true
when the credential was successfully authenticated,
false
when the input data could not be used, such as a key
handle that did not match the appId.
Exceptions
Type | Condition |
---|---|
System.TimeoutException | The user presence check timed out. |
Remarks
See the comments for Authenticate(ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, TimeSpan, Boolean) as they apply to this method as well.