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 dictionary CertificateInfo { | 16 [noinline_doc] dictionary CertificateInfo { |
17 // Must be the DER encoding of a X.509 client certificate. Currently, only | 17 // Must be the DER encoding of a X.509 certificate. Currently, only |
18 // certificates of RSA keys are supported. | 18 // certificates of RSA keys are supported. |
19 ArrayBuffer certificate; | 19 ArrayBuffer certificate; |
20 | 20 |
21 // Must be set to all hashes supported for this certificate. This extension | 21 // 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 | 22 // will only be asked for signatures of digests calculated with one of these |
23 // hash algorithms. | 23 // hash algorithms. |
24 Hash[] supportedHashes; | 24 Hash[] supportedHashes; |
25 }; | 25 }; |
26 | 26 |
27 dictionary SignRequest { | 27 [noinline_doc] dictionary SignRequest { |
28 // The digest that must be signed. | 28 // The digest that must be signed. |
29 ArrayBuffer digest; | 29 ArrayBuffer digest; |
30 | 30 |
31 // Refers to the hash algorithm that was used to create |digest|. | 31 // Refers to the hash algorithm that was used to create <code>digest</code>. |
32 Hash hash; | 32 Hash hash; |
33 | 33 |
34 // The DER encoding of a X.509 client certificate. The extension must sign | 34 // The DER encoding of a X.509 certificate. The extension must sign |
35 // |digest| using the associated private key. | 35 // <code>digest</code> using the associated private key. |
36 ArrayBuffer certificate; | 36 ArrayBuffer certificate; |
37 }; | 37 }; |
38 | 38 |
39 // Either |error| or |signature| and not both must be set. | 39 // The callback provided by the extension that Chrome uses to report back |
40 dictionary SignatureDetails { | 40 // rejected certificates. See <code>CertificatesCallback</code>. |
41 // If the signature of the digest could not be calculated, this field must | 41 callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); |
42 // be set. | |
43 DOMString? error; | |
44 | 42 |
45 // If no error occurred, this field must be set to the signature of the | 43 // If no error occurred, this function must be called with the signature of |
46 // digest using the private the of the requested client certificate. | 44 // the digest using the private key of the requested certificate. |
47 // For an RSA key, the signature must be a PKCS#1 signature. The extension | 45 // For an RSA key, the signature must be a PKCS#1 signature. The extension |
48 // is responsible for prepending the DigestInfo prefix and adding PKCS#1 | 46 // is responsible for prepending the DigestInfo prefix and adding PKCS#1 |
49 // padding. If an MD5_SHA1 hash must be signed, the extension must not | 47 // padding. If an <code>MD5_SHA1</code> hash is to be signed, the extension |
50 // prepend a DigestInfo prefix but only add PKCS#1 padding. | 48 // must not prepend a DigestInfo prefix but only add PKCS#1 padding. |
51 ArrayBuffer? signature; | 49 // If an error occurred, this callback should be called without signature. |
52 }; | 50 callback SignCallback = void (optional ArrayBuffer signature); |
53 | 51 |
54 callback DoneCallback = void (); | 52 // Call this exactly once with the list of certificates that this extension is |
55 callback SignCallback = void(SignatureDetails reply, DoneCallback callback); | 53 // providing. The list must only contain certificates for which the extension |
56 | 54 // can sign data using the associated private key. If the list contains |
57 // Notifies Chrome that this extension is capable of responding to signing | 55 // invalid certificates, these will be ignored. All valid certificates are |
58 // requests for the certificates listed in |certificates|. The list must | 56 // still registered for the extension. Chrome will call back with the list of |
59 // only contain certificates for which the extension can sign data | 57 // rejected certificates, which might be empty. |
60 // using the associated private key. | |
61 callback CertificatesCallback = | 58 callback CertificatesCallback = |
62 void(CertificateInfo[] certificates, DoneCallback callback); | 59 void (CertificateInfo[] certificates, ResultCallback callback); |
63 | 60 |
64 interface Events { | 61 interface Events { |
65 // This event fires every time the browser requests the current list of | 62 // This event fires every time the browser requests the current list of |
66 // certificates provided by this extension. The extension must call | 63 // certificates provided by this extension. The extension must call |
67 // |callback| exactly once with the current list of certificates. | 64 // <code>reportCallback</code> exactly once with the current list of |
68 static void onClientCertificatesRequested(CertificatesCallback callback); | 65 // certificates. |
| 66 static void onCertificatesRequested(CertificatesCallback reportCallback); |
69 | 67 |
70 // This event fires every time the browser needs to sign a message using a | 68 // This event fires every time the browser needs to sign a message using a |
71 // certificate provided by this extension using |publishClientCertificates|. | 69 // certificate provided by this extension in reply to an |
72 // The extension must sign the data in |request| using the appropriate | 70 // $(ref:onCertificatesRequested) event. |
73 // algorithm and private key and return it by calling |callback|. |callback| | 71 // The extension must sign the data in <code>request</code> using the |
74 // must be called exactly once. | 72 // appropriate algorithm and private key and return it by calling |
| 73 // <code>reportCallback</code>. <code>reportCallback</code> must be called |
| 74 // exactly once. |
| 75 // |request|: Contains the details about the sign request. |
75 static void onSignDigestRequested(SignRequest request, | 76 static void onSignDigestRequested(SignRequest request, |
76 SignCallback callback); | 77 SignCallback reportCallback); |
77 }; | 78 }; |
78 }; | 79 }; |
OLD | NEW |