LicenseSpring C++ SDK
Easily add Software Licensing to your application
Loading...
Searching...
No Matches
LicenseSpring::HardwareKeyOptions Class Reference

Class for managing Hardware Key (YubiKey PIV) specific options. More...

#include <LicenseSpring/ExtendedOptions.h>

Public Member Functions

 HardwareKeyOptions ()=default
 Default constructor. Initializes empty target serial and PIN.
 
 ~HardwareKeyOptions ()=default
 Default destructor.
 
void setTargetSerial (const std::string &serial)
 Sets the serial number of the target YubiKey to be used for signing.
 
const std::string & getTargetSerial () const
 Gets the configured target YubiKey serial number.
 
void setPin (const std::string &pin)
 Sets the PIN required to access the PIV functions on the target YubiKey.
 
const std::string & getPin () const
 Gets the configured PIN for the YubiKey.
 

Static Public Member Functions

static std::vector< std::string > ListAvailableKeys ()
 Lists the serial numbers of all connected YubiKeys with PIV support.
 

Detailed Description

Class for managing Hardware Key (YubiKey PIV) specific options.

Allows discovering available keys, selecting a target key by serial, and setting the required PIN. This object should be configured and then passed to ExtendedOptions.

Definition at line 126 of file ExtendedOptions.h.

Constructor & Destructor Documentation

◆ HardwareKeyOptions()

LicenseSpring::HardwareKeyOptions::HardwareKeyOptions ( )
default

Default constructor. Initializes empty target serial and PIN.

◆ ~HardwareKeyOptions()

LicenseSpring::HardwareKeyOptions::~HardwareKeyOptions ( )
default

Default destructor.

Member Function Documentation

◆ ListAvailableKeys()

static std::vector< std::string > LicenseSpring::HardwareKeyOptions::ListAvailableKeys ( )
static

Lists the serial numbers of all connected YubiKeys with PIV support.

This method performs necessary initialization and cleanup of the ykpiv library internally.

Returns
A vector of strings, each containing a unique serial number. Returns an empty vector if no devices are found or an error occurs during discovery.

◆ setTargetSerial()

void LicenseSpring::HardwareKeyOptions::setTargetSerial ( const std::string & serial)

Sets the serial number of the target YubiKey to be used for signing.

The serial number should match one returned by ListAvailableKeys().

Parameters
serialThe target YubiKey's serial number as a string.

◆ getTargetSerial()

const std::string & LicenseSpring::HardwareKeyOptions::getTargetSerial ( ) const

Gets the configured target YubiKey serial number.

Returns
The target serial string. Returns empty string if not set.

◆ setPin()

void LicenseSpring::HardwareKeyOptions::setPin ( const std::string & pin)

Sets the PIN required to access the PIV functions on the target YubiKey.

Parameters
pinThe PIV application PIN.

◆ getPin()

const std::string & LicenseSpring::HardwareKeyOptions::getPin ( ) const

Gets the configured PIN for the YubiKey.

Returns
The PIN string. Returns empty string if not set.

The documentation for this class was generated from the following file: