enums: PSKC Library (libpskc) Manual

## enums

enums — PSKC value enumerations and related functions.

## Functions

const char * | pskc_pinusagemode2str ()
pskc_pinusagemode | pskc_str2pinusagemode ()
const char * | pskc_valueformat2str ()
pskc_valueformat | pskc_str2valueformat ()
const char * | pskc_keyusage2str ()
pskc_keyusage | pskc_str2keyusage ()

## Types and Values

enum | pskc_pinusagemode
enum | pskc_valueformat
enum | pskc_keyusage

## Description

The pskc_pinusagemode type describes PIN Policy Usage Modes. You can convert between string representation and integer values using `pskc_pinusagemode2str()` and `pskc_str2pinusagemode()`.

The pskc_valueformat type describes PSKC data value encodings. You can convert between string representation and integer values using `pskc_valueformat2str()` and `pskc_str2valueformat()`.

The pskc_keyusage type describes what PSKC keys may be used for. You can convert between string representation and integer values using `pskc_keyusage2str()` and `pskc_str2keyusage()`. Note that often multiple pskc_keyusage values are ORed together to form set of values.

## Functions

### pskc_pinusagemode2str ()

    const char *
    pskc_pinusagemode2str (pskc_pinusagemode pinusagemode);

Convert pskc_pinusagemode to a string. For example, pskc_pinusagemode2str(`PSKC_PINUSAGEMODE_LOCAL`) will return "Local". The returned string must not be deallocated.

#### Parameters

pinusagemode | an pskc_pinusagemode enumeration type |

#### Returns

String corresponding to pskc_pinusagemode.

### pskc_str2pinusagemode ()

    pskc_pinusagemode
    pskc_str2pinusagemode (const char *pinusagemode);

Convert a string to a pskc_pinusagemode type. For example, pskc_str2pinusagemode("Local") will return `PSKC_PINUSAGEMODE_LOCAL`.

#### Parameters

pinusagemode | an string describing a key usage. |

#### Returns

The corresponding pskc_pinusagemode value.

### pskc_valueformat2str ()

    const char *
    pskc_valueformat2str (pskc_valueformat valueformat);

Convert pskc_valueformat to a string. For example, pskc_valueformat2str(`PSKC_VALUEFORMAT_DECIMAL`) will return "DECIMAL". The returned string must not be deallocated.

#### Parameters

valueformat | an pskc_valueformat enumeration type |

#### Returns

String corresponding to pskc_valueformat.

### pskc_str2valueformat ()

    pskc_valueformat
    pskc_str2valueformat (const char *valueformat);

Convert a string to a pskc_valueformat type. For example, pskc_str2valueformat("DECIMAL") will return `PSKC_VALUEFORMAT_DECIMAL`.

#### Parameters

valueformat | an string describing a key usage. |

#### Returns

The corresponding pskc_valueformat value.

### pskc_keyusage2str ()

    const char *
    pskc_keyusage2str (pskc_keyusage keyusage);

Convert pskc_keyusage to a string. For example, pskc_keyusage2str(`PSKC_KEYUSAGE_OTP`) will return "OTP". The returned string must not be deallocated.

#### Parameters

keyusage | an pskc_keyusage enumeration type |

#### Returns

String corresponding to pskc_keyusage.

### pskc_str2keyusage ()

    pskc_keyusage
    pskc_str2keyusage (const char *keyusage);

Convert a string to a pskc_keyusage type. For example, pskc_str2keyusage("KeyWrap") will return `PSKC_KEYUSAGE_KEYWRAP`.

#### Parameters

keyusage | an string describing a key usage. |

#### Returns

The corresponding pskc_keyusage value.

## Types and Values

### enum pskc_pinusagemode

Enumeration of PIN Policy Usage Modes. This indicate the way the PIN is used.

#### Members

PSKC_PINUSAGEMODE_UNKNOWN | Unknown mode. |
PSKC_PINUSAGEMODE_LOCAL | PIN is checked locally on the device. |
PSKC_PINUSAGEMODE_PREPEND | PIN is prepended to the OTP and checked by OTP validating party. |
PSKC_PINUSAGEMODE_APPEND | PIN is appended to the OTP and checked by OTP validating party. |
PSKC_PINUSAGEMODE_ALGORITHMIC | The PIN is used as part of the algorithm computation. |
PSKC_PINUSAGEMODE_LAST | Meta-value corresponding to the highest value, for use in iterating over all usage mode values. |

### enum pskc_valueformat

Enumeration of PSKC value encoding formats.

#### Members

PSKC_VALUEFORMAT_UNKNOWN | Unknown format. |
PSKC_VALUEFORMAT_DECIMAL | Only numerical digits. |
PSKC_VALUEFORMAT_HEXADECIMAL | Hexadecimal response. |
PSKC_VALUEFORMAT_ALPHANUMERIC | All letters and numbers (case sensitive). |
PSKC_VALUEFORMAT_BASE64 | Base-64 encoded. |
PSKC_VALUEFORMAT_BINARY | Binary data. |
PSKC_VALUEFORMAT_LAST | Meta-value corresponding to the highest value, for use in iterating over all encoding format values. |

### enum pskc_keyusage

Enumeration of PSKC key usage values. These values puts constraints on the intended usage of the key. The recipient of the PSKC document MUST enforce the key usage. The values are assigned to numbers so that they can be ORed together to form a set of values.

#### Members

PSKC_KEYUSAGE_UNKNOWN | Unknown format. |
PSKC_KEYUSAGE_OTP | The key MUST only be used for OTP generation. |
PSKC_KEYUSAGE_CR | The key MUST only be used for Challenge/Response purposes. |
PSKC_KEYUSAGE_ENCRYPT | The key MUST only be used for data encryption purposes. |
PSKC_KEYUSAGE_INTEGRITY | The key MUST only be used to generate a keyed message digest for data integrity or authentication purposes. |
PSKC_KEYUSAGE_VERIFY | The key MUST only be used to verify a keyed message digest for data integrity or authentication purposes (this is the opposite key usage of 'Integrity'). |
PSKC_KEYUSAGE_UNLOCK | The key MUST only be used for an inverse Challenge/ Response in the case where a user has locked the device by entering a wrong PIN too many times (for devices with PIN-input capability). |
PSKC_KEYUSAGE_DECRYPT | The key MUST only be used for data decryption purposes. |
PSKC_KEYUSAGE_KEYWRAP | The key MUST only be used for key wrap purposes. |
PSKC_KEYUSAGE_UNWRAP | The key MUST only be used for key unwrap purposes. |
PSKC_KEYUSAGE_DERIVE | The key MUST only be used with a key derivation function to derive a new key. |
PSKC_KEYUSAGE_GENERATE | The key MUST only be used to generate a new key based on a random number and the previous value of the key. |
PSKC_KEYUSAGE_LAST | Meta-value corresponding to the highest value, for use in iterating over all key usage values. |