Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (157935 => 157936)
--- trunk/Source/WebCore/CMakeLists.txt 2013-10-24 16:38:46 UTC (rev 157935)
+++ trunk/Source/WebCore/CMakeLists.txt 2013-10-24 17:05:36 UTC (rev 157936)
@@ -283,6 +283,7 @@
Modules/websockets/CloseEvent.idl
Modules/websockets/WebSocket.idl
+ crypto/CryptoKey.idl
crypto/SubtleCrypto.idl
css/CSSCharsetRule.idl
Modified: trunk/Source/WebCore/ChangeLog (157935 => 157936)
--- trunk/Source/WebCore/ChangeLog 2013-10-24 16:38:46 UTC (rev 157935)
+++ trunk/Source/WebCore/ChangeLog 2013-10-24 17:05:36 UTC (rev 157936)
@@ -1,3 +1,40 @@
+2013-10-23 Alexey Proskuryakov <[email protected]>
+
+ Add CryptoKey base class and bindings
+ https://bugs.webkit.org/show_bug.cgi?id=123216
+
+ Reviewed by Sam Weinig.
+
+ * crypto/CryptoKey.idl: Added.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * GNUmakefile.list.am:
+ Process the IDL.
+
+ * WebCore.xcodeproj/project.pbxproj: Added files.
+
+ * bindings/js/JSCryptoKeyCustom.cpp: Added.
+ (WebCore::JSCryptoKey::algorithm): Use a visitor to build algorithm dictionary
+ for the key.
+
+ * crypto/CryptoAlgorithmDescriptionBuilder.cpp: Added.
+ * crypto/CryptoAlgorithmDescriptionBuilder.h: Added.
+ An interface for a visitor we'll use to expose CrytoKey.algorithm in bindings,
+ and possibly also for storage serialization. Not complete yet, we'll need support
+ for a few more simple types, and less trivially, for nested algorithms.
+
+ * bindings/js/JSCryptoAlgorithmBuilder.cpp: Added.
+ * bindings/js/JSCryptoAlgorithmBuilder.h: Added.
+ An implementation that builds an algorithm description dictionary for JS bindings.
+
+ * crypto/CryptoKey.cpp: Added.
+ (WebCore::CryptoKey::~CryptoKey):
+ (WebCore::CryptoKey::buildAlgorithmDescription):
+ * crypto/CryptoKey.h: Added.
+ Added an almost empty implementation. Some of the functions that are currently
+ marked as pure virtual will likely be implemented in this base class.
+
2013-10-24 Commit Queue <[email protected]>
Unreviewed, rolling out r157916.
Modified: trunk/Source/WebCore/DerivedSources.make (157935 => 157936)
--- trunk/Source/WebCore/DerivedSources.make 2013-10-24 16:38:46 UTC (rev 157935)
+++ trunk/Source/WebCore/DerivedSources.make 2013-10-24 17:05:36 UTC (rev 157936)
@@ -198,6 +198,7 @@
$(WebCore)/Modules/webdatabase/WorkerGlobalScopeWebDatabase.idl \
$(WebCore)/Modules/websockets/CloseEvent.idl \
$(WebCore)/Modules/websockets/WebSocket.idl \
+ $(WebCore)/crypto/CryptoKey.idl \
$(WebCore)/crypto/SubtleCrypto.idl \
$(WebCore)/css/CSSCharsetRule.idl \
$(WebCore)/css/CSSFontFaceLoadEvent.idl \
Modified: trunk/Source/WebCore/GNUmakefile.list.am (157935 => 157936)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-10-24 16:38:46 UTC (rev 157935)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-10-24 17:05:36 UTC (rev 157936)
@@ -1298,6 +1298,7 @@
$(WebCore)/Modules/webdatabase/WorkerGlobalScopeWebDatabase.idl \
$(WebCore)/Modules/websockets/CloseEvent.idl \
$(WebCore)/Modules/websockets/WebSocket.idl \
+ $(WebCore)/crypto/CryptoKey.idl \
$(WebCore)/crypto/SubtleCrypto.idl \
$(WebCore)/css/CSSCharsetRule.idl \
$(WebCore)/css/CSSFontFaceLoadEvent.idl \
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (157935 => 157936)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-10-24 16:38:46 UTC (rev 157935)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-10-24 17:05:36 UTC (rev 157936)
@@ -5524,6 +5524,15 @@
E1513D511677F08800149FCB /* NotImplemented.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1513D501677F08800149FCB /* NotImplemented.cpp */; };
E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */; };
E152551616FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E152551416FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm */; };
+ E157A8E01817331C009F821D /* JSCryptoKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8DE1817331C009F821D /* JSCryptoKey.cpp */; };
+ E157A8E11817331C009F821D /* JSCryptoKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8DF1817331C009F821D /* JSCryptoKey.h */; };
+ E157A8E418173A3A009F821D /* CryptoKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8E218173A3A009F821D /* CryptoKey.cpp */; };
+ E157A8E518173A3A009F821D /* CryptoKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8E318173A3A009F821D /* CryptoKey.h */; };
+ E157A8E818184C67009F821D /* JSCryptoKeyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */; };
+ E157A8EC181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8EA181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp */; };
+ E157A8ED181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8EB181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h */; };
+ E157A8F018185425009F821D /* JSCryptoAlgorithmBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */; };
+ E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */; };
E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E15A36D61104572000B7B639 /* XMLNSNames.h */; };
E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15A36D81104572700B7B639 /* XMLNSNames.cpp */; };
E169803D1133542D00894115 /* CRuntimeObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E169803C1133542D00894115 /* CRuntimeObject.h */; };
@@ -12496,6 +12505,16 @@
E1513D501677F08800149FCB /* NotImplemented.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotImplemented.cpp; sourceTree = "<group>"; };
E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreResourceHandleAsOperationQueueDelegate.h; sourceTree = "<group>"; };
E152551416FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreResourceHandleAsOperationQueueDelegate.mm; sourceTree = "<group>"; };
+ E157A8DC18172C2C009F821D /* CryptoKey.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CryptoKey.idl; sourceTree = "<group>"; };
+ E157A8DE1817331C009F821D /* JSCryptoKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKey.cpp; sourceTree = "<group>"; };
+ E157A8DF1817331C009F821D /* JSCryptoKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoKey.h; sourceTree = "<group>"; };
+ E157A8E218173A3A009F821D /* CryptoKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKey.cpp; sourceTree = "<group>"; };
+ E157A8E318173A3A009F821D /* CryptoKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKey.h; sourceTree = "<group>"; };
+ E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyCustom.cpp; sourceTree = "<group>"; };
+ E157A8EA181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmDescriptionBuilder.cpp; sourceTree = "<group>"; };
+ E157A8EB181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmDescriptionBuilder.h; sourceTree = "<group>"; };
+ E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoAlgorithmBuilder.cpp; sourceTree = "<group>"; };
+ E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoAlgorithmBuilder.h; sourceTree = "<group>"; };
E15A36D61104572000B7B639 /* XMLNSNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLNSNames.h; sourceTree = "<group>"; };
E15A36D81104572700B7B639 /* XMLNSNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNSNames.cpp; sourceTree = "<group>"; };
E169803C1133542D00894115 /* CRuntimeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CRuntimeObject.h; sourceTree = "<group>"; };
@@ -19210,6 +19229,8 @@
C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */,
1C81BA030E97348300266E07 /* _javascript_CallFrame.cpp */,
1C81BA040E97348300266E07 /* _javascript_CallFrame.h */,
+ E157A8EE18185425009F821D /* JSCryptoAlgorithmBuilder.cpp */,
+ E157A8EF18185425009F821D /* JSCryptoAlgorithmBuilder.h */,
BCE438A1140C0DBF005E437E /* JSDictionary.cpp */,
BCE4389B140B1BA7005E437E /* JSDictionary.h */,
93B70D4709EB0C7C009D8468 /* JSDOMBinding.cpp */,
@@ -19342,6 +19363,7 @@
93BA59B10F2AA5FE008E8E99 /* JSCDATASectionCustom.cpp */,
BCA83E510D7CE205003421A8 /* JSClipboardCustom.cpp */,
209B456A16796A7E00E54E4E /* JSCryptoCustom.cpp */,
+ E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */,
BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */,
AD726FE916D9F40A003A4E6D /* JSCSSRuleCustom.h */,
9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */,
@@ -20155,6 +20177,11 @@
E1FF8F5B1807362B00132674 /* crypto */ = {
isa = PBXGroup;
children = (
+ E157A8EA181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp */,
+ E157A8EB181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h */,
+ E157A8DC18172C2C009F821D /* CryptoKey.idl */,
+ E157A8E218173A3A009F821D /* CryptoKey.cpp */,
+ E157A8E318173A3A009F821D /* CryptoKey.h */,
E1FF8F5C1807364B00132674 /* SubtleCrypto.idl */,
E1FF8F5D1807442100132674 /* SubtleCrypto.cpp */,
E1FF8F5E1807442100132674 /* SubtleCrypto.h */,
@@ -20165,6 +20192,8 @@
E1FF8F61180745C600132674 /* Crypto */ = {
isa = PBXGroup;
children = (
+ E157A8DE1817331C009F821D /* JSCryptoKey.cpp */,
+ E157A8DF1817331C009F821D /* JSCryptoKey.h */,
E1FF8F62180745D800132674 /* JSSubtleCrypto.cpp */,
E1FF8F63180745D800132674 /* JSSubtleCrypto.h */,
);
@@ -22197,6 +22226,7 @@
85E711C70AC5D5350053270F /* DOMHTMLStyleElementInternal.h in Headers */,
85DF821D0AA7849E00486AD7 /* DOMHTMLTableCaptionElement.h in Headers */,
85E711C80AC5D5350053270F /* DOMHTMLTableCaptionElementInternal.h in Headers */,
+ E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */,
85DF821F0AA7849E00486AD7 /* DOMHTMLTableCellElement.h in Headers */,
85E711C90AC5D5350053270F /* DOMHTMLTableCellElementInternal.h in Headers */,
85DF82210AA7849E00486AD7 /* DOMHTMLTableColElement.h in Headers */,
@@ -23354,6 +23384,7 @@
BCDFD4960E30592F009D10AD /* JSXMLHttpRequestUpload.h in Headers */,
1ACE53F70A8D19470022947D /* JSXMLSerializer.h in Headers */,
1A762C740A074F2600989F5B /* JSXPathEvaluator.h in Headers */,
+ E157A8ED181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h in Headers */,
BC60DB4A0D2A3D1E00B9918F /* JSXPathException.h in Headers */,
1A762C760A074F2600989F5B /* JSXPathExpression.h in Headers */,
1A762C780A074F2600989F5B /* JSXPathNSResolver.h in Headers */,
@@ -23532,7 +23563,9 @@
1A569D120D7E2B82007C3983 /* objc_class.h in Headers */,
1A569D140D7E2B82007C3983 /* objc_header.h in Headers */,
1A569D150D7E2B82007C3983 /* objc_instance.h in Headers */,
+ E157A8E518173A3A009F821D /* CryptoKey.h in Headers */,
1A569D170D7E2B82007C3983 /* objc_runtime.h in Headers */,
+ E157A8E11817331C009F821D /* JSCryptoKey.h in Headers */,
1A569D190D7E2B82007C3983 /* objc_utility.h in Headers */,
1CF6BDFA0E9BB26A0025E1CD /* ObjCEventListener.h in Headers */,
1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */,
@@ -25455,6 +25488,7 @@
85DF2F8F0AA3C88100AD64C5 /* DOMHTMLCollection.mm in Sources */,
078E090017D14CEE00420AA1 /* MediaStreamEvent.cpp in Sources */,
F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */,
+ E157A8E818184C67009F821D /* JSCryptoKeyCustom.cpp in Sources */,
0705852317FDC140005F2BCB /* MediaTrackConstraints.cpp in Sources */,
D359D792129CA3C00006E5D2 /* DOMHTMLDetailsElement.mm in Sources */,
85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */,
@@ -25800,6 +25834,7 @@
977B3866122883E900B81FF8 /* HTMLDocumentParser.cpp in Sources */,
93309DE7099E64920056E581 /* htmlediting.cpp in Sources */,
93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */,
+ E157A8F018185425009F821D /* JSCryptoAlgorithmBuilder.cpp in Sources */,
A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */,
977B37231228721700B81FF8 /* HTMLElementStack.cpp in Sources */,
A871D45F0A127CBC00B12A68 /* HTMLEmbedElement.cpp in Sources */,
@@ -26455,6 +26490,7 @@
B2FA3D920AB75A6F000E5AC4 /* JSSVGFETileElement.cpp in Sources */,
B2FA3D940AB75A6F000E5AC4 /* JSSVGFETurbulenceElement.cpp in Sources */,
B2FA3D960AB75A6F000E5AC4 /* JSSVGFilterElement.cpp in Sources */,
+ E157A8EC181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp in Sources */,
B27B28250CEF0C0700D39D54 /* JSSVGFontElement.cpp in Sources */,
A83B79040CCAFF15000B0825 /* JSSVGFontFaceElement.cpp in Sources */,
A83B79010CCAFF15000B0825 /* JSSVGFontFaceFormatElement.cpp in Sources */,
@@ -26902,6 +26938,7 @@
BCEA485D097D93020094C9E4 /* RenderArena.cpp in Sources */,
BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */,
BCEA4852097D93020094C9E4 /* RenderBlockLineLayout.cpp in Sources */,
+ E157A8E01817331C009F821D /* JSCryptoKey.cpp in Sources */,
BCEA4861097D93020094C9E4 /* RenderBox.cpp in Sources */,
BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */,
BCEA4863097D93020094C9E4 /* RenderLineBreak.cpp in Sources */,
@@ -26946,6 +26983,7 @@
439046DB12DA25E800AF80A2 /* RenderMathMLFraction.cpp in Sources */,
439046DD12DA25E800AF80A2 /* RenderMathMLMath.cpp in Sources */,
439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */,
+ E157A8E418173A3A009F821D /* CryptoKey.cpp in Sources */,
CD61FE631794AADB004101EB /* WebKitMediaSource.cpp in Sources */,
439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */,
439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
Added: trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.cpp (0 => 157936)
--- trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.cpp 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCryptoAlgorithmBuilder.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include <runtime/ObjectConstructor.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSCryptoAlgorithmBuilder::JSCryptoAlgorithmBuilder(ExecState* exec)
+ : m_exec(exec)
+ , m_dictionary(constructEmptyObject(exec))
+{
+}
+
+JSCryptoAlgorithmBuilder::~JSCryptoAlgorithmBuilder()
+{
+}
+
+void JSCryptoAlgorithmBuilder::add(const char* key, unsigned long value)
+{
+ Identifier identifier(m_exec, key);
+ m_dictionary->putDirect(m_exec->vm(), identifier, jsNumber(value));
+}
+
+void JSCryptoAlgorithmBuilder::add(const char* key, const String& value)
+{
+ Identifier identifier(m_exec, key);
+ m_dictionary->putDirect(m_exec->vm(), identifier, jsString(m_exec, value));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
Added: trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h (0 => 157936)
--- trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSCryptoAlgorithmBuilder_h
+#define JSCryptoAlgorithmBuilder_h
+
+#include "CryptoAlgorithmDescriptionBuilder.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace JSC {
+class ExecState;
+class JSObject;
+}
+
+namespace WebCore {
+
+class JSCryptoAlgorithmBuilder FINAL : public CryptoAlgorithmDescriptionBuilder {
+public:
+ JSCryptoAlgorithmBuilder(JSC::ExecState*);
+ virtual ~JSCryptoAlgorithmBuilder();
+
+ JSC::JSObject* result() { return m_dictionary; }
+
+ virtual void add(const char*, unsigned long) OVERRIDE;
+ virtual void add(const char*, const String&) OVERRIDE;
+
+private:
+ JSC::ExecState* m_exec;
+ JSC::JSObject* m_dictionary;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // JSCryptoAlgorithmBuilder_h
Added: trunk/Source/WebCore/bindings/js/JSCryptoKeyCustom.cpp (0 => 157936)
--- trunk/Source/WebCore/bindings/js/JSCryptoKeyCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSCryptoKeyCustom.cpp 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSCryptoKey.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "JSCryptoAlgorithmBuilder.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSCryptoKey::algorithm(JSC::ExecState* exec) const
+{
+ JSCryptoAlgorithmBuilder builder(exec);
+ impl().buildAlgorithmDescription(builder);
+ return builder.result();
+}
+
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
Added: trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.cpp (0 => 157936)
--- trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.cpp (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.cpp 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmDescriptionBuilder.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+CryptoAlgorithmDescriptionBuilder::CryptoAlgorithmDescriptionBuilder()
+{
+}
+
+CryptoAlgorithmDescriptionBuilder::~CryptoAlgorithmDescriptionBuilder()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
Added: trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.h (0 => 157936)
--- trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmDescriptionBuilder.h 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CryptoAlgorithmDescriptionBuilder_h
+#define CryptoAlgorithmDescriptionBuilder_h
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmDescriptionBuilder {
+ WTF_MAKE_NONCOPYABLE(CryptoAlgorithmDescriptionBuilder);
+public:
+ CryptoAlgorithmDescriptionBuilder();
+ virtual ~CryptoAlgorithmDescriptionBuilder();
+
+ virtual void add(const char*, unsigned long) = 0;
+ virtual void add(const char*, const String&) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoAlgorithmDescriptionBuilder_h
Added: trunk/Source/WebCore/crypto/CryptoKey.cpp (0 => 157936)
--- trunk/Source/WebCore/crypto/CryptoKey.cpp (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKey.cpp 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKey.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoAlgorithmDescriptionBuilder.h"
+
+namespace WebCore {
+
+CryptoKey::~CryptoKey()
+{
+}
+
+void CryptoKey::buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder& /*builder*/) const
+{
+ // Will do something like builder.add("name", m_algorithmName);
+ // Subclasses will add other keys.
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
Added: trunk/Source/WebCore/crypto/CryptoKey.h (0 => 157936)
--- trunk/Source/WebCore/crypto/CryptoKey.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKey.h 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CryptoKey_h
+#define CryptoKey_h
+
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmDescriptionBuilder;
+
+class CryptoKey : public RefCounted<CryptoKey> {
+public:
+ virtual ~CryptoKey();
+
+ virtual String type() const = 0;
+ virtual bool extractable() const = 0;
+ virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const;
+ virtual Vector<String> usage() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoKey_h
Added: trunk/Source/WebCore/crypto/CryptoKey.idl (0 => 157936)
--- trunk/Source/WebCore/crypto/CryptoKey.idl (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKey.idl 2013-10-24 17:05:36 UTC (rev 157936)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+enum KeyType {
+ "secret",
+ "public",
+ "private"
+};
+
+enum KeyUsage {
+ "encrypt",
+ "decrypt",
+ "sign",
+ "verify",
+ "deriveKey",
+ "deriveBits",
+ "wrapKey",
+ "unwrapKey"
+};
+
+[
+ Conditional=SUBTLE_CRYPTO,
+ InterfaceName=Key,
+ NoInterfaceObject,
+ OperationsNotDeletable
+] interface CryptoKey {
+ readonly attribute KeyType type;
+ readonly attribute boolean extractable;
+ [Custom] readonly attribute Algorithm algorithm;
+ readonly attribute KeyUsage[] usage;
+};