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

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

Issue 195543002: [webcrypto] Implement structured clone of keys (blink-side). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix another comment Created 6 years, 9 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
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebCryptoKey_h 31 #ifndef WebCryptoKey_h
32 #define WebCryptoKey_h 32 #define WebCryptoKey_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebPrivatePtr.h" 35 #include "WebPrivatePtr.h"
36 #include "WebVector.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 enum WebCryptoKeyType { 40 enum WebCryptoKeyType {
40 WebCryptoKeyTypeSecret, 41 WebCryptoKeyTypeSecret,
41 WebCryptoKeyTypePublic, 42 WebCryptoKeyTypePublic,
42 WebCryptoKeyTypePrivate, 43 WebCryptoKeyTypePrivate,
43 }; 44 };
44 45
45 enum WebCryptoKeyUsage { 46 enum WebCryptoKeyUsage {
46 WebCryptoKeyUsageEncrypt = 1 << 0, 47 WebCryptoKeyUsageEncrypt = 1 << 1,
jsbell 2014/03/13 20:16:07 Since this isn't directly serialized, there's no n
eroman 2014/03/14 18:28:09 Correct there is no direct need to bump it. I can
jsbell 2014/03/14 18:39:27 I have no preference. Maybe add a comment explaini
eroman 2014/03/14 19:32:51 I reverted the change, so no longer a need for the
47 WebCryptoKeyUsageDecrypt = 1 << 1, 48 WebCryptoKeyUsageDecrypt = 1 << 2,
48 WebCryptoKeyUsageSign = 1 << 2, 49 WebCryptoKeyUsageSign = 1 << 3,
49 WebCryptoKeyUsageVerify = 1 << 3, 50 WebCryptoKeyUsageVerify = 1 << 4,
50 WebCryptoKeyUsageDeriveKey = 1 << 4, 51 WebCryptoKeyUsageDeriveKey = 1 << 5,
51 WebCryptoKeyUsageWrapKey = 1 << 5, 52 WebCryptoKeyUsageWrapKey = 1 << 6,
52 WebCryptoKeyUsageUnwrapKey = 1 << 6, 53 WebCryptoKeyUsageUnwrapKey = 1 << 7,
53 #if INSIDE_BLINK 54 #if INSIDE_BLINK
54 EndOfWebCryptoKeyUsage, 55 EndOfWebCryptoKeyUsage,
55 #endif 56 #endif
56 }; 57 };
57 58
58 // A bitfield of WebCryptoKeyUsage 59 // A bitfield of WebCryptoKeyUsage
59 typedef int WebCryptoKeyUsageMask; 60 typedef int WebCryptoKeyUsageMask;
60 61
61 enum WebCryptoKeyFormat { 62 enum WebCryptoKeyFormat {
62 WebCryptoKeyFormatRaw, 63 WebCryptoKeyFormatRaw,
(...skipping 16 matching lines...) Expand all
79 // WebCryptoKey is: 80 // WebCryptoKey is:
80 // * Copiable (cheaply) 81 // * Copiable (cheaply)
81 // * Threadsafe if the embedder's WebCryptoKeyHandle is also threadsafe. 82 // * Threadsafe if the embedder's WebCryptoKeyHandle is also threadsafe.
82 // 83 //
83 // The embedder is responsible for creating all WebCryptoKeys, and therefore can 84 // The embedder is responsible for creating all WebCryptoKeys, and therefore can
84 // safely assume any details regarding the type of the wrapped 85 // safely assume any details regarding the type of the wrapped
85 // WebCryptoKeyHandle*. 86 // WebCryptoKeyHandle*.
86 // 87 //
87 // If WebCryptoKey "isNull()" then it is invalid to call any of the other 88 // If WebCryptoKey "isNull()" then it is invalid to call any of the other
88 // methods on it (other than destruction, assignment, or isNull()). 89 // methods on it (other than destruction, assignment, or isNull()).
89 //
90 // FIXME: Define the interface to use for structured clone.
91 // Cloning across a process boundary will need serialization,
92 // however cloning for in-process workers could just share the same
93 // (threadsafe) handle.
94 class WebCryptoKey { 90 class WebCryptoKey {
95 public: 91 public:
96 ~WebCryptoKey() { reset(); } 92 ~WebCryptoKey() { reset(); }
97 93
98 WebCryptoKey(const WebCryptoKey& other) { assign(other); } 94 WebCryptoKey(const WebCryptoKey& other) { assign(other); }
99 WebCryptoKey& operator=(const WebCryptoKey& other) 95 WebCryptoKey& operator=(const WebCryptoKey& other)
100 { 96 {
101 assign(other); 97 assign(other);
102 return *this; 98 return *this;
103 } 99 }
(...skipping 29 matching lines...) Expand all
133 // Base class for the embedder to define its own opaque key handle. The lifetime 129 // Base class for the embedder to define its own opaque key handle. The lifetime
134 // of this object is controlled by WebCryptoKey using reference counting. 130 // of this object is controlled by WebCryptoKey using reference counting.
135 class WebCryptoKeyHandle { 131 class WebCryptoKeyHandle {
136 public: 132 public:
137 virtual ~WebCryptoKeyHandle() { } 133 virtual ~WebCryptoKeyHandle() { }
138 }; 134 };
139 135
140 } // namespace blink 136 } // namespace blink
141 137
142 #endif 138 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698