Table of Contents

Class GetPublicKeyResponse

Namespace
Yubico.YubiKey.YubiHsmAuth.Commands
Assembly
Yubico.YubiKey.dll

The response class to retrieve the public key from an asymmetric credential in the YubiHSM Auth application.

public sealed class GetPublicKeyResponse : YubiKeyResponse, IYubiKeyResponseWithData<ReadOnlyMemory<byte>>, IYubiKeyResponse
Inheritance
object
GetPublicKeyResponse
Implements
IYubiKeyResponseWithData<ReadOnlyMemory<byte>>
Inherited Members

Remarks

This response class handles the public key data returned by the GetPublicKey command. The response contains a 65-byte public key (PK-OCE) for asymmetric credentials such as ECC P-256.

The associated command class is GetPublicKeyCommand.

Constructors

GetPublicKeyResponse(ResponseApdu)

Constructs a GetPublicKeyResponse based on a ResponseApdu received from the YubiKey.

public GetPublicKeyResponse(ResponseApdu responseApdu)

Parameters

responseApdu ResponseApdu

The ResponseApdu returned by the YubiKey.

Methods

GetData()

Get the public key (PK-OCE) from the asymmetric credential.

public ReadOnlyMemory<byte> GetData()

Returns

ReadOnlyMemory<byte>

A 65-byte read-only memory containing the public key for the credential. For ECC P-256 credentials, this is an uncompressed elliptic curve point in the format: 0x04 || X (32 bytes) || Y (32 bytes).

Remarks

If the method cannot return the data, it will throw an exception. This happens when the Status property indicates an error, or the data returned from the YubiKey was malformed or incomplete.

Exceptions

InvalidOperationException

The Status is not equal to Success.