P1: 0x00 = Current key 0x01 = Derive 0x02 = Derive and make current
P2: 0x00 = private and public key 0x01 = public key only 0x02 = extended public key
Response Data format:
This command exports the requested public and private key. The public key can be always exported (P2=0x01), but the private key (P2=0x00) can be exported if and only if the requested key path is in the EIP-1581 subtree. The extended public key (P2=0x02) can be exported for any path except those in the EIP-1581 subtree.
The P1 parameter indicates how to the derive the desired key. P1 = 0x00 indicates that the current key must be exported, and no derivation will be performed. P1 = 0x01 derives the path given in the data field without changing the current path of the card. P1 = 0x02 derives the path but also changes the current path of the card. The source for derivation can be set by OR'ing P1 with the constants defined in the DERIVE KEY command. This allows deriving from master, parent or current.
If the private key is being exported, the card could omit exporting the public key for performance reason. The public key can then be calculate off-card if needed.