Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EC keys: consolidate API for handling keys in TEE #2287

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

cpetrov
Copy link
Member

@cpetrov cpetrov commented Jan 29, 2024

The inTee option and the teeKeyHandle format provided a way to create keys in the TEE and export them as opaque handles. While this API made it transparent when a key is really stored in the TEE, it was not convenient in practice, as it required the application to conduct specific checks for hardware support on Android in order to decide whether to store the key in TEE or not.

This commit removes the inTee option. ECDSA and ECDH keys with extractable set to false are now generated in the TEE by the platform when the device supports it. When the device does not support it, the key is generated in software. In practice, this means that non-extractable EC* keys are always generated in TEE on iOS, and on Android only when the device supports it.

The "teeKeyHandle" format has also been removed. The exportKey method called for EC* keys with extractable set to false and the format "raw" now returns an opaque handle to the key in the TEE instead of throwing.

@cpetrov cpetrov force-pushed the mr-consolidate-tee-api branch from fd2f8ad to d318f14 Compare January 29, 2024 09:44
snippets/crypto-sign.ts Outdated Show resolved Hide resolved
@cpetrov cpetrov force-pushed the mr-consolidate-tee-api branch 2 times, most recently from 5a584ab to 587a62c Compare February 5, 2024 18:44
The `inTee` option and the `teeKeyHandle` format provided a way to
create keys in the TEE and export them as opaque handles. While this API
made it transparent when a key is really stored in the TEE, it was not
convenient in practice, as it required the application to conduct
specific checks for hardware support on Android in order to decide
whether to store the key in TEE or not.

This commit removes the `inTee` option. ECDSA and ECDH keys with
`extractable` set to `false` are now generated in the TEE by the
platform when the device supports it. When the device does not support
it, the key is generated in software. In practice, this means that
non-extractable EC* keys are always generated in TEE on iOS, and on
Android only when the device supports it.

The `"teeKeyHandle"` format has also been removed. The `exportKey`
method called for EC* keys with `extractable` set to `false` and the
format `"raw"` now returns an opaque handle to the key in the TEE
instead of throwing.
@cpetrov cpetrov force-pushed the mr-consolidate-tee-api branch from 587a62c to 7e2bcab Compare February 5, 2024 18:45
@cpetrov cpetrov merged commit 040079c into master Feb 5, 2024
1 check passed
@cpetrov cpetrov deleted the mr-consolidate-tee-api branch February 5, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants