[SVG Masking] Enable the use of <mask> elements for -webkit-mask-image
[WebKit-https.git] / Source / WebCore / crypto / CryptoKey.h
index 4facd78..7df9e1a 100644 (file)
 #ifndef CryptoKey_h
 #define CryptoKey_h
 
+#if ENABLE(SUBTLE_CRYPTO)
+
 #include "CryptoAlgorithmIdentifier.h"
 #include "CryptoKeyType.h"
 #include "CryptoKeyUsage.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
+#include <wtf/TypeCasts.h>
 #include <wtf/Vector.h>
 
-#if ENABLE(SUBTLE_CRYPTO)
-
 namespace WebCore {
 
 class CryptoAlgorithmDescriptionBuilder;
 class CryptoKeyData;
 
-ENUM_CLASS(CryptoKeyClass) {
+enum class CryptoKeyClass {
     HMAC,
     AES,
     RSA
@@ -58,11 +59,13 @@ public:
     virtual void buildAlgorithmDescription(CryptoAlgorithmDescriptionBuilder&) const;
     Vector<String> usages() const;
 
+    CryptoAlgorithmIdentifier algorithmIdentifier() const { return m_algorithm; }
+    CryptoKeyUsage usagesBitmap() const { return m_usages; }
     bool allows(CryptoKeyUsage usage) const { return usage == (m_usages & usage); }
 
     virtual std::unique_ptr<CryptoKeyData> exportData() const = 0;
 
-    static Vector<char> randomData(size_t);
+    static Vector<uint8_t> randomData(size_t);
 
 private:
     CryptoAlgorithmIdentifier m_algorithm;
@@ -71,10 +74,12 @@ private:
     CryptoKeyUsage m_usages;
 };
 
-#define CRYPTO_KEY_TYPE_CASTS(ToClassName) \
-    TYPE_CASTS_BASE(ToClassName, CryptoKey, key, WebCore::is##ToClassName(*key), WebCore::is##ToClassName(key))
-
 } // namespace WebCore
 
+#define SPECIALIZE_TYPE_TRAITS_CRYPTO_KEY(ToClassName, KeyClass) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToClassName) \
+    static bool isType(const WebCore::CryptoKey& key) { return key.keyClass() == WebCore::KeyClass; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif // ENABLE(SUBTLE_CRYPTO)
 #endif // CryptoKey_h