| 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef WebCrypto_h | 31 #ifndef WebCrypto_h |
| 32 #define WebCrypto_h | 32 #define WebCrypto_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebCryptoAlgorithm.h" | 35 #include "WebCryptoAlgorithm.h" |
| 36 #include "WebCryptoKey.h" | 36 #include "WebCryptoKey.h" |
| 37 #include "WebPrivatePtr.h" | 37 #include "WebPrivatePtr.h" |
| 38 #include "WebString.h" | 38 #include "WebString.h" |
| 39 #include "WebVector.h" | 39 #include "WebVector.h" |
| 40 | 40 |
| 41 #include <memory> |
| 42 |
| 41 #if INSIDE_BLINK | 43 #if INSIDE_BLINK |
| 42 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
| 43 #endif | 45 #endif |
| 44 | 46 |
| 45 namespace blink { | 47 namespace blink { |
| 46 | 48 |
| 47 class CryptoResult; | 49 class CryptoResult; |
| 48 class CryptoResultCancel; | 50 class CryptoResultCancel; |
| 49 class WebString; | 51 class WebString; |
| 50 | 52 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns
igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag
eMask, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTypeNotS
upported, ""); } | 209 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns
igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag
eMask, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTypeNotS
upported, ""); } |
| 208 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes
ult result) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); } | 210 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes
ult result) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); } |
| 209 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC
ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu
lt.completeWithError(WebCryptoErrorTypeNotSupported, ""); } | 211 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC
ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu
lt.completeWithError(WebCryptoErrorTypeNotSupported, ""); } |
| 210 virtual void unwrapKey(WebCryptoKeyFormat, const unsigned char* wrappedKey,
unsigned wrappedKeySize, const WebCryptoKey&, const WebCryptoAlgorithm& unwrapAl
gorithm, const WebCryptoAlgorithm& unwrappedKeyAlgorithm, bool extractable, WebC
ryptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(WebCryptoE
rrorTypeNotSupported, ""); } | 212 virtual void unwrapKey(WebCryptoKeyFormat, const unsigned char* wrappedKey,
unsigned wrappedKeySize, const WebCryptoKey&, const WebCryptoAlgorithm& unwrapAl
gorithm, const WebCryptoAlgorithm& unwrappedKeyAlgorithm, bool extractable, WebC
ryptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(WebCryptoE
rrorTypeNotSupported, ""); } |
| 211 virtual void deriveBits(const WebCryptoAlgorithm&, const WebCryptoKey&, unsi
gned length, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTy
peNotSupported, ""); } | 213 virtual void deriveBits(const WebCryptoAlgorithm&, const WebCryptoKey&, unsi
gned length, WebCryptoResult result) { result.completeWithError(WebCryptoErrorTy
peNotSupported, ""); } |
| 212 virtual void deriveKey(const WebCryptoAlgorithm& algorithm, const WebCryptoK
ey& baseKey, const WebCryptoAlgorithm& importAlgorithm, const WebCryptoAlgorithm
& keyLengthAlgorithm, bool extractable, WebCryptoKeyUsageMask, WebCryptoResult r
esult) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); } | 214 virtual void deriveKey(const WebCryptoAlgorithm& algorithm, const WebCryptoK
ey& baseKey, const WebCryptoAlgorithm& importAlgorithm, const WebCryptoAlgorithm
& keyLengthAlgorithm, bool extractable, WebCryptoKeyUsageMask, WebCryptoResult r
esult) { result.completeWithError(WebCryptoErrorTypeNotSupported, ""); } |
| 213 | 215 |
| 214 // This is the exception to the "Completing the request" guarantees | 216 // This is the exception to the "Completing the request" guarantees |
| 215 // outlined above. This is useful for Blink internal crypto and is not part | 217 // outlined above. This is useful for Blink internal crypto and is not part |
| 216 // of the WebCrypto standard. createDigestor must provide the result via | 218 // of the WebCrypto standard. createDigestor must provide the result via |
| 217 // the WebCryptoDigestor object synchronously. createDigestor may return 0 | 219 // the WebCryptoDigestor object synchronously. This will never return null. |
| 218 // if it fails to create a WebCryptoDigestor. If it succeeds, the | 220 virtual std::unique_ptr<WebCryptoDigestor> createDigestor(WebCryptoAlgorithm
Id algorithmId) { return nullptr; } |
| 219 // WebCryptoDigestor returned by createDigestor must be freed by the | |
| 220 // caller. | |
| 221 virtual WebCryptoDigestor* createDigestor(WebCryptoAlgorithmId algorithmId)
{ return nullptr; } | |
| 222 | 221 |
| 223 // ----------------------- | 222 // ----------------------- |
| 224 // Structured clone | 223 // Structured clone |
| 225 // ----------------------- | 224 // ----------------------- |
| 226 // | 225 // |
| 227 // deserializeKeyForClone() and serializeKeyForClone() are used for | 226 // deserializeKeyForClone() and serializeKeyForClone() are used for |
| 228 // implementing structured cloning of WebCryptoKey. | 227 // implementing structured cloning of WebCryptoKey. |
| 229 // | 228 // |
| 230 // Blink is responsible for saving and restoring all of the attributes of | 229 // Blink is responsible for saving and restoring all of the attributes of |
| 231 // WebCryptoKey EXCEPT for the actual key data: | 230 // WebCryptoKey EXCEPT for the actual key data: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Returns true on success. | 267 // Returns true on success. |
| 269 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } | 268 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } |
| 270 | 269 |
| 271 protected: | 270 protected: |
| 272 virtual ~WebCrypto() { } | 271 virtual ~WebCrypto() { } |
| 273 }; | 272 }; |
| 274 | 273 |
| 275 } // namespace blink | 274 } // namespace blink |
| 276 | 275 |
| 277 #endif // WebCrypto_h | 276 #endif // WebCrypto_h |
| OLD | NEW |