NXP NFC Reader Library v4.040.05.011646

Modules | Macros | Functions
KeyStore
Common

This is only a wrapper layer to abstract the different KeyStore implementations. More...

Collaboration diagram for KeyStore:

## Modules
| Component : Software
| Keystore implementation in Software.
| PhKeyStore_Rc663

## Macros
#define | PH_KEYSTORE_INVALID_ID 0xFFFFU
| ID used for various parameters as a invalid default.
#define | PH_KEYSTORE_DEFAULT_ID 0x0000
| ID used for various parameters as a default.

## Functions
phStatus_t | phKeyStore_FormatKeyEntry (void *pDataParams, uint16_t wKeyNo, uint16_t wNewKeyType)
| Format a key entry to a new KeyType. More...
phStatus_t | phKeyStore_SetKey (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVersion, uint16_t wKeyType, uint8_t *pNewKey, uint16_t wNewKeyVersion)
| Change a key entry at a given version. More...
phStatus_t | phKeyStore_SetKeyAtPos (void *pDataParams, uint16_t wKeyNo, uint16_t wPos, uint16_t wKeyType, uint8_t *pNewKey, uint16_t wNewKeyVersion)
| Change a key entry at the specified position. More...
phStatus_t | phKeyStore_SetKUC (void *pDataParams, uint16_t wKeyNo, uint16_t wRefNoKUC)
| Change the KUC of a key entry. More...
phStatus_t | phKeyStore_SetFullKeyEntry (void *pDataParams, uint16_t wNoOfKeys, uint16_t wKeyNo, uint16_t wNewRefNoKUC, uint16_t wNewKeyType, uint8_t *pNewKeys, uint16_t *pNewKeyVersionList)
| Change a full key entry. More...
phStatus_t | phKeyStore_GetKeyEntry (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVersionBufSize, uint16_t *wKeyVersion, uint16_t *wKeyVersionLength, uint16_t *pKeyType)
| Get a key entry information block. More...
phStatus_t | phKeyStore_GetKey (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVersion, uint8_t bKeyBufSize, uint8_t *pKey, uint16_t *pKeyType)
| Get a key. More...
phStatus_t | phKeyStore_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
| Set configuration parameter. More...
phStatus_t | phKeyStore_SetConfigStr (void *pDataParams, uint16_t wConfig, uint8_t *pBuffer, uint16_t wBufferLength)
| Set configuration parameter. More...
phStatus_t | phKeyStore_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
| Get configuration parameter. More...
phStatus_t | phKeyStore_GetConfigStr (void *pDataParams, uint16_t wConfig, uint8_t **ppBuffer, uint16_t *pBufferLength)
| Get configuration parameter. More...
phStatus_t | phKeyStore_ChangeKUC (void *pDataParams, uint16_t wRefNoKUC, uint32_t dwLimit)
| Change a key usage counter entry. More...
phStatus_t | phKeyStore_GetKUC (void *pDataParams, uint16_t wRefNoKUC, uint32_t *pdwLimit, uint32_t *pdwCurVal)
| Obtain a key usage counter entry. More...

## Key Types
#define | PH_KEYSTORE_KEY_TYPE_AES128 0x00U
| AES 128 Key [16]. More...
#define | PH_KEYSTORE_KEY_TYPE_AES192 0x01U
| AES 192 Key [24]. More...
#define | PH_KEYSTORE_KEY_TYPE_AES256 0x02U
| AES 256 Key [32]. More...
#define | PH_KEYSTORE_KEY_TYPE_DES 0x03U
| DES Single Key. More...
#define | PH_KEYSTORE_KEY_TYPE_2K3DES 0x04U
| 2 Key Triple Des. More...
#define | PH_KEYSTORE_KEY_TYPE_3K3DES 0x05U
| 3 Key Triple Des. More...
#define | PH_KEYSTORE_KEY_TYPE_MIFARE 0x06U
| MIFARE (R) Key. More...
#define | PH_KEYSTORE_KEY_TYPE_MIFARE_SIZE 0x0CU
| Size of an MIFARE Key. More...
#define | PH_KEYSTORE_KEY_TYPE_AES128_SIZE 0x10U
| Size of an AES128 Key. More...

## KeyStoreConfigs
#define | PH_KEYSTORE_CONFIG_SET_DEFAULT 0xFFFFU
| Reset all bit of SET param. More...

## Detailed Description

This is only a wrapper layer to abstract the different KeyStore implementations.

## Macro Definition Documentation

## § PH_KEYSTORE_KEY_TYPE_AES128

#define PH_KEYSTORE_KEY_TYPE_AES128 0x00U

AES 128 Key [16].

## § PH_KEYSTORE_KEY_TYPE_AES192

#define PH_KEYSTORE_KEY_TYPE_AES192 0x01U

AES 192 Key [24].

## § PH_KEYSTORE_KEY_TYPE_AES256

#define PH_KEYSTORE_KEY_TYPE_AES256 0x02U

AES 256 Key [32].

## § PH_KEYSTORE_KEY_TYPE_DES

#define PH_KEYSTORE_KEY_TYPE_DES 0x03U

DES Single Key.

## § PH_KEYSTORE_KEY_TYPE_2K3DES

#define PH_KEYSTORE_KEY_TYPE_2K3DES 0x04U

2 Key Triple Des.

## § PH_KEYSTORE_KEY_TYPE_3K3DES

#define PH_KEYSTORE_KEY_TYPE_3K3DES 0x05U

3 Key Triple Des.

## § PH_KEYSTORE_KEY_TYPE_MIFARE

#define PH_KEYSTORE_KEY_TYPE_MIFARE 0x06U

MIFARE (R) Key.

## § PH_KEYSTORE_KEY_TYPE_MIFARE_SIZE

#define PH_KEYSTORE_KEY_TYPE_MIFARE_SIZE 0x0CU

Size of an MIFARE Key.

## § PH_KEYSTORE_KEY_TYPE_AES128_SIZE

#define PH_KEYSTORE_KEY_TYPE_AES128_SIZE 0x10U

Size of an AES128 Key.

## § PH_KEYSTORE_CONFIG_SET_DEFAULT

#define PH_KEYSTORE_CONFIG_SET_DEFAULT 0xFFFFU

Reset all bit of SET param.

## Function Documentation

## § phKeyStore_FormatKeyEntry()

phStatus_t phKeyStore_FormatKeyEntry | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wNewKeyType
| ) |  |

Format a key entry to a new KeyType.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | KeyEntry number to be Formatted.
  [in] | wNewKeyType | New Key type of the KeyEntry (predefined type of KeyType).

## § phKeyStore_SetKey()

phStatus_t phKeyStore_SetKey | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wKeyVersion,
|  | uint16_t | wKeyType,
|  | uint8_t * | pNewKey,
|  | uint16_t | wNewKeyVersion
| ) |  |

Change a key entry at a given version.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | Key number of the key to be loaded.
  [in] | wKeyVersion | Key version of the key to be loaded.
  [in] | wKeyType | Key type of the key to be loaded.
  [in] | pNewKey | Pointer to the key itself.
  [in] | wNewKeyVersion | New Key version of the key to be updated.

## § phKeyStore_SetKeyAtPos()

phStatus_t phKeyStore_SetKeyAtPos | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wPos,
|  | uint16_t | wKeyType,
|  | uint8_t * | pNewKey,
|  | uint16_t | wNewKeyVersion
| ) |  |

Change a key entry at the specified position.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | Key number of the key to be loaded.
  [in] | wPos | Key position to be updated.
  [in] | wKeyType | Key type of the key to be loaded.
  [in] | pNewKey | Pointer to the key itself.
  [in] | wNewKeyVersion | New Key version of the key to be updated.

## § phKeyStore_SetKUC()

phStatus_t phKeyStore_SetKUC | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wRefNoKUC
| ) |  |

Change the KUC of a key entry.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | KeyEntry number.
  [in] | wRefNoKUC | Reference Number of the key usage counter used together with that key.

## § phKeyStore_SetFullKeyEntry()

phStatus_t phKeyStore_SetFullKeyEntry | ( | void * | pDataParams,
|  | uint16_t | wNoOfKeys,
|  | uint16_t | wKeyNo,
|  | uint16_t | wNewRefNoKUC,
|  | uint16_t | wNewKeyType,
|  | uint8_t * | pNewKeys,
|  | uint16_t * | pNewKeyVersionList
| ) |  |

Change a full key entry.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wNoOfKeys | Number of keys in pNewKeys.
  [in] | wKeyNo | Key number of the key to be loaded.
  [in] | wNewRefNoKUC | Number of the key usage counter used together with that key.
  [in] | wNewKeyType | Key type of the key (if the current keyType of KeyEntry is different, error).
  [in] | pNewKeys | Array of Keys to load.
  [in] | pNewKeyVersionList | KeyVersionList of the key to be loaded .

## § phKeyStore_GetKeyEntry()

phStatus_t phKeyStore_GetKeyEntry | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wKeyVersionBufSize,
|  | uint16_t * | wKeyVersion,
|  | uint16_t * | wKeyVersionLength,
|  | uint16_t * | pKeyType
| ) |  |

Get a key entry information block.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | Key number of the key entry of interest.
  [in] | wKeyVersionBufSize | Buffer Size of wKeyVersion in Bytes.
  [out] | wKeyVersion | Array for version information.
  [out] | wKeyVersionLength | Length of valid data in wKeyVersion.
  [out] | pKeyType | Type of the key.

## § phKeyStore_GetKey()

phStatus_t phKeyStore_GetKey | ( | void * | pDataParams,
|  | uint16_t | wKeyNo,
|  | uint16_t | wKeyVersion,
|  | uint8_t | bKeyBufSize,
|  | uint8_t * | pKey,
|  | uint16_t * | pKeyType
| ) |  |

Get a key.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wKeyNo | Key number of the key to be retrieved.
  [in] | wKeyVersion | Key version of the key to be retrieved.
  [in] | bKeyBufSize | Size of the key buffer.
  [out] | pKey | Pointer to the key itself.
  [out] | pKeyType | Type of the key.

## § phKeyStore_SetConfig()

phStatus_t phKeyStore_SetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t | wValue
| ) |  |

Set configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier
  [in] | wValue | Configuration Value

## § phKeyStore_SetConfigStr()

phStatus_t phKeyStore_SetConfigStr | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint8_t * | pBuffer,
|  | uint16_t | wBufferLength
| ) |  |

Set configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier.
  [in] | pBuffer | Buffer containing the configuration string.
  [in] | wBufferLength | Length of configuration string.

## § phKeyStore_GetConfig()

phStatus_t phKeyStore_GetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t * | pValue
| ) |  |

Get configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier
  [out] | pValue | Configuration Value

## § phKeyStore_GetConfigStr()

phStatus_t phKeyStore_GetConfigStr | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint8_t ** | ppBuffer,
|  | uint16_t * | pBufferLength
| ) |  |

Get configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier
  [out] | ppBuffer | Pointer to the buffer containing the configuration string.
  [out] | pBufferLength | Amount of valid bytes in the configuration string buffer.

## § phKeyStore_ChangeKUC()

phStatus_t phKeyStore_ChangeKUC | ( | void * | pDataParams,
|  | uint16_t | wRefNoKUC,
|  | uint32_t | dwLimit
| ) |  |

Change a key usage counter entry.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wRefNoKUC | Number of key entry.
  [in] | dwLimit | Limit of the Key Usage Counter

## § phKeyStore_GetKUC()

phStatus_t phKeyStore_GetKUC | ( | void * | pDataParams,
|  | uint16_t | wRefNoKUC,
|  | uint32_t * | pdwLimit,
|  | uint32_t * | pdwCurVal
| ) |  |

Obtain a key usage counter entry.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wRefNoKUC | number of the key usage counter to be looked at (00h to 0Fh)
  [out] | pdwLimit | Currently Set Limit in the KUC
  [out] | pdwCurVal | Currently set value in the KUC