How are the above devices built and what is the mechanism that seals them off from giving out private keys? Are the sign/decrypt operations somehow soddered into their hardware, is it a tiny piece of software which only API is to perform the above operations and nothing else? (If the latter, would a software update be able to exportvprivate keys?)

1 Answer 1


Typically these devices contain a key or a small set of keys that are generated at the factory either on the device or are written into the device as part of the manufacturing process. There is also optionally a small amount of additional storage, and firmware that controls the operations and interaction with outside devices.

They typically only process a handful of commands in one of a couple command sets, which are parsed and handled by the firmware. These are often a variant of ISO/IEC 7816, which can be extended in various ways, such as by EMV or FIDO2. They don't contain commands to export any keys, and because the devices are usually designed to be tamper resistant, it's nearly impossible to get the data out of the smartcard or security key.

The cryptographic operations are either done in the firmware, accelerated in hardware, or a combination of the two. In all cases, they're done on the chip.

In some cases, such as Yubikeys doing FIDO2 operations, private keys can be exported, but only encrypted by a key embedded into the device. This is intentional, because it allows security keys to be used nearly an infinite number of times by deriving a key from a small set of factory created keys. The FIDO2 specification allows exporting a key handle, which is the derived key for that website encrypted with the built-in key using a strong AEAD, and the website passes it back and the security key decrypts it and uses it. Unless an attacker can break the AEAD (which is usually AES), they won't be able to do anything with it.

Some devices allow firmware or data updates, and some do not. Yubikeys do not. Your credit or debit card may, and the EMV protocol allows script updates to be sent to the card as part of a transaction. This can be used to allow PIN updates made offline or at an ATM, to raise or allow limits or authentication methods, or anything else an issue wants to do. Usually these updates are digitally signed (which the chip and firmware verify) and often encrypted, so attacking them is not possible provided the update mechanism is implemented securely.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .