Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: public/platform/WebCrypto.h

Issue 21016005: WebCrypto: Add more operations to the platform API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add notImplemented() Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Tools/DumpRenderTree/chromium/TestRunner/src/MockWebCrypto.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 39
40 class WebArrayBuffer; 40 class WebArrayBuffer;
41 class WebCryptoKeyOperation; 41 class WebCryptoKeyOperation;
42 class WebCryptoKeyOperationResult; 42 class WebCryptoKeyOperationResult;
43 class WebCryptoOperation; 43 class WebCryptoOperation;
44 class WebCryptoOperationResult; 44 class WebCryptoOperationResult;
45 45
46 class WebCrypto { 46 class WebCrypto {
47 public: 47 public:
48 // FIXME: Deprecated, delete once chromium side is updated. 48 // FIXME: Deprecated, delete once chromium side is updated.
49 virtual WebCryptoOperation* digest(const WebCryptoAlgorithm&) { return 0; } 49 virtual WebCryptoOperation* digest(const WebCryptoAlgorithm&) { WEBKIT_ASSER T_NOT_REACHED(); return 0; }
50 50
51 // The following methods begin an asynchronous multi-part cryptographic 51 // The following methods begin an asynchronous multi-part cryptographic
52 // operation. 52 // operation.
53 // 53 //
54 // Let the WebCryptoOperationResult& be called "result". 54 // Let the WebCryptoOperationResult& be called "result".
55 // 55 //
56 // Before returning, implementations can either: 56 // Before returning, implementations can either:
57 // 57 //
58 // * Synchronously fail initialization by calling: 58 // * Synchronously fail initialization by calling:
59 // result.initializationFailed(errorDetails) 59 // result.initializationFailed(errorDetails)
(...skipping 19 matching lines...) Expand all
79 // The cryptoOperation pointer MUST remain valid while it is "in progress". 79 // The cryptoOperation pointer MUST remain valid while it is "in progress".
80 // The cryptoOperation is said to be "in progress" from the time after 80 // The cryptoOperation is said to be "in progress" from the time after
81 // result->initializationSucceded() has been called, up until either: 81 // result->initializationSucceded() has been called, up until either:
82 // 82 //
83 // - Blink calls cryptoOperation->abort() 83 // - Blink calls cryptoOperation->abort()
84 // OR 84 // OR
85 // - Embedder calls result.completeWithXXX() 85 // - Embedder calls result.completeWithXXX()
86 // 86 //
87 // Once the cryptoOperation is no longer "in progress" the embedder is 87 // Once the cryptoOperation is no longer "in progress" the embedder is
88 // responsible for freeing the cryptoOperation. 88 // responsible for freeing the cryptoOperation.
89 virtual void digest(const WebCryptoAlgorithm&, WebCryptoOperationResult&) { } 89 virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); }
90 virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); }
91 virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryptoO perationResult&) { WEBKIT_ASSERT_NOT_REACHED(); }
92 virtual void digest(const WebCryptoAlgorithm&, WebCryptoOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); }
90 93
91 // The following methods begin an asynchronous single-part key operation. 94 // The following methods begin an asynchronous single-part key operation.
92 // 95 //
93 // Let the WebCryptoKeyOperationResult& be called "result". 96 // Let the WebCryptoKeyOperationResult& be called "result".
94 // 97 //
95 // Before returning, implementations can either: 98 // Before returning, implementations can either:
96 // 99 //
97 // (a) Synchronously fail initialization by calling: 100 // (a) Synchronously fail initialization by calling:
98 // result.initializationFailed(errorDetails) 101 // result.initializationFailed(errorDetails)
99 // (this results in throwing a Javascript exception) 102 // (this results in throwing a Javascript exception)
(...skipping 11 matching lines...) Expand all
111 // The keyOperation pointer MUST remain valid while it is "in progress". 114 // The keyOperation pointer MUST remain valid while it is "in progress".
112 // The keyOperation is said to be "in progress" from the time after 115 // The keyOperation is said to be "in progress" from the time after
113 // result->initializationSucceded() has been called, up until either: 116 // result->initializationSucceded() has been called, up until either:
114 // 117 //
115 // - Blink calls keyOperation->abort() 118 // - Blink calls keyOperation->abort()
116 // OR 119 // OR
117 // - Embedder calls result.completeWithXXX() 120 // - Embedder calls result.completeWithXXX()
118 // 121 //
119 // Once the keyOperation is no longer "in progress" the embedder is 122 // Once the keyOperation is no longer "in progress" the embedder is
120 // responsible for freeing the cryptoOperation. 123 // responsible for freeing the cryptoOperation.
121 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, siz e_t keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsageM ask, WebCryptoKeyOperationResult&) { } 124 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, siz e_t keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsageM ask, WebCryptoKeyOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); }
122 125
123 protected: 126 protected:
124 virtual ~WebCrypto() { } 127 virtual ~WebCrypto() { }
125 }; 128 };
126 129
127 class WebCryptoOperation { 130 class WebCryptoOperation {
128 public: 131 public:
129 // Feeds data (bytes, size) to the operation. 132 // Feeds data (bytes, size) to the operation.
130 // - |bytes| may be 0 if |size| is 0 133 // - |bytes| may be 0 if |size| is 0
131 // - |bytes| is valid only until process() returns 134 // - |bytes| is valid only until process() returns
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 WEBKIT_EXPORT void reset(); 248 WEBKIT_EXPORT void reset();
246 WEBKIT_EXPORT void assign(const WebCryptoKeyOperationResult&); 249 WEBKIT_EXPORT void assign(const WebCryptoKeyOperationResult&);
247 WEBKIT_EXPORT void assign(WebCryptoKeyOperationResultPrivate*); 250 WEBKIT_EXPORT void assign(WebCryptoKeyOperationResultPrivate*);
248 251
249 WebPrivatePtr<WebCryptoKeyOperationResultPrivate> m_impl; 252 WebPrivatePtr<WebCryptoKeyOperationResultPrivate> m_impl;
250 }; 253 };
251 254
252 } // namespace WebKit 255 } // namespace WebKit
253 256
254 #endif 257 #endif
OLDNEW
« no previous file with comments | « Tools/DumpRenderTree/chromium/TestRunner/src/MockWebCrypto.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698