Class CompleteAuthenticateManagementKeyResponse
The response to the complete authenticate management key command.
public sealed class CompleteAuthenticateManagementKeyResponse : PivResponse, IYubiKeyResponseWithData<AuthenticateManagementKeyResult>, IYubiKeyResponse
- Inheritance
-
objectCompleteAuthenticateManagementKeyResponse
- Implements
- Inherited Members
Remarks
This is the partner Response class to CompleteAuthenticateManagementKeyCommand.
The data returned is an AuthenticateManagementKeyResult enum.
See the comments for the class InitializeAuthenticateManagementKeyCommand, there is a lengthy discussion of the process of authenticating the management key, including descriptions of the challenges and responses.
Constructors
CompleteAuthenticateManagementKeyResponse(ResponseApdu, ReadOnlyMemory<byte>)
Constructs a CompleteAuthenticateManagementKeyResponse based on a ResponseApdu received from the YubiKey.
public CompleteAuthenticateManagementKeyResponse(ResponseApdu responseApdu, ReadOnlyMemory<byte> yubiKeyAuthenticationExpectedResponse)
Parameters
responseApduResponseApduThe object containing the Response APDU returned by the YubiKey.
yubiKeyAuthenticationExpectedResponseReadOnlyMemory<byte>The bytes the off-card app expects the YubiKey Authentication Response to be.
Remarks
The caller must also pass in the YubiKey Authentication Expected Response. These arguments must all be non-null. However, in the case of single authentication, there will be no YubiKey Authentication Expected Response, so that argument will be "empty", with a Length of zero.
If there is data in the yubiKeyAuthenticationExpectedResponse, it must be 8 bytes,
no more, no less.
If this is mutual authentication, the response APDU will contain the response to YubiKey Authentication Challenge.
Properties
StatusCodeMap
Retrieves the details describing the processing state.
protected override YubiKeyResponse.ResponseStatusPair StatusCodeMap { get; }
Property Value
- YubiKeyResponse.ResponseStatusPair
The ResponseStatus and a descriptive message, as a YubiKeyResponse.ResponseStatusPair.
Remarks
Implementers of subtypes can override this member to change or add mappings.
Methods
GetData()
Determines the result of the management key authentication.
public AuthenticateManagementKeyResult GetData()
Returns
- AuthenticateManagementKeyResult
An
AuthenticateManagementKeyResultenum.
Remarks
If this is mutual authentication, this method will compare the value from
the response APDU to the YubiKey Authentication Challenge. If they are the
same, the YubiKey will have authenticated itself to the Off-Card app.
It is suggested to check the value of Status before calling this method. If the value is neither Success nor AuthenticationRequired, this method will throw an exception.
Exceptions
- InvalidOperationException
Thrown if Status is neither Success nor AuthenticationRequired.
- MalformedYubiKeyResponseException
Thrown when the data provided does not meet the expectations, and cannot be parsed.