NXP NFC Reader Library  v4.040.05.011646
KeyStore

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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKeyEntry number to be Formatted.
[in]wNewKeyTypeNew 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKey number of the key to be loaded.
[in]wKeyVersionKey version of the key to be loaded.
[in]wKeyTypeKey type of the key to be loaded.
[in]pNewKeyPointer to the key itself.
[in]wNewKeyVersionNew 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKey number of the key to be loaded.
[in]wPosKey position to be updated.
[in]wKeyTypeKey type of the key to be loaded.
[in]pNewKeyPointer to the key itself.
[in]wNewKeyVersionNew 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKeyEntry number.
[in]wRefNoKUCReference 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wNoOfKeysNumber of keys in pNewKeys.
[in]wKeyNoKey number of the key to be loaded.
[in]wNewRefNoKUCNumber of the key usage counter used together with that key.
[in]wNewKeyTypeKey type of the key (if the current keyType of KeyEntry is different, error).
[in]pNewKeysArray of Keys to load.
[in]pNewKeyVersionListKeyVersionList 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKey number of the key entry of interest.
[in]wKeyVersionBufSizeBuffer Size of wKeyVersion in Bytes.
[out]wKeyVersionArray for version information.
[out]wKeyVersionLengthLength of valid data in wKeyVersion.
[out]pKeyTypeType 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wKeyNoKey number of the key to be retrieved.
[in]wKeyVersionKey version of the key to be retrieved.
[in]bKeyBufSizeSize of the key buffer.
[out]pKeyPointer to the key itself.
[out]pKeyTypeType 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration Identifier
[in]wValueConfiguration 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration Identifier.
[in]pBufferBuffer containing the configuration string.
[in]wBufferLengthLength 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration Identifier
[out]pValueConfiguration 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wConfigConfiguration Identifier
[out]ppBufferPointer to the buffer containing the configuration string.
[out]pBufferLengthAmount 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wRefNoKUCNumber of key entry.
[in]dwLimitLimit 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_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParamsPointer to this layer's parameter structure.
[in]wRefNoKUCnumber of the key usage counter to be looked at (00h to 0Fh)
[out]pdwLimitCurrently Set Limit in the KUC
[out]pdwCurValCurrently set value in the KUC