OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use this API to expose certificates to the platform which can use these | 5 // Use this API to expose certificates to the platform which can use these |
6 // certificates for TLS authentications. | 6 // certificates for TLS authentications. |
7 namespace certificateProvider { | 7 namespace certificateProvider { |
8 enum Hash { | 8 enum Hash { |
9 MD5_SHA1, | 9 MD5_SHA1, |
10 SHA1, | 10 SHA1, |
11 SHA256, | 11 SHA256, |
12 SHA384, | 12 SHA384, |
13 SHA512 | 13 SHA512 |
14 }; | 14 }; |
15 | 15 |
16 enum RequestType { | |
17 PIN, | |
18 PUK | |
19 }; | |
20 | |
21 enum ErrorType { | |
22 INVALID_PIN, | |
23 INVALID_PUK, | |
24 MAX_ATTEMPTS_EXCEEDED, | |
25 UNKNOWN_ERROR | |
26 }; | |
27 | |
16 [noinline_doc] dictionary CertificateInfo { | 28 [noinline_doc] dictionary CertificateInfo { |
17 // Must be the DER encoding of a X.509 certificate. Currently, only | 29 // Must be the DER encoding of a X.509 certificate. Currently, only |
18 // certificates of RSA keys are supported. | 30 // certificates of RSA keys are supported. |
19 ArrayBuffer certificate; | 31 ArrayBuffer certificate; |
20 | 32 |
21 // Must be set to all hashes supported for this certificate. This extension | 33 // Must be set to all hashes supported for this certificate. This extension |
22 // will only be asked for signatures of digests calculated with one of these | 34 // will only be asked for signatures of digests calculated with one of these |
23 // hash algorithms. This should be in order of decreasing hash preference. | 35 // hash algorithms. This should be in order of decreasing hash preference. |
24 Hash[] supportedHashes; | 36 Hash[] supportedHashes; |
25 }; | 37 }; |
26 | 38 |
27 [noinline_doc] dictionary SignRequest { | 39 [noinline_doc] dictionary SignRequest { |
40 // The unique ID to be used if extension will require a PIN. | |
41 long signRequestId; | |
stevenjb
2016/07/25 18:57:57
Nice solution, thanks. This needs to be optional t
igorcov1
2016/07/26 10:21:11
I think Chrome should always include this paramete
stevenjb
2016/07/26 16:10:15
Making this required would break any existing usag
igorcov1
2016/07/26 17:45:29
I don't see how it would break anything existent.
stevenjb
2016/07/28 00:41:56
I guess that JS being JS it won't break the code.
| |
42 | |
28 // The digest that must be signed. | 43 // The digest that must be signed. |
29 ArrayBuffer digest; | 44 ArrayBuffer digest; |
30 | 45 |
31 // Refers to the hash algorithm that was used to create <code>digest</code>. | 46 // Refers to the hash algorithm that was used to create <code>digest</code>. |
32 Hash hash; | 47 Hash hash; |
33 | 48 |
34 // The DER encoding of a X.509 certificate. The extension must sign | 49 // The DER encoding of a X.509 certificate. The extension must sign |
35 // <code>digest</code> using the associated private key. | 50 // <code>digest</code> using the associated private key. |
36 ArrayBuffer certificate; | 51 ArrayBuffer certificate; |
37 }; | 52 }; |
38 | 53 |
54 dictionary RequestPinDetails { | |
55 // The ID given by Chrome when in SignRequest. | |
56 long signRequestId; | |
57 | |
58 // The type of code requested, PIN or PUK. Default is PIN. | |
59 RequestType? requestType; | |
60 | |
61 // The error message to display for user. Default - no error. | |
stevenjb
2016/07/25 18:57:57
The error request would be set if a previous faile
igorcov1
2016/07/26 10:21:11
Done.
| |
62 ErrorType? errorType; | |
63 | |
64 // The number of attempts left. | |
stevenjb
2016/07/25 18:57:57
We should expand this comment, e.g.:
// The number
igorcov1
2016/07/26 10:21:11
Updated, thanks.
| |
65 long? attemptsLeft; | |
66 }; | |
67 | |
68 dictionary StopPinRequestDetails { | |
stevenjb
2016/07/25 18:57:57
We should probably pass signRequestId here.
igorcov1
2016/07/26 10:21:11
At this point we can use the active extension_id (
stevenjb
2016/07/26 16:10:15
Conceivably couldn't the extension issue more than
emaxx
2016/07/26 17:36:21
+1 for passing request id here.
Even though our c
igorcov1
2016/07/26 17:45:29
Yes, we don't plan to keep a queue of requests. If
igorcov1
2016/07/27 11:58:20
Added the ID here and made the details parameter i
| |
69 ErrorType? errorType; | |
70 }; | |
71 | |
72 dictionary PinResponseDetails { | |
73 DOMString? userInput; | |
stevenjb
2016/07/25 18:57:57
This should also provide an error value, e.g. 'REQ
igorcov1
2016/07/26 10:21:11
Good point, but this is intended to be achieved us
stevenjb
2016/07/26 16:10:15
Fair point. We should document that, and define wh
igorcov1
2016/07/26 17:45:29
Done.
| |
74 }; | |
75 | |
76 // A callback called when the dialog gets resolved with the user input, or | |
77 // when the dialog request finishes unsuccessfully (e.g. the dialog was | |
78 // canceled by the user or was not allowed to be shown). | |
79 callback RequestPinCallback = void (optional PinResponseDetails details); | |
80 | |
81 // The callback to be used by Chrome to send to middleware application the | |
82 // status from their request to close PIN dialog for user. | |
83 callback StopPinRequestCallback = void (); | |
stevenjb
2016/07/25 18:57:57
Do we actually need this?
igorcov1
2016/07/26 10:21:11
It might be useful in case the user closes the dia
stevenjb
2016/07/26 16:10:15
Acknowledged.
| |
84 | |
39 // The callback provided by the extension that Chrome uses to report back | 85 // The callback provided by the extension that Chrome uses to report back |
40 // rejected certificates. See <code>CertificatesCallback</code>. | 86 // rejected certificates. See <code>CertificatesCallback</code>. |
41 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); | 87 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); |
42 | 88 |
43 // If no error occurred, this function must be called with the signature of | 89 // If no error occurred, this function must be called with the signature of |
44 // the digest using the private key of the requested certificate. | 90 // the digest using the private key of the requested certificate. |
45 // For an RSA key, the signature must be a PKCS#1 signature. The extension | 91 // For an RSA key, the signature must be a PKCS#1 signature. The extension |
46 // is responsible for prepending the DigestInfo prefix and adding PKCS#1 | 92 // is responsible for prepending the DigestInfo prefix and adding PKCS#1 |
47 // padding. If an <code>MD5_SHA1</code> hash is to be signed, the extension | 93 // padding. If an <code>MD5_SHA1</code> hash is to be signed, the extension |
48 // must not prepend a DigestInfo prefix but only add PKCS#1 padding. | 94 // must not prepend a DigestInfo prefix but only add PKCS#1 padding. |
(...skipping 20 matching lines...) Expand all Loading... | |
69 // certificate provided by this extension in reply to an | 115 // certificate provided by this extension in reply to an |
70 // $(ref:onCertificatesRequested) event. | 116 // $(ref:onCertificatesRequested) event. |
71 // The extension must sign the data in <code>request</code> using the | 117 // The extension must sign the data in <code>request</code> using the |
72 // appropriate algorithm and private key and return it by calling | 118 // appropriate algorithm and private key and return it by calling |
73 // <code>reportCallback</code>. <code>reportCallback</code> must be called | 119 // <code>reportCallback</code>. <code>reportCallback</code> must be called |
74 // exactly once. | 120 // exactly once. |
75 // |request|: Contains the details about the sign request. | 121 // |request|: Contains the details about the sign request. |
76 static void onSignDigestRequested(SignRequest request, | 122 static void onSignDigestRequested(SignRequest request, |
77 SignCallback reportCallback); | 123 SignCallback reportCallback); |
78 }; | 124 }; |
125 | |
126 interface Functions { | |
127 // Requests the PIN from user. | |
128 static void requestPin(RequestPinDetails details, | |
129 RequestPinCallback callback); | |
130 | |
131 // Stops the pin request started by $(ref:requestPin) function. | |
132 static void stopPinRequest(optional StopPinRequestDetails details, | |
133 StopPinRequestCallback callback); | |
134 }; | |
79 }; | 135 }; |
OLD | NEW |