P2:
Response Data format:
Exports the key at the given path. The path is always taken from the data field; since 4.0 nothing is made "current", so the same command is used both to read a key and to leave the card state untouched.
Transaction-signing keys never leave the card. Only the public key can be exported for an arbitrary path. Private key export is restricted to paths under the EIP-1581 subtree (m/43'/60'/1581'…, at least 5 components deep), which by design are not used for transactions.
The extended public key (P2 = 0x02) additionally returns the chain code, which allows non-hardened child public key derivation on the host. It is refused for EIP-1581 paths and, since 4.0, for the master key: exporting the master chain code would let the holder derive every non-hardened descendant of the wallet, so the deepest allowed path is one level below master.
Before 4.0, P1 selected the derivation behaviour: 0x00 exported the current key, 0x01 derived without changing it and 0x02 derived and made the path current. Since there is no current path anymore, P1 is ignored. The master key can no longer be exported as an extended public key.