The Derive Key administration command allows you to generate new cryptographic keys from existing seeds or key pairs. This methodology has the following key features:
Derivation And Keys System
If no valid parent key is available, the command will respond with a 0x6B00 status code. For example, when the current key pair is the master root.
📘 Note
This complex key management off the card isn’t necessary if the card is signing fewer than 1,000 transactions per day.
Command specifications
Derive Key Command
The Derive Key command enables you to generate the new cryptographic keys from existing seeds or key pairs. This functionality is essential for creating keys tailored to specific cryptographic operations. This includes things like signing or encryption, without exposing the original master keys. By deriving keys in this manner, you can maintain a high level of security and flexibility in their cryptographic processes.
The following code snippet outlines the Python object for this command:
def derive_key(key_type: KeyType, path: str = "m/44'/0'/0'/0/0"):
card.derive(key_type, path)
For example, derive_key(KeyType.BIP32, “m/44’/0’/0’/0/0”).
📘 Note
The BIP32 specifications define a few checks which must be performed on the derived keys. If these fail, mostly using r1 curve, there is a looping mechanism described by the SLIP10 proposal, enforced by the card. In such cases, you can perform a Get Status command to get the current key path and resume derivation using a different path.
Application Protocol Data Unit (APDU) Components
The following table outlines the components of the Application Protocol Data Unit (APDU).
Field | Description | Value |
CLA | This field specifies the class of the instruction. | 0x80 |
INS | This field specifies the particular command or operation that the smart card or secure element should execute. | 0xD1 |
P1 | First parameter of the instruction that specifies the details about the operation being requested. | Derivation options. See the table below for more information. |
P2 | Second parameter of the instruction that specifies additional details about the operation being requested. | 0x00 |
Data | Key data | A sequence of 32-bit integers (most significant byte first). Keep this empty if you are using the master key. |
The following table outlines the values for the P1 field within the ADPU components based on some conditions:
P1 Bit | Value |
0 | LSB 0x01 |
0-3 | Reserved bits |
4 | 0 use 256k1 EC1 use 256r1 EC |
5 | Reserved bit |
6 and 7 |
|
7 | MSB 0x80 |
📘 Prerequisites
Response
The following table outlines the possible responses that you will receive:
Response Code | Description |
0x9000 | Success |
0x6A80 | Invalid format |
0x6B00 | Derivation from parent keys is selected but no valid parent key is cached. For example, the master root is the current key pair set. |
0x6985 | There is no seed loaded on the card or the PIN is not verified. |