You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
19
@@ -48,7 +49,10 @@ We identified 4 requirements that informed the design of this proposal:
48
49
4. No additional user experience burden.
49
50
50
51
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:
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
56
53
57
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).
54
58
@@ -57,7 +61,7 @@ The rest of this document illustrates how end-to-end encryption on the web can b
57
61
2. The web application passes this `CryptoKey` as an argument to methods in the .`subtle` namespace, along with the data to sign, decrypt, etc.
58
62
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.
59
63
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.
61
65
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.
62
66
6. If the key is not found, or access control checks fail, the process will return an error to the browser.
63
67
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`
69
73
When creating a remote instance of a `CryptoKey`, the browser sets its attributes accordingly:
70
74
71
75
- 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:
73
77
74
78
```WebIDL
75
79
// The [[algorithm]] internal slot takes a RemoteKeyParams
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.
91
95
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:
We propose the following implementation of `getRemoteKey()`:
102
106
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.
0 commit comments