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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(propertyNames); ++i) | 184 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(propertyNames); ++i) |
185 copyStringProperty(propertyNames[i], dict, jsonObject.get()); | 185 copyStringProperty(propertyNames[i], dict, jsonObject.get()); |
186 | 186 |
187 String json = jsonObject->toJSONString(); | 187 String json = jsonObject->toJSONString(); |
188 jsonUtf8 = json.utf8(); | 188 jsonUtf8 = json.utf8(); |
189 return true; | 189 return true; |
190 } | 190 } |
191 | 191 |
192 SubtleCrypto::SubtleCrypto() | 192 SubtleCrypto::SubtleCrypto() |
193 { | 193 { |
194 ScriptWrappable::init(this); | |
195 } | 194 } |
196 | 195 |
197 ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const Dictionary&
rawAlgorithm, CryptoKey* key, const ArrayPiece& data) | 196 ScriptPromise SubtleCrypto::encrypt(ScriptState* scriptState, const Dictionary&
rawAlgorithm, CryptoKey* key, const ArrayPiece& data) |
198 { | 197 { |
199 return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperati
onEncrypt, ArrayPiece(), data); | 198 return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperati
onEncrypt, ArrayPiece(), data); |
200 } | 199 } |
201 | 200 |
202 ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const Dictionary&
rawAlgorithm, CryptoKey* key, const ArrayPiece& data) | 201 ScriptPromise SubtleCrypto::decrypt(ScriptState* scriptState, const Dictionary&
rawAlgorithm, CryptoKey* key, const ArrayPiece& data) |
203 { | 202 { |
204 return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperati
onDecrypt, ArrayPiece(), data); | 203 return startCryptoOperation(scriptState, rawAlgorithm, key, WebCryptoOperati
onDecrypt, ArrayPiece(), data); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return promise; | 391 return promise; |
393 | 392 |
394 if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, WebCryptoOperatio
nUnwrapKey, result.get())) | 393 if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, WebCryptoOperatio
nUnwrapKey, result.get())) |
395 return promise; | 394 return promise; |
396 | 395 |
397 Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(), wrapped
Key.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm,
extractable, keyUsages, result->result()); | 396 Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(), wrapped
Key.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm,
extractable, keyUsages, result->result()); |
398 return promise; | 397 return promise; |
399 } | 398 } |
400 | 399 |
401 } // namespace blink | 400 } // namespace blink |
OLD | NEW |