Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: chrome/common/extensions/api/certificate_provider.idl

Issue 2094333002: Implementation for chrome.certificateProvider.requestPin/stopPinRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 PinRequestType {
17 PIN,
18 PUK
Devlin 2016/10/20 21:20:44 nit: add a trailing comma here and below
igorcov 2016/10/25 16:38:36 The compiler doesn't like it: [3/37] ACTION //chro
19 };
20
21 enum PinRequestErrorType {
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 by the extension should it need to call a method
41 // that requires it, e.g. requestPin.
42 long signRequestId;
43
28 // The digest that must be signed. 44 // The digest that must be signed.
29 ArrayBuffer digest; 45 ArrayBuffer digest;
30 46
31 // Refers to the hash algorithm that was used to create <code>digest</code>. 47 // Refers to the hash algorithm that was used to create <code>digest</code>.
32 Hash hash; 48 Hash hash;
33 49
34 // The DER encoding of a X.509 certificate. The extension must sign 50 // The DER encoding of a X.509 certificate. The extension must sign
35 // <code>digest</code> using the associated private key. 51 // <code>digest</code> using the associated private key.
36 ArrayBuffer certificate; 52 ArrayBuffer certificate;
37 }; 53 };
38 54
55 dictionary RequestPinDetails {
56 // The ID given by Chrome in SignRequest.
57 long signRequestId;
58
59 // The type of code requested. Default is PIN.
60 PinRequestType? requestType;
61
62 // The error template displayed to the user. This should be set if the
63 // previous request failed, to notify the user of the failure reason.
64 PinRequestErrorType? errorType;
65
66 // The number of attempts left. This is provided so that any UI can present
67 // this information to the user. Chrome is not expected to enforce this,
68 // instead stopPinRequest should be called by the extension with
69 // errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is
70 // exceeded.
71 long? attemptsLeft;
72 };
73
74 dictionary StopPinRequestDetails {
75 // The ID given by Chrome in SignRequest.
76 long signRequestId;
77
78 // The error template. If present it is displayed to user. Intended to
79 // contain the reason for stopping the flow if it was caused by an error,
80 // e.g. MAX_ATTEMPTS_EXCEEDED.
81 PinRequestErrorType? errorType;
82 };
83
84 dictionary PinResponseDetails {
85 // The code provided by the user. Empty if user closed the dialog or some
86 // other error occurred.
87 DOMString? userInput;
88 };
89
90 callback RequestPinCallback = void (optional PinResponseDetails details);
91
92 callback StopPinRequestCallback = void ();
93
39 // The callback provided by the extension that Chrome uses to report back 94 // The callback provided by the extension that Chrome uses to report back
40 // rejected certificates. See <code>CertificatesCallback</code>. 95 // rejected certificates. See <code>CertificatesCallback</code>.
41 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); 96 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates);
42 97
43 // If no error occurred, this function must be called with the signature of 98 // If no error occurred, this function must be called with the signature of
44 // the digest using the private key of the requested certificate. 99 // 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 100 // 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 101 // 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 102 // 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. 103 // must not prepend a DigestInfo prefix but only add PKCS#1 padding.
(...skipping 20 matching lines...) Expand all
69 // certificate provided by this extension in reply to an 124 // certificate provided by this extension in reply to an
70 // $(ref:onCertificatesRequested) event. 125 // $(ref:onCertificatesRequested) event.
71 // The extension must sign the data in <code>request</code> using the 126 // The extension must sign the data in <code>request</code> using the
72 // appropriate algorithm and private key and return it by calling 127 // appropriate algorithm and private key and return it by calling
73 // <code>reportCallback</code>. <code>reportCallback</code> must be called 128 // <code>reportCallback</code>. <code>reportCallback</code> must be called
74 // exactly once. 129 // exactly once.
75 // |request|: Contains the details about the sign request. 130 // |request|: Contains the details about the sign request.
76 static void onSignDigestRequested(SignRequest request, 131 static void onSignDigestRequested(SignRequest request,
77 SignCallback reportCallback); 132 SignCallback reportCallback);
78 }; 133 };
134
135 interface Functions {
136 // Requests the PIN from user. Only one ongoing request at a time is
Devlin 2016/10/20 21:20:44 "from the user"
igorcov 2016/10/25 16:38:35 Done.
137 // allowed. The requests issued while another flow is ongoing are rejected.
138 // It's the extension's responsibility to try again later if another flow is
139 // in progress. <code>callback</code> is called when the dialog gets
Devlin 2016/10/20 21:20:44 s/gets/is
Devlin 2016/10/20 21:20:44 Instead of referencing variables in the main descr
igorcov 2016/10/25 16:38:35 Done.
igorcov 2016/10/25 16:38:36 Done.
140 // resolved with the user input, or when the dialog request finishes
141 // unsuccessfully (e.g. the dialog was canceled by the user or was not
142 // allowed to be shown).
143 static void requestPin(RequestPinDetails details,
144 RequestPinCallback callback);
145
146 // Stops the pin request started by the $(ref:requestPin) function.
147 // <code>callback</code> to be used by Chrome to send to the extension the
148 // status from their request to close PIN dialog for user.
149 static void stopPinRequest(StopPinRequestDetails details,
150 StopPinRequestCallback callback);
151 };
79 }; 152 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698