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 24 matching lines...) Expand all Loading... |
35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
36 #include "modules/crypto/CryptoKey.h" | 36 #include "modules/crypto/CryptoKey.h" |
37 #include "modules/crypto/CryptoResultImpl.h" | 37 #include "modules/crypto/CryptoResultImpl.h" |
38 #include "modules/crypto/NormalizeAlgorithm.h" | 38 #include "modules/crypto/NormalizeAlgorithm.h" |
39 #include "platform/JSONValues.h" | 39 #include "platform/JSONValues.h" |
40 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
41 #include "public/platform/WebCrypto.h" | 41 #include "public/platform/WebCrypto.h" |
42 #include "public/platform/WebCryptoAlgorithm.h" | 42 #include "public/platform/WebCryptoAlgorithm.h" |
43 #include "wtf/ArrayBufferView.h" | 43 #include "wtf/ArrayBufferView.h" |
44 | 44 |
45 namespace WebCore { | 45 namespace blink { |
46 | 46 |
47 // Seems like the generated bindings should take care of these however it | 47 // Seems like the generated bindings should take care of these however it |
48 // currently doesn't. See also http://crbug.com/264520 | 48 // currently doesn't. See also http://crbug.com/264520 |
49 static bool ensureNotNull(const ArrayPiece& x, const char* paramName, CryptoResu
lt* result) | 49 static bool ensureNotNull(const ArrayPiece& x, const char* paramName, CryptoResu
lt* result) |
50 { | 50 { |
51 if (x.isNull()) { | 51 if (x.isNull()) { |
52 String message = String("Invalid ") + paramName + String(" argument"); | 52 String message = String("Invalid ") + paramName + String(" argument"); |
53 result->completeWithError(blink::WebCryptoErrorTypeType, blink::WebStrin
g(message)); | 53 result->completeWithError(blink::WebCryptoErrorTypeType, blink::WebStrin
g(message)); |
54 return false; | 54 return false; |
55 } | 55 } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, blink::WebCryptoOperationImpor
tKey, unwrappedKeyAlgorithm, result.get())) | 390 if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, blink::WebCryptoOperationImpor
tKey, unwrappedKeyAlgorithm, result.get())) |
391 return promise; | 391 return promise; |
392 | 392 |
393 if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, blink::WebCryptoO
perationUnwrapKey, result.get())) | 393 if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, blink::WebCryptoO
perationUnwrapKey, result.get())) |
394 return promise; | 394 return promise; |
395 | 395 |
396 blink::Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(),
wrappedKey.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgo
rithm, extractable, keyUsages, result->result()); | 396 blink::Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(),
wrappedKey.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgo
rithm, extractable, keyUsages, result->result()); |
397 return promise; | 397 return promise; |
398 } | 398 } |
399 | 399 |
400 } // namespace WebCore | 400 } // namespace blink |
OLD | NEW |