Key Diversification
diversify_key ¶
diversify_key(
key_data: list[int],
diversification: list[int],
pad_to_32: bool = True,
) -> list[int]
Generates a diversified key based on NXP application note AN10922
The diversification data is not standardized but it is recommended to include data that is unique to the card and the application. For example, the UID of the card, the AID of the application, and the system ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_data
|
list[int]
|
Original key data that will be diversified. |
required |
diversification
|
list[int]
|
Diversification data. Refer to the application note for a recommendation |
required |
pad_to_32
|
bool
|
The NXP application note calls for the diversification data to be padded to 32 bytes. Depending on the block size of the underlying cipher, this might not be neccessary and there may be existing implementations that do not pad the data. |
True
|
Returns:
| Type | Description |
|---|---|
list[int]
|
list[int]: Diversified key data |