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

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: Merged the sources Created 4 years 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 // The type of code being requested by the extension with requestPin function.
17 enum PinRequestType {
18 PIN,
19 PUK
20 };
21
22 // The types of errors that can be presented to the user through the
23 // requestPin function.
24 enum PinRequestErrorType {
25 INVALID_PIN,
26 INVALID_PUK,
27 MAX_ATTEMPTS_EXCEEDED,
28 UNKNOWN_ERROR
29 };
30
16 [noinline_doc] dictionary CertificateInfo { 31 [noinline_doc] dictionary CertificateInfo {
17 // Must be the DER encoding of a X.509 certificate. Currently, only 32 // Must be the DER encoding of a X.509 certificate. Currently, only
18 // certificates of RSA keys are supported. 33 // certificates of RSA keys are supported.
19 ArrayBuffer certificate; 34 ArrayBuffer certificate;
20 35
21 // Must be set to all hashes supported for this certificate. This extension 36 // 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 37 // 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. 38 // hash algorithms. This should be in order of decreasing hash preference.
24 Hash[] supportedHashes; 39 Hash[] supportedHashes;
25 }; 40 };
26 41
27 [noinline_doc] dictionary SignRequest { 42 [noinline_doc] dictionary SignRequest {
43 // The unique ID to be used by the extension should it need to call a method
44 // that requires it, e.g. requestPin.
45 long signRequestId;
46
28 // The digest that must be signed. 47 // The digest that must be signed.
29 ArrayBuffer digest; 48 ArrayBuffer digest;
30 49
31 // Refers to the hash algorithm that was used to create <code>digest</code>. 50 // Refers to the hash algorithm that was used to create <code>digest</code>.
32 Hash hash; 51 Hash hash;
33 52
34 // The DER encoding of a X.509 certificate. The extension must sign 53 // The DER encoding of a X.509 certificate. The extension must sign
35 // <code>digest</code> using the associated private key. 54 // <code>digest</code> using the associated private key.
36 ArrayBuffer certificate; 55 ArrayBuffer certificate;
37 }; 56 };
38 57
58 dictionary RequestPinDetails {
59 // The ID given by Chrome in SignRequest.
60 long signRequestId;
61
62 // The type of code requested. Default is PIN.
63 PinRequestType? requestType;
64
65 // The error template displayed to the user. This should be set if the
66 // previous request failed, to notify the user of the failure reason.
67 PinRequestErrorType? errorType;
68
69 // The number of attempts left. This is provided so that any UI can present
70 // this information to the user. Chrome is not expected to enforce this,
71 // instead stopPinRequest should be called by the extension with
72 // errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is
73 // exceeded.
74 long? attemptsLeft;
75 };
76
77 dictionary StopPinRequestDetails {
78 // The ID given by Chrome in SignRequest.
79 long signRequestId;
80
81 // The error template. If present it is displayed to user. Intended to
82 // contain the reason for stopping the flow if it was caused by an error,
83 // e.g. MAX_ATTEMPTS_EXCEEDED.
84 PinRequestErrorType? errorType;
85 };
86
87 dictionary PinResponseDetails {
88 // The code provided by the user. Empty if user closed the dialog or some
89 // other error occurred.
90 DOMString? userInput;
91 };
92
93 callback RequestPinCallback = void (optional PinResponseDetails details);
94
95 callback StopPinRequestCallback = void ();
96
39 // The callback provided by the extension that Chrome uses to report back 97 // The callback provided by the extension that Chrome uses to report back
40 // rejected certificates. See <code>CertificatesCallback</code>. 98 // rejected certificates. See <code>CertificatesCallback</code>.
41 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); 99 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates);
42 100
43 // If no error occurred, this function must be called with the signature of 101 // If no error occurred, this function must be called with the signature of
44 // the digest using the private key of the requested certificate. 102 // 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 103 // 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 104 // 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 105 // 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. 106 // 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 127 // certificate provided by this extension in reply to an
70 // $(ref:onCertificatesRequested) event. 128 // $(ref:onCertificatesRequested) event.
71 // The extension must sign the data in <code>request</code> using the 129 // The extension must sign the data in <code>request</code> using the
72 // appropriate algorithm and private key and return it by calling 130 // appropriate algorithm and private key and return it by calling
73 // <code>reportCallback</code>. <code>reportCallback</code> must be called 131 // <code>reportCallback</code>. <code>reportCallback</code> must be called
74 // exactly once. 132 // exactly once.
75 // |request|: Contains the details about the sign request. 133 // |request|: Contains the details about the sign request.
76 static void onSignDigestRequested(SignRequest request, 134 static void onSignDigestRequested(SignRequest request,
77 SignCallback reportCallback); 135 SignCallback reportCallback);
78 }; 136 };
137
138 interface Functions {
139 // Requests the PIN from the user. Only one ongoing request at a time is
140 // allowed. The requests issued while another flow is ongoing are rejected.
141 // It's the extension's responsibility to try again later if another flow is
142 // in progress.
143 // |details|: Contains the details about the requested dialog.
144 // |callback|: Is called when the dialog is resolved with the user input, or
145 // when the dialog request finishes unsuccessfully (e.g. the dialog was
146 // canceled by the user or was not allowed to be shown).
147 static void requestPin(RequestPinDetails details,
148 RequestPinCallback callback);
149
150 // Stops the pin request started by the $(ref:requestPin) function.
151 // |details|: Contains the details about the reason for stopping the
152 // request flow.
153 // |callback|: To be used by Chrome to send to the extension the status from
154 // their request to close PIN dialog for user.
155 static void stopPinRequest(StopPinRequestDetails details,
156 StopPinRequestCallback callback);
157 };
79 }; 158 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698