2014-05-15 14:20:00 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* http://www.w3.org/TR/WebCryptoAPI/
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef DOMString KeyType;
|
|
|
|
typedef DOMString KeyUsage;
|
2014-09-27 22:22:57 +04:00
|
|
|
typedef DOMString NamedCurve;
|
2014-05-15 14:20:00 +04:00
|
|
|
typedef Uint8Array BigInteger;
|
|
|
|
|
|
|
|
/***** Algorithm dictionaries *****/
|
|
|
|
|
|
|
|
dictionary Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required DOMString name;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary AesCbcParams : Algorithm {
|
2016-01-26 18:47:41 +03:00
|
|
|
required BufferSource iv;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary AesCtrParams : Algorithm {
|
2016-01-26 18:47:41 +03:00
|
|
|
required BufferSource counter;
|
2014-09-27 22:22:57 +04:00
|
|
|
[EnforceRange] required octet length;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary AesGcmParams : Algorithm {
|
2016-01-26 18:47:41 +03:00
|
|
|
required BufferSource iv;
|
|
|
|
BufferSource additionalData;
|
2014-05-15 14:20:00 +04:00
|
|
|
[EnforceRange] octet tagLength;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary HmacImportParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required AlgorithmIdentifier hash;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
2014-07-12 22:06:00 +04:00
|
|
|
dictionary Pbkdf2Params : Algorithm {
|
2016-01-26 18:47:41 +03:00
|
|
|
required BufferSource salt;
|
2014-09-27 22:22:57 +04:00
|
|
|
[EnforceRange] required unsigned long iterations;
|
|
|
|
required AlgorithmIdentifier hash;
|
2014-07-12 22:06:00 +04:00
|
|
|
};
|
|
|
|
|
2014-05-15 14:20:00 +04:00
|
|
|
dictionary RsaHashedImportParams {
|
2014-09-27 22:22:57 +04:00
|
|
|
required AlgorithmIdentifier hash;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary AesKeyGenParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
[EnforceRange] required unsigned short length;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary HmacKeyGenParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required AlgorithmIdentifier hash;
|
2014-05-15 14:20:00 +04:00
|
|
|
[EnforceRange] unsigned long length;
|
|
|
|
};
|
|
|
|
|
2014-09-27 22:22:57 +04:00
|
|
|
dictionary RsaHashedKeyGenParams : Algorithm {
|
|
|
|
[EnforceRange] required unsigned long modulusLength;
|
|
|
|
required BigInteger publicExponent;
|
|
|
|
required AlgorithmIdentifier hash;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
2014-07-15 05:33:12 +04:00
|
|
|
dictionary RsaOaepParams : Algorithm {
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource label;
|
2014-07-15 05:33:12 +04:00
|
|
|
};
|
|
|
|
|
2015-10-13 21:22:43 +03:00
|
|
|
dictionary RsaPssParams : Algorithm {
|
|
|
|
[EnforceRange] required unsigned long saltLength;
|
|
|
|
};
|
|
|
|
|
2014-05-15 14:20:00 +04:00
|
|
|
dictionary DhKeyGenParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required BigInteger prime;
|
|
|
|
required BigInteger generator;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary EcKeyGenParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required NamedCurve namedCurve;
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|
2014-08-07 14:52:28 +04:00
|
|
|
dictionary AesDerivedKeyParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
[EnforceRange] required unsigned long length;
|
2014-08-07 14:52:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary HmacDerivedKeyParams : HmacImportParams {
|
|
|
|
[EnforceRange] unsigned long length;
|
|
|
|
};
|
|
|
|
|
2014-07-29 13:11:26 +04:00
|
|
|
dictionary EcdhKeyDeriveParams : Algorithm {
|
2014-09-27 22:22:57 +04:00
|
|
|
required CryptoKey public;
|
2014-07-29 13:11:26 +04:00
|
|
|
};
|
|
|
|
|
2014-08-21 19:51:51 +04:00
|
|
|
dictionary DhKeyDeriveParams : Algorithm {
|
|
|
|
required CryptoKey public;
|
|
|
|
};
|
|
|
|
|
2014-08-22 14:02:14 +04:00
|
|
|
dictionary DhImportKeyParams : Algorithm {
|
|
|
|
required BigInteger prime;
|
|
|
|
required BigInteger generator;
|
|
|
|
};
|
|
|
|
|
2014-10-14 01:19:00 +04:00
|
|
|
dictionary EcdsaParams : Algorithm {
|
|
|
|
required AlgorithmIdentifier hash;
|
|
|
|
};
|
2014-07-19 17:25:00 +04:00
|
|
|
|
2015-04-28 10:13:16 +03:00
|
|
|
dictionary EcKeyImportParams : Algorithm {
|
|
|
|
NamedCurve namedCurve;
|
|
|
|
};
|
|
|
|
|
2016-01-26 16:57:52 +03:00
|
|
|
dictionary HkdfParams : Algorithm {
|
|
|
|
required AlgorithmIdentifier hash;
|
2016-01-26 18:47:41 +03:00
|
|
|
required BufferSource salt;
|
|
|
|
required BufferSource info;
|
2016-01-26 16:57:52 +03:00
|
|
|
};
|
|
|
|
|
2014-07-19 17:25:00 +04:00
|
|
|
/***** JWK *****/
|
|
|
|
|
|
|
|
dictionary RsaOtherPrimesInfo {
|
|
|
|
// The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
|
2014-09-27 22:22:57 +04:00
|
|
|
required DOMString r;
|
|
|
|
required DOMString d;
|
|
|
|
required DOMString t;
|
2014-07-19 17:25:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary JsonWebKey {
|
|
|
|
// The following fields are defined in Section 3.1 of JSON Web Key
|
2014-09-27 22:22:57 +04:00
|
|
|
required DOMString kty;
|
2014-07-19 17:25:00 +04:00
|
|
|
DOMString use;
|
|
|
|
sequence<DOMString> key_ops;
|
|
|
|
DOMString alg;
|
|
|
|
|
|
|
|
// The following fields are defined in JSON Web Key Parameters Registration
|
|
|
|
boolean ext;
|
|
|
|
|
|
|
|
// The following fields are defined in Section 6 of JSON Web Algorithms
|
|
|
|
DOMString crv;
|
|
|
|
DOMString x;
|
|
|
|
DOMString y;
|
|
|
|
DOMString d;
|
|
|
|
DOMString n;
|
|
|
|
DOMString e;
|
|
|
|
DOMString p;
|
|
|
|
DOMString q;
|
|
|
|
DOMString dp;
|
|
|
|
DOMString dq;
|
|
|
|
DOMString qi;
|
|
|
|
sequence<RsaOtherPrimesInfo> oth;
|
|
|
|
DOMString k;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-05-15 14:20:00 +04:00
|
|
|
/***** The Main API *****/
|
|
|
|
|
2014-06-24 01:25:13 +04:00
|
|
|
interface CryptoKey {
|
2014-05-15 14:20:00 +04:00
|
|
|
readonly attribute KeyType type;
|
|
|
|
readonly attribute boolean extractable;
|
2014-09-27 22:22:57 +04:00
|
|
|
[Cached, Constant, Throws] readonly attribute object algorithm;
|
2014-05-15 14:20:00 +04:00
|
|
|
[Cached, Constant, Frozen] readonly attribute sequence<KeyUsage> usages;
|
|
|
|
};
|
|
|
|
|
2014-09-27 22:22:57 +04:00
|
|
|
dictionary CryptoKeyPair {
|
|
|
|
required CryptoKey publicKey;
|
|
|
|
required CryptoKey privateKey;
|
2014-05-26 14:05:00 +04:00
|
|
|
};
|
|
|
|
|
2014-05-15 14:20:00 +04:00
|
|
|
typedef DOMString KeyFormat;
|
|
|
|
typedef (object or DOMString) AlgorithmIdentifier;
|
|
|
|
|
2015-09-21 20:29:41 +03:00
|
|
|
[Exposed=(Window,Worker)]
|
2014-05-15 14:20:00 +04:00
|
|
|
interface SubtleCrypto {
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> encrypt(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey key,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource data);
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> decrypt(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey key,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource data);
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> sign(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey key,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource data);
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> verify(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey key,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource signature,
|
|
|
|
BufferSource data);
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> digest(AlgorithmIdentifier algorithm,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource data);
|
2014-05-15 14:20:00 +04:00
|
|
|
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> generateKey(AlgorithmIdentifier algorithm,
|
|
|
|
boolean extractable,
|
|
|
|
sequence<KeyUsage> keyUsages );
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> deriveKey(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey baseKey,
|
|
|
|
AlgorithmIdentifier derivedKeyType,
|
|
|
|
boolean extractable,
|
|
|
|
sequence<KeyUsage> keyUsages );
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> deriveBits(AlgorithmIdentifier algorithm,
|
|
|
|
CryptoKey baseKey,
|
|
|
|
unsigned long length);
|
2014-05-15 14:20:00 +04:00
|
|
|
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> importKey(KeyFormat format,
|
|
|
|
object keyData,
|
|
|
|
AlgorithmIdentifier algorithm,
|
|
|
|
boolean extractable,
|
|
|
|
sequence<KeyUsage> keyUsages );
|
2014-07-19 05:31:11 +04:00
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> exportKey(KeyFormat format, CryptoKey key);
|
2014-07-19 17:24:00 +04:00
|
|
|
|
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> wrapKey(KeyFormat format,
|
|
|
|
CryptoKey key,
|
|
|
|
CryptoKey wrappingKey,
|
|
|
|
AlgorithmIdentifier wrapAlgorithm);
|
2014-07-19 17:24:00 +04:00
|
|
|
|
|
|
|
[Throws]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<any> unwrapKey(KeyFormat format,
|
2016-01-26 18:47:41 +03:00
|
|
|
BufferSource wrappedKey,
|
2014-08-01 07:50:30 +04:00
|
|
|
CryptoKey unwrappingKey,
|
|
|
|
AlgorithmIdentifier unwrapAlgorithm,
|
|
|
|
AlgorithmIdentifier unwrappedKeyAlgorithm,
|
|
|
|
boolean extractable,
|
|
|
|
sequence<KeyUsage> keyUsages );
|
2014-05-15 14:20:00 +04:00
|
|
|
};
|
|
|
|
|