| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SubtleCrypto_h | 31 #ifndef SubtleCrypto_h |
| 32 #define SubtleCrypto_h | 32 #define SubtleCrypto_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" | 34 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" |
| 35 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
| 36 #include "bindings/core/v8/ScriptWrappable.h" | 36 #include "bindings/core/v8/ScriptWrappable.h" |
| 37 #include "bindings/modules/v8/ArrayBufferOrArrayBufferViewOrDictionary.h" | 37 #include "bindings/modules/v8/ArrayBufferOrArrayBufferViewOrDictionary.h" |
| 38 #include "bindings/modules/v8/DictionaryOrString.h" | 38 #include "bindings/modules/v8/DictionaryOrString.h" |
| 39 #include "core/dom/DOMArrayPiece.h" | |
| 40 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 41 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 42 | 41 |
| 43 namespace blink { | 42 namespace blink { |
| 44 | 43 |
| 45 class CryptoKey; | 44 class CryptoKey; |
| 46 | 45 |
| 47 typedef ArrayBufferOrArrayBufferView BufferSource; | 46 typedef ArrayBufferOrArrayBufferView BufferSource; |
| 48 typedef DictionaryOrString AlgorithmIdentifier; | 47 typedef DictionaryOrString AlgorithmIdentifier; |
| 49 | 48 |
| 50 class SubtleCrypto final : public GarbageCollected<SubtleCrypto>, public ScriptW
rappable { | 49 class SubtleCrypto final : public GarbageCollected<SubtleCrypto>, public ScriptW
rappable { |
| 51 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
| 52 public: | 51 public: |
| 53 static SubtleCrypto* create() | 52 static SubtleCrypto* create() |
| 54 { | 53 { |
| 55 return new SubtleCrypto(); | 54 return new SubtleCrypto(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 ScriptPromise encrypt(ScriptState*, const AlgorithmIdentifier&, CryptoKey*,
const DOMArrayPiece&); | 57 ScriptPromise encrypt(ScriptState*, const AlgorithmIdentifier&, CryptoKey*,
const BufferSource&); |
| 59 ScriptPromise decrypt(ScriptState*, const AlgorithmIdentifier&, CryptoKey*,
const DOMArrayPiece&); | 58 ScriptPromise decrypt(ScriptState*, const AlgorithmIdentifier&, CryptoKey*,
const BufferSource&); |
| 60 ScriptPromise sign(ScriptState*, const AlgorithmIdentifier&, CryptoKey*, con
st DOMArrayPiece&); | 59 ScriptPromise sign(ScriptState*, const AlgorithmIdentifier&, CryptoKey*, con
st BufferSource&); |
| 61 // Note that this is not named "verify" because when compiling on Mac that e
xpands to a macro and breaks. | 60 // Note that this is not named "verify" because when compiling on Mac that e
xpands to a macro and breaks. |
| 62 ScriptPromise verifySignature(ScriptState*, const AlgorithmIdentifier&, Cryp
toKey*, const DOMArrayPiece& signature, const DOMArrayPiece& data); | 61 ScriptPromise verifySignature(ScriptState*, const AlgorithmIdentifier&, Cryp
toKey*, const BufferSource& signature, const BufferSource& data); |
| 63 ScriptPromise digest(ScriptState*, const AlgorithmIdentifier&, const DOMArra
yPiece& data); | 62 ScriptPromise digest(ScriptState*, const AlgorithmIdentifier&, const BufferS
ource& data); |
| 64 | 63 |
| 65 ScriptPromise generateKey(ScriptState*, const AlgorithmIdentifier&, bool ext
ractable, const Vector<String>& keyUsages); | 64 ScriptPromise generateKey(ScriptState*, const AlgorithmIdentifier&, bool ext
ractable, const Vector<String>& keyUsages); |
| 66 ScriptPromise importKey(ScriptState*, const String&, const ArrayBufferOrArra
yBufferViewOrDictionary&, const AlgorithmIdentifier&, bool extractable, const Ve
ctor<String>& keyUsages); | 65 ScriptPromise importKey(ScriptState*, const String&, const ArrayBufferOrArra
yBufferViewOrDictionary&, const AlgorithmIdentifier&, bool extractable, const Ve
ctor<String>& keyUsages); |
| 67 ScriptPromise exportKey(ScriptState*, const String&, CryptoKey*); | 66 ScriptPromise exportKey(ScriptState*, const String&, CryptoKey*); |
| 68 | 67 |
| 69 ScriptPromise wrapKey(ScriptState*, const String&, CryptoKey*, CryptoKey*, c
onst AlgorithmIdentifier&); | 68 ScriptPromise wrapKey(ScriptState*, const String&, CryptoKey*, CryptoKey*, c
onst AlgorithmIdentifier&); |
| 70 ScriptPromise unwrapKey(ScriptState*, const String&, const DOMArrayPiece&, C
ryptoKey*, const AlgorithmIdentifier&, const AlgorithmIdentifier&, bool, const V
ector<String>&); | 69 ScriptPromise unwrapKey(ScriptState*, const String&, const BufferSource&, Cr
yptoKey*, const AlgorithmIdentifier&, const AlgorithmIdentifier&, bool, const Ve
ctor<String>&); |
| 71 | 70 |
| 72 ScriptPromise deriveBits(ScriptState*, const AlgorithmIdentifier&, CryptoKey
*, unsigned); | 71 ScriptPromise deriveBits(ScriptState*, const AlgorithmIdentifier&, CryptoKey
*, unsigned); |
| 73 ScriptPromise deriveKey(ScriptState*, const AlgorithmIdentifier&, CryptoKey*
, const AlgorithmIdentifier&, bool extractable, const Vector<String>&); | 72 ScriptPromise deriveKey(ScriptState*, const AlgorithmIdentifier&, CryptoKey*
, const AlgorithmIdentifier&, bool extractable, const Vector<String>&); |
| 74 | 73 |
| 75 DEFINE_INLINE_TRACE() { } | 74 DEFINE_INLINE_TRACE() { } |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 SubtleCrypto(); | 77 SubtleCrypto(); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 } // namespace blink | 80 } // namespace blink |
| 82 | 81 |
| 83 #endif // SubtleCrypto_h | 82 #endif // SubtleCrypto_h |
| OLD | NEW |