| 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 // Internal API for to implement the platformKeys and enterprise.platformKeys | 5 // Internal API for to implement the platformKeys and enterprise.platformKeys |
| 6 // APIs. | 6 // APIs. |
| 7 [ implemented_in = "chrome/browser/extensions/api/platform_keys/platform_keys_ap
i.h" ] | 7 [ implemented_in = "chrome/browser/extensions/api/platform_keys/platform_keys_ap
i.h" ] |
| 8 namespace platformKeysInternal { | 8 namespace platformKeysInternal { |
| 9 callback SelectCallback = void (platformKeys.Match[] certs); | 9 callback SelectCallback = void (platformKeys.Match[] certs); |
| 10 | 10 |
| 11 // Invoked by <code>sign</code>. | 11 // Invoked by <code>sign</code>. |
| 12 // |signature| The signature, a octet string. | 12 // |signature| The signature, a octet string. |
| 13 callback SignCallback = void(ArrayBuffer signature); | 13 callback SignCallback = void(ArrayBuffer signature); |
| 14 | 14 |
| 15 // Called back by <code>getPublicKey</code>. |
| 16 // |publicKey| The Subject Public Key Info (see X.509) of the requested |
| 17 // certificate. |
| 18 // |algorithm| A partial WebCrypto KeyAlgorithm containing all information |
| 19 // that is available from the Subject Public Key Info. It does not contain |
| 20 // signature/hash parameters. |
| 21 callback GetPublicKeyCallback = void(ArrayBuffer publicKey, object algorithm); |
| 22 |
| 15 interface Functions { | 23 interface Functions { |
| 16 // See documentation in platformKeys. | 24 // See documentation in platformKeys. |
| 17 static void selectClientCertificates( | 25 static void selectClientCertificates( |
| 18 platformKeys.SelectDetails details, | 26 platformKeys.SelectDetails details, |
| 19 SelectCallback callback); | 27 SelectCallback callback); |
| 20 | 28 |
| 21 // Internal version of platformKeys.subtleCrypto.sign and | 29 // Internal version of platformKeys.subtleCrypto.sign and |
| 22 // enterprise.platformKeys.Token.subtleCrypto.sign. | 30 // enterprise.platformKeys.Token.subtleCrypto.sign. |
| 23 // |tokenId| The id of a Token returned by |getTokens|. | 31 // |tokenId| The id of a Token returned by |getTokens|. |
| 24 // |publicKey| The Subject Public Key Info of a key previously generated by | 32 // |publicKey| The Subject Public Key Info of a key previously generated by |
| 25 // |generateKey| in DER encoding. | 33 // |generateKey| in DER encoding. |
| 26 // |hashAlgorithmName| The recognized algorithm name as specified by | 34 // |hashAlgorithmName| The recognized algorithm name of the hash algorithm, |
| 27 // WebCrypto of the hash algorithm that will be used to digest |data| | 35 // as specified by WebCrypto, that will be used to digest |data| |
| 28 // before signing. Currently supported are: SHA-{1,256,384,512}. | 36 // before signing. Currently supported are: SHA-{1,256,384,512}. |
| 37 // If instead the algorithm name "none" is provided, no hashing will be |
| 38 // applied, the data is PKCS#1 v1.5 padded but not hashed. |
| 29 // TODO(pneubeck): use an enum once supported: | 39 // TODO(pneubeck): use an enum once supported: |
| 30 // http://www.crbug.com/385539 . | 40 // http://www.crbug.com/385539 . |
| 31 // |data| The data to sign. | 41 // |data| The data to sign. |
| 32 // |callback| Called back with the signature of |data|. | 42 // |callback| Called back with the signature of |data|. |
| 33 // TODO: Instead of ArrayBuffer should be (ArrayBuffer or ArrayBufferView), | 43 // TODO: Instead of ArrayBuffer should be (ArrayBuffer or ArrayBufferView), |
| 34 // or at least (ArrayBuffer or Uint8Array). | 44 // or at least (ArrayBuffer or Uint8Array). |
| 35 static void sign(DOMString tokenId, | 45 static void sign(DOMString tokenId, |
| 36 ArrayBuffer publicKey, | 46 ArrayBuffer publicKey, |
| 37 DOMString hashAlgorithmName, | 47 DOMString hashAlgorithmName, |
| 38 ArrayBuffer data, | 48 ArrayBuffer data, |
| 39 SignCallback callback); | 49 SignCallback callback); |
| 50 |
| 51 // Calls back <code>callback</code> with details about the key certified by |
| 52 // <code>certificate</code>. |
| 53 static void getPublicKey(ArrayBuffer certificate, |
| 54 GetPublicKeyCallback callback); |
| 40 }; | 55 }; |
| 41 }; | 56 }; |
| OLD | NEW |