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

Unified Diff: public/platform/WebCryptoKeyAlgorithmParams.h

Issue 340353006: [webcrypto] Replace KeyAlgorithm interfaces with an Object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove const reference and make v8value a value Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « public/platform/WebCryptoKeyAlgorithm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebCryptoKeyAlgorithmParams.h
diff --git a/public/platform/WebCryptoKeyAlgorithmParams.h b/public/platform/WebCryptoKeyAlgorithmParams.h
index d71c6f086f399affab35891ac797ae1117cbb52a..903d32c146a58b3d65bb7b09d1ec13487f2b7da9 100644
--- a/public/platform/WebCryptoKeyAlgorithmParams.h
+++ b/public/platform/WebCryptoKeyAlgorithmParams.h
@@ -37,6 +37,18 @@
namespace blink {
+// Interface used for serializing WebCryptoKeyAlgorithmParams to a javascript
+// dictionary.
+class WebCryptoKeyAlgorithmDictionary {
+public:
+ virtual ~WebCryptoKeyAlgorithmDictionary() { }
+
+ virtual void setString(const char*, const char*) = 0;
+ virtual void setUint(const char*, unsigned) = 0;
+ virtual void setAlgorithm(const char*, const WebCryptoAlgorithm&) = 0;
+ virtual void setUint8Array(const char*, const WebVector<unsigned char>&) = 0;
+};
+
enum WebCryptoKeyAlgorithmParamsType {
WebCryptoKeyAlgorithmParamsTypeNone,
WebCryptoKeyAlgorithmParamsTypeHmac,
@@ -51,6 +63,8 @@ public:
{
return WebCryptoKeyAlgorithmParamsTypeNone;
}
+
+ virtual void writeToDictionary(WebCryptoKeyAlgorithmDictionary*) const = 0;
};
class WebCryptoAesKeyAlgorithmParams : public WebCryptoKeyAlgorithmParams {
@@ -70,6 +84,11 @@ public:
return WebCryptoKeyAlgorithmParamsTypeAes;
}
+ virtual void writeToDictionary(WebCryptoKeyAlgorithmDictionary* dict) const
+ {
+ dict->setUint("length", m_lengthBits);
+ }
+
private:
unsigned short m_lengthBits;
};
@@ -97,6 +116,12 @@ public:
return WebCryptoKeyAlgorithmParamsTypeHmac;
}
+ virtual void writeToDictionary(WebCryptoKeyAlgorithmDictionary* dict) const
+ {
+ dict->setAlgorithm("hash", m_hash);
+ dict->setUint("length", m_lengthBits);
+ }
+
private:
WebCryptoAlgorithm m_hash;
unsigned m_lengthBits;
@@ -131,6 +156,13 @@ public:
return WebCryptoKeyAlgorithmParamsTypeRsaHashed;
}
+ virtual void writeToDictionary(WebCryptoKeyAlgorithmDictionary* dict) const
+ {
+ dict->setAlgorithm("hash", m_hash);
+ dict->setUint("modulusLength", m_modulusLengthBits);
+ dict->setUint8Array("publicExponent", m_publicExponent);
+ }
+
private:
unsigned m_modulusLengthBits;
WebVector<unsigned char> m_publicExponent;
« no previous file with comments | « public/platform/WebCryptoKeyAlgorithm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698