Diff
Modified: trunk/Source/WebCore/ChangeLog (158235 => 158236)
--- trunk/Source/WebCore/ChangeLog 2013-10-29 23:03:52 UTC (rev 158235)
+++ trunk/Source/WebCore/ChangeLog 2013-10-29 23:12:43 UTC (rev 158236)
@@ -1,3 +1,34 @@
+2013-10-29 Alexey Proskuryakov <[email protected]>
+
+ Beef up CryptoKey
+ https://bugs.webkit.org/show_bug.cgi?id=123462
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.xcodeproj/project.pbxproj: Added new files.
+
+ * crypto/CryptoAlgorithmIdentifier.h: Added an enum with all registered algorithms
+ (they don't have to be all implemented in any port).
+
+ * crypto/CryptoKey.cpp:
+ (WebCore::CryptoKey::CryptoKey): Initialize base class variables.
+ (WebCore::CryptoKey::type): Convert internal representation for bindings use.
+ (WebCore::CryptoKey::buildAlgorithmDescription): Ditto. This function is supposed
+ to be called by derived classes before adding other keyes.
+ (WebCore::CryptoKey::usages): Convert internal representation for bindings use.
+
+ * crypto/CryptoKey.h:
+ (WebCore::CryptoKey::extractable): Expose for bindings.
+ (WebCore::CryptoKey::allows): A faster way to check allowed key usage from C++ code.
+
+ * crypto/CryptoKey.idl: Added SkipVTableValidation, because validation doesn't work
+ with derived classes. Corrected "usages" attribute name.
+
+ * crypto/CryptoKeyFormat.h: Added.
+ * crypto/CryptoKeyType.h: Added.
+ * crypto/CryptoKeyUsage.h: Added.
+ Added enums used by CryptoKey.
+
2013-10-29 Hugo Parente Lima <[email protected]>
Adding Nix files in Source/Platform to trunk
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (158235 => 158236)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-10-29 23:03:52 UTC (rev 158235)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-10-29 23:12:43 UTC (rev 158236)
@@ -5558,6 +5558,8 @@
E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = E169825F1134636A00894115 /* ObjCRuntimeObject.mm */; };
E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E16A84F714C85CCC002977DF /* CSSBorderImage.cpp */; };
E16A84FA14C85CCC002977DF /* CSSBorderImage.h in Headers */ = {isa = PBXBuildFile; fileRef = E16A84F814C85CCC002977DF /* CSSBorderImage.h */; };
+ E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */; };
+ E172AF77180F366C00FBADB9 /* CryptoKeyFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = E172AF76180F366C00FBADB9 /* CryptoKeyFormat.h */; };
E17B491516A9B094001C8839 /* TransitionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E17B491316A9B093001C8839 /* TransitionEvent.cpp */; };
E17B491616A9B094001C8839 /* TransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491416A9B093001C8839 /* TransitionEvent.h */; };
E17B492116A9B8FF001C8839 /* JSTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */; };
@@ -5572,6 +5574,7 @@
E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */; };
E187056316E54A0D00585E97 /* MainThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = E187056216E54A0D00585E97 /* MainThreadTask.h */; };
E18772F1126E2629003DD586 /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18772F0126E2629003DD586 /* Language.cpp */; };
+ E19727161820549E00592D51 /* CryptoKeyType.h in Headers */ = {isa = PBXBuildFile; fileRef = E19727151820549E00592D51 /* CryptoKeyType.h */; };
E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */; };
E1A3162D134BC32D007C9A4F /* WebNSAttributedStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
E1A3162E134BC32D007C9A4F /* WebNSAttributedStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */; };
@@ -5619,6 +5622,7 @@
E1C416170F6563180092D2FB /* CrossOriginAccessControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C416160F6563180092D2FB /* CrossOriginAccessControl.cpp */; };
E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */; };
+ E1C657251816E69D00256CDD /* CryptoAlgorithmIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C657241816E69D00256CDD /* CryptoAlgorithmIdentifier.h */; };
E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */; };
E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; };
E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; };
@@ -12559,6 +12563,8 @@
E169825F1134636A00894115 /* ObjCRuntimeObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCRuntimeObject.mm; sourceTree = "<group>"; };
E16A84F714C85CCC002977DF /* CSSBorderImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSBorderImage.cpp; sourceTree = "<group>"; };
E16A84F814C85CCC002977DF /* CSSBorderImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSBorderImage.h; sourceTree = "<group>"; };
+ E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyUsage.h; sourceTree = "<group>"; };
+ E172AF76180F366C00FBADB9 /* CryptoKeyFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyFormat.h; sourceTree = "<group>"; };
E176580C180DF3A0005A96D1 /* OESElementIndexUint.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = OESElementIndexUint.idl; path = canvas/OESElementIndexUint.idl; sourceTree = "<group>"; };
E17B490B16A97269001C8839 /* TransitionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TransitionEvent.idl; sourceTree = "<group>"; };
E17B491316A9B093001C8839 /* TransitionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransitionEvent.cpp; sourceTree = "<group>"; };
@@ -12575,6 +12581,7 @@
E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerGlobalScopeCustom.cpp; sourceTree = "<group>"; };
E187056216E54A0D00585E97 /* MainThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThreadTask.h; sourceTree = "<group>"; };
E18772F0126E2629003DD586 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Language.cpp; sourceTree = "<group>"; };
+ E19727151820549E00592D51 /* CryptoKeyType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyType.h; sourceTree = "<group>"; };
E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerNodeAlgorithms.h; sourceTree = "<group>"; };
E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; };
E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSAttributedStringExtras.mm; sourceTree = "<group>"; };
@@ -12629,6 +12636,7 @@
E1C416160F6563180092D2FB /* CrossOriginAccessControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossOriginAccessControl.cpp; sourceTree = "<group>"; };
E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMObject.h; sourceTree = "<group>"; };
E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMObject.cpp; sourceTree = "<group>"; };
+ E1C657241816E69D00256CDD /* CryptoAlgorithmIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmIdentifier.h; sourceTree = "<group>"; };
E1C6CFC21746D293007B87A1 /* DOMWindowConstructors.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowConstructors.idl; sourceTree = "<group>"; };
E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorker.cpp; sourceTree = "<group>"; };
E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerCustom.cpp; sourceTree = "<group>"; };
@@ -20230,9 +20238,13 @@
children = (
E157A8EA181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.cpp */,
E157A8EB181851AC009F821D /* CryptoAlgorithmDescriptionBuilder.h */,
+ E1C657241816E69D00256CDD /* CryptoAlgorithmIdentifier.h */,
E157A8DC18172C2C009F821D /* CryptoKey.idl */,
E157A8E218173A3A009F821D /* CryptoKey.cpp */,
E157A8E318173A3A009F821D /* CryptoKey.h */,
+ E172AF76180F366C00FBADB9 /* CryptoKeyFormat.h */,
+ E19727151820549E00592D51 /* CryptoKeyType.h */,
+ E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */,
E1FF8F5C1807364B00132674 /* SubtleCrypto.idl */,
E1FF8F5D1807442100132674 /* SubtleCrypto.cpp */,
E1FF8F5E1807442100132674 /* SubtleCrypto.h */,
@@ -22600,6 +22612,7 @@
93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */,
658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */,
628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */,
+ E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */,
93309E0E099E64920056E581 /* FrameSelection.h in Headers */,
7CE30DAA171B63D200EC33E1 /* FrameSnapshottingMac.h in Headers */,
65A21485097A3F5300B9050A /* FrameTree.h in Headers */,
@@ -23003,6 +23016,7 @@
FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */,
A9D247FF0D757E6900FDF959 /* JSDOMPlugin.h in Headers */,
A9D248010D757E6900FDF959 /* JSDOMPluginArray.h in Headers */,
+ E19727161820549E00592D51 /* CryptoKeyType.h in Headers */,
BC5A86B60C3367E800EEA649 /* JSDOMSelection.h in Headers */,
4ACBC0CB12713D0A0094F9B2 /* JSDOMSettableTokenList.h in Headers */,
C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */,
@@ -23217,6 +23231,7 @@
1AE82FED0CAB07EE002237AE /* JSSQLResultSet.h in Headers */,
1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */,
B59DD6A511902A62007E9684 /* JSSQLStatementCallback.h in Headers */,
+ E172AF77180F366C00FBADB9 /* CryptoKeyFormat.h in Headers */,
B59DD6A911902A71007E9684 /* JSSQLStatementErrorCallback.h in Headers */,
BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */,
B59DD69D11902A42007E9684 /* JSSQLTransactionCallback.h in Headers */,
@@ -24605,6 +24620,7 @@
29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */,
AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */,
AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */,
+ E1C657251816E69D00256CDD /* CryptoAlgorithmIdentifier.h in Headers */,
93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
CDC69DDA16371FD4007C38DF /* WebCoreFullScreenPlaceholderView.h in Headers */,
CDC69DD61632026C007C38DF /* WebCoreFullScreenWarningView.h in Headers */,
Added: trunk/Source/WebCore/crypto/CryptoAlgorithmIdentifier.h (0 => 158236)
--- trunk/Source/WebCore/crypto/CryptoAlgorithmIdentifier.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmIdentifier.h 2013-10-29 23:12:43 UTC (rev 158236)
@@ -0,0 +1,60 @@
+/*
+ * 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 CryptoAlgorithmIdentifier_h
+#define CryptoAlgorithmIdentifier_h
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+ENUM_CLASS(CryptoAlgorithmIdentifier) {
+ RSAES_PKCS1_v1_5 = 1,
+ RSASSA_PKCS1_v1_5,
+ RSA_PSS,
+ RSA_OAEP,
+ ECDSA,
+ ECDH,
+ AES_CTR,
+ AES_CBC,
+ AES_CMAC,
+ AES_GCM,
+ AES_CFB,
+ HMAC,
+ DH,
+ SHA_1,
+ SHA_224,
+ SHA_256,
+ SHA_384,
+ SHA_512,
+ CONCAT,
+ HKDF_CTR,
+ PBKDF2
+};
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoAlgorithmIdentifier_h
Modified: trunk/Source/WebCore/crypto/CryptoKey.cpp (158235 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKey.cpp 2013-10-29 23:03:52 UTC (rev 158235)
+++ trunk/Source/WebCore/crypto/CryptoKey.cpp 2013-10-29 23:12:43 UTC (rev 158236)
@@ -29,19 +29,64 @@
#if ENABLE(SUBTLE_CRYPTO)
#include "CryptoAlgorithmDescriptionBuilder.h"
+#include "CryptoAlgorithmRegistry.h"
+#include <wtf/text/WTFString.h>
namespace WebCore {
+CryptoKey::CryptoKey(CryptoAlgorithmIdentifier algorithm, CryptoKeyType type, bool extractable, CryptoKeyUsage usages)
+ : m_algorithm(algorithm)
+ , m_type(type)
+ , m_extractable(extractable)
+ , m_usages(usages)
+{
+}
+
CryptoKey::~CryptoKey()
{
}
-void CryptoKey::buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder& /*builder*/) const
+String CryptoKey::type() const
{
- // Will do something like builder.add("name", m_algorithmName);
+ switch (m_type) {
+ case CryptoKeyType::Secret:
+ return ASCIILiteral("secret");
+ case CryptoKeyType::Public:
+ return ASCIILiteral("public");
+ case CryptoKeyType::Private:
+ return ASCIILiteral("private");
+ }
+}
+
+void CryptoKey::buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder& builder) const
+{
+ builder.add("name", CryptoAlgorithmRegistry::shared().nameForIdentifier(m_algorithm));
// Subclasses will add other keys.
}
+Vector<String> CryptoKey::usages() const
+{
+ Vector<String> result;
+ if (m_usages & CryptoKeyUsageEncrypt)
+ result.append(ASCIILiteral("encrypt"));
+ if (m_usages & CryptoKeyUsageDecrypt)
+ result.append(ASCIILiteral("decrypt"));
+ if (m_usages & CryptoKeyUsageSign)
+ result.append(ASCIILiteral("sign"));
+ if (m_usages & CryptoKeyUsageVerify)
+ result.append(ASCIILiteral("verify"));
+ if (m_usages & CryptoKeyUsageDeriveKey)
+ result.append(ASCIILiteral("deriveKey"));
+ if (m_usages & CryptoKeyUsageDeriveBits)
+ result.append(ASCIILiteral("deriveBits"));
+ if (m_usages & CryptoKeyUsageWrapKey)
+ result.append(ASCIILiteral("wrapKey"));
+ if (m_usages & CryptoKeyUsageUnwrapKey)
+ result.append(ASCIILiteral("unwrapKey"));
+
+ return result;
+}
+
} // namespace WebCore
#endif // ENABLE(SUBTLE_CRYPTO)
Modified: trunk/Source/WebCore/crypto/CryptoKey.h (158235 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKey.h 2013-10-29 23:03:52 UTC (rev 158235)
+++ trunk/Source/WebCore/crypto/CryptoKey.h 2013-10-29 23:12:43 UTC (rev 158236)
@@ -26,6 +26,9 @@
#ifndef CryptoKey_h
#define CryptoKey_h
+#include "CryptoAlgorithmIdentifier.h"
+#include "CryptoKeyType.h"
+#include "CryptoKeyUsage.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -36,14 +39,29 @@
class CryptoAlgorithmDescriptionBuilder;
+ENUM_CLASS(CryptoKeyType) {
+ Secret,
+ Public,
+ Private
+};
+
class CryptoKey : public RefCounted<CryptoKey> {
public:
+ CryptoKey(CryptoAlgorithmIdentifier, CryptoKeyType, bool extractable, CryptoKeyUsage);
virtual ~CryptoKey();
- virtual String type() const = 0;
- virtual bool extractable() const = 0;
+ String type() const;
+ bool extractable() const { return m_extractable; }
virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const;
- virtual Vector<String> usage() const = 0;
+ Vector<String> usages() const;
+
+ bool allows(CryptoKeyUsage usage) const { return usage == (m_usages & usage); }
+
+private:
+ CryptoAlgorithmIdentifier m_algorithm;
+ CryptoKeyType m_type;
+ bool m_extractable;
+ CryptoKeyUsage m_usages;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/crypto/CryptoKey.idl (158235 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKey.idl 2013-10-29 23:03:52 UTC (rev 158235)
+++ trunk/Source/WebCore/crypto/CryptoKey.idl 2013-10-29 23:12:43 UTC (rev 158236)
@@ -44,10 +44,11 @@
Conditional=SUBTLE_CRYPTO,
InterfaceName=Key,
NoInterfaceObject,
- OperationsNotDeletable
+ OperationsNotDeletable,
+ SkipVTableValidation
] interface CryptoKey {
readonly attribute KeyType type;
readonly attribute boolean extractable;
[Custom] readonly attribute Algorithm algorithm;
- readonly attribute KeyUsage[] usage;
+ readonly attribute KeyUsage[] usages;
};
Added: trunk/Source/WebCore/crypto/CryptoKeyFormat.h (0 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKeyFormat.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKeyFormat.h 2013-10-29 23:12:43 UTC (rev 158236)
@@ -0,0 +1,50 @@
+/*
+ * 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 CryptoKeyFormat_h
+#define CryptoKeyFormat_h
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+ENUM_CLASS(CryptoKeyFormat) {
+ // An unformatted sequence of bytes. Intended for secret keys.
+ Raw,
+
+ // The DER encoding of the PrivateKeyInfo structure from RFC 5208.
+ PKCS8,
+
+ // The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.
+ SPKI,
+
+ // The key is represented as JSON according to the JSON Web Key format.
+ JWK
+};
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoKeyFormat_h
Added: trunk/Source/WebCore/crypto/CryptoKeyType.h (0 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKeyType.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKeyType.h 2013-10-29 23:12:43 UTC (rev 158236)
@@ -0,0 +1,42 @@
+/*
+ * 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 CryptoKeyType_h
+#define CryptoKeyType_h
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+ENUM_CLASS(CryptoKeyType) {
+ Secret,
+ Public,
+ Private
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoKeyType_h
Added: trunk/Source/WebCore/crypto/CryptoKeyUsage.h (0 => 158236)
--- trunk/Source/WebCore/crypto/CryptoKeyUsage.h (rev 0)
+++ trunk/Source/WebCore/crypto/CryptoKeyUsage.h 2013-10-29 23:12:43 UTC (rev 158236)
@@ -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 CryptoKeyUsage_h
+#define CryptoKeyUsage_h
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+enum {
+ CryptoKeyUsageEncrypt = 1 << 0,
+ CryptoKeyUsageDecrypt = 1 << 1,
+ CryptoKeyUsageSign = 1 << 2,
+ CryptoKeyUsageVerify = 1 << 3,
+ CryptoKeyUsageDeriveKey = 1 << 4,
+ CryptoKeyUsageDeriveBits = 1 << 5,
+ CryptoKeyUsageWrapKey = 1 << 6,
+ CryptoKeyUsageUnwrapKey = 1 << 7
+};
+
+typedef int CryptoKeyUsage;
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoKeyUsage_h