Skip to content

Commit 322c7f5

Browse files
committed
remote-cryptokey: fixes + add key-use-overview.png
1 parent f7e0d36 commit 322c7f5

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

remote-cryptokeys/README.md

+27-23
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Authors: [Jon Choukroun](https://github.com/jonchoukroun), Simon Gornall, Michae
55
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
66
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
77

8-
- [Problem](#problem)
9-
- [Goals](#goals)
10-
- [Non-Goals](#non-goals)
11-
- [Proposal](#proposal)
12-
- [`RemoteKeyParams` Dictionary](#remotekeyparams-dictionary)
13-
- [Extensions to the `SubtleCrypto` Interface](#extensions-to-the-subtlecrypto-interface)
14-
- [Examples](#examples)
15-
- [Security \& Privacy Considerations](#security--privacy-considerations)
8+
- [Explainer: “remote” CryptoKeys](#explainer-remote-cryptokeys)
9+
- [Problem](#problem)
10+
- [Goals](#goals)
11+
- [Non-Goals](#non-goals)
12+
- [Proposal](#proposal)
13+
- [`RemoteKeyParams` Dictionary](#remotekeyparams-dictionary)
14+
- [Extensions to the `SubtleCrypto` Interface](#extensions-to-the-subtlecrypto-interface)
15+
- [Examples](#examples)
16+
- [Security \& Privacy Considerations](#security--privacy-considerations)
1617

1718
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1819

@@ -48,7 +49,10 @@ We identified 4 requirements that informed the design of this proposal:
4849
4. No additional user experience burden.
4950

5051
The rest of this document illustrates how end-to-end encryption on the web can be supported using minimal extensions to the [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI/) to support executing cryptographic operations (encrypt, decrypt, sign, and verify) using keys from a user’s secure key store.
51-
[Image: key-use-overview.png]We propose a mechanism through which a web application can request that a cryptographic operation be executed on a given data chunk, using the following process:
52+
53+
![System overview flow chart](key-use-overview.png)
54+
55+
We propose a mechanism through which a web application can request that a cryptographic operation be executed on a given data chunk, using the following process:
5256

5357
1. The web application first acquires an instance of a “remote” `CryptoKey` by calling `getRemoteKey()`, [detailed below](https://quip-apple.com/GGuFA2E20npX#temp:C:SBa6c0fc02f8d014b3bbeaccc68e).
5458

@@ -57,7 +61,7 @@ The rest of this document illustrates how end-to-end encryption on the web can b
5761
2. The web application passes this `CryptoKey` as an argument to methods in the .`subtle` namespace, along with the data to sign, decrypt, etc.
5862
3. The browser then passes the `CryptoKey` and data to the platform. This may be the default key store, an entity managing one or more key stores, or some other process running on the operating system.
5963
1. The device may have more than one such process, it is up to the browser to select one - with user preference guiding the choice.
60-
4. This platform process makes the appropriate access control, user consent checks, and search for a matching key.
64+
4. This platform process makes the appropriate access control and user consent checks, and searches for a matching key.
6165
5. If the key is found, the process will execute the requested cryptographic operation on the given data, and return the output to the browser.
6266
6. If the key is not found, or access control checks fail, the process will return an error to the browser.
6367
1. Returning the same error for both of these cases mitigates a privacy vulnerability where a web application could check on the existence of a key.
@@ -69,7 +73,7 @@ We propose defining a kind of “remote” key that is usable with `CryptoKey`
6973
When creating a remote instance of a `CryptoKey`, the browser sets its attributes accordingly:
7074

7175
- The `extractable` attribute is always `false`.
72-
- For the [[`algorithm]]`internal slot, we define a`RemoteKeyParams` dictionary with the following members:
76+
- For the `[[algorithm]]` internal slot, we define a`RemoteKeyParams` dictionary with the following members:
7377

7478
```WebIDL
7579
// The [[algorithm]] internal slot takes a RemoteKeyParams
@@ -87,9 +91,9 @@ dictionary RemoteKeyParams : Algorithm {
8791

8892
## Extensions to the `SubtleCrypto` Interface
8993

90-
The intention of this proposal is to leverage the existing SubtleCrypto namespace. A platform instance of the `CryptoKey` can be passed as the key argument to existing cryptographic methods without requiring an API change.
94+
The intention of this proposal is to leverage the existing SubtleCrypto namespace. A remote instance of the `CryptoKey` can be passed as the key argument to existing cryptographic methods without requiring an API change.
9195

92-
To support getting a `CryptoKey` handle to remote key material, we propose a new method, an alternative to the existing `generateKey()` function. This method takes a `RemoteKeyParams` dictionary (see above) and an array of key usages. Because the key is never be extractable, we omit the `extractable` boolean parameter from the method signature:
96+
To support getting a `CryptoKey` handle to remote key material, we propose a new method, an alternative to the existing `generateKey()` function. This method takes a `RemoteKeyParams` dictionary (see above) and an array of key usages. Because remote keys are never extractable, we omit the `extractable` boolean parameter from the method signature:
9397

9498
```WebIDL
9599
Promise<CryptoKey> getRemoteKey(
@@ -100,16 +104,16 @@ Promise<CryptoKey> getRemoteKey(
100104

101105
We propose the following implementation of `getRemoteKey()`:
102106

103-
- When called, `getRemoteKey()` receives `RemoteKeyParams` and `keyUsages` parameters, otherwise returns a rejected Promise with some error.
104-
- Return a Promise, and run the following steps [in parallel](https://html.spec.whatwg.org/#in-parallel).
105-
- The browser wraps the existing parameters with the origin of the requesting web application.
106-
- The browser communicates with the platform, passing the parameters to match an existing key.
107-
- The browser will need to implement some means for choosing 1 out of possibly several platforms from which to get the key handle. User preferences should guide this choice.
108-
- How the platform handles access control and user consent checks is out of scope for this proposal. However any response that isn’t a success should reject the Promise with a `NotFoundError`.
109-
- On success, the platform should return a unique identifier which can be used for subsequent key lookups.
110-
- The browser then creates a `CryptoKey` instance, setting the identifier returned from the platform as the `keyId` member, and the expiration time as the `expiresAt` member - if provided.
111-
- A platform process may choose not to return these values, forcing subsequent cryptographic calls through the SubtleCrypto API to do a full key search.
112-
- Finally, resolve the Promise with this CryptoKey object.
107+
1. When called, `getRemoteKey()` receives `RemoteKeyParams` and `keyUsages` parameters, otherwise returns a rejected Promise with some error.
108+
1. Return a Promise, and run the following steps [in parallel](https://html.spec.whatwg.org/#in-parallel).
109+
1. The browser wraps the existing parameters with the origin of the requesting web application.
110+
1. The browser communicates with the platform, passing the parameters to match an existing key.
111+
1. The browser will need to implement some UI for choosing one out of possibly several key providers. User preferences should guide this choice.
112+
1. How the platform handles access control and user consent checks is out of scope for this proposal. However any response that isn’t a success should reject the Promise with a `NotFoundError`.
113+
1. On success, the platform should return a unique identifier which can be used for subsequent key lookups.
114+
1. The browser then creates a `CryptoKey` instance, setting the identifier returned from the platform as the `keyId` member, and the expiration time as the `expiresAt` member - if provided.
115+
1. A platform process may choose not to return these values, forcing subsequent cryptographic calls through the SubtleCrypto API to do a full key search.
116+
1. Finally, resolve the Promise with this `CryptoKey` object.
113117

114118
## Examples
115119

69.1 KB
Loading

0 commit comments

Comments
 (0)