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 26 matching lines...) Expand all Loading... |
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 namespace WebCore { class CryptoResult; } | 41 namespace WebCore { class CryptoResult; } |
42 | 42 |
43 #if INSIDE_BLINK | 43 #if INSIDE_BLINK |
44 namespace WTF { template <typename T> class PassRefPtr; } | 44 namespace WTF { template <typename T> class PassRefPtr; } |
45 #endif | 45 #endif |
46 | 46 |
| 47 // FIXME: Remove once chromium side rolls. |
| 48 #define WEBCRYPTO_RESULT_ACCEPTS_JSON 1 |
| 49 |
47 namespace blink { | 50 namespace blink { |
48 | 51 |
49 class WebArrayBuffer; | 52 class WebArrayBuffer; |
50 class WebString; | 53 class WebString; |
51 | 54 |
52 enum WebCryptoErrorType { | 55 enum WebCryptoErrorType { |
53 WebCryptoErrorTypeType, | 56 WebCryptoErrorTypeType, |
54 WebCryptoErrorTypeNotSupported, | 57 WebCryptoErrorTypeNotSupported, |
55 WebCryptoErrorTypeSyntax, | 58 WebCryptoErrorTypeSyntax, |
56 WebCryptoErrorTypeInvalidState, | 59 WebCryptoErrorTypeInvalidState, |
(...skipping 26 matching lines...) Expand all Loading... |
83 // Error details are surfaced in an exception, and MUST NEVER reveal any | 86 // Error details are surfaced in an exception, and MUST NEVER reveal any |
84 // secret information such as bytes of the key or plain text. An | 87 // secret information such as bytes of the key or plain text. An |
85 // appropriate error would be something like: | 88 // appropriate error would be something like: |
86 // "iv must be 16 bytes long". | 89 // "iv must be 16 bytes long". |
87 BLINK_PLATFORM_EXPORT void completeWithError(WebCryptoErrorType, const WebSt
ring&); | 90 BLINK_PLATFORM_EXPORT void completeWithError(WebCryptoErrorType, const WebSt
ring&); |
88 | 91 |
89 // Note that WebArrayBuffer is NOT safe to create from another thread. | 92 // Note that WebArrayBuffer is NOT safe to create from another thread. |
90 BLINK_PLATFORM_EXPORT void completeWithBuffer(const WebArrayBuffer&); | 93 BLINK_PLATFORM_EXPORT void completeWithBuffer(const WebArrayBuffer&); |
91 // Makes a copy of the input data given as a pointer and byte length. | 94 // Makes a copy of the input data given as a pointer and byte length. |
92 BLINK_PLATFORM_EXPORT void completeWithBuffer(const void*, unsigned); | 95 BLINK_PLATFORM_EXPORT void completeWithBuffer(const void*, unsigned); |
| 96 BLINK_PLATFORM_EXPORT void completeWithJson(const char* utf8Data, unsigned l
ength); |
93 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool); | 97 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool); |
94 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&); | 98 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&); |
95 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey
, const WebCryptoKey& privateKey); | 99 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey
, const WebCryptoKey& privateKey); |
96 | 100 |
97 #if INSIDE_BLINK | 101 #if INSIDE_BLINK |
98 BLINK_PLATFORM_EXPORT explicit WebCryptoResult(const WTF::PassRefPtr<WebCore
::CryptoResult>&); | 102 BLINK_PLATFORM_EXPORT explicit WebCryptoResult(const WTF::PassRefPtr<WebCore
::CryptoResult>&); |
99 #endif | 103 #endif |
100 | 104 |
101 private: | 105 private: |
102 BLINK_PLATFORM_EXPORT void reset(); | 106 BLINK_PLATFORM_EXPORT void reset(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // Returns true on success. | 270 // Returns true on success. |
267 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } | 271 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } |
268 | 272 |
269 protected: | 273 protected: |
270 virtual ~WebCrypto() { } | 274 virtual ~WebCrypto() { } |
271 }; | 275 }; |
272 | 276 |
273 } // namespace blink | 277 } // namespace blink |
274 | 278 |
275 #endif | 279 #endif |
OLD | NEW |