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

Unified Diff: public/platform/WebCryptoAlgorithmParams.h

Issue 26426002: [webcrypto] Add parameters for AES-GCM and RSA-OAEP to blink API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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/WebCryptoAlgorithm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebCryptoAlgorithmParams.h
diff --git a/public/platform/WebCryptoAlgorithmParams.h b/public/platform/WebCryptoAlgorithmParams.h
index b321bec0bd16f502ab7877cf5da24316d8340dbc..ed3d54075b98c77a3410c91bd17ec65018e69646 100644
--- a/public/platform/WebCryptoAlgorithmParams.h
+++ b/public/platform/WebCryptoAlgorithmParams.h
@@ -160,6 +160,73 @@ private:
const WebVector<unsigned char> m_publicExponent;
};
+class WebCryptoAesGcmParams : public WebCryptoAlgorithmParams {
+public:
+ WebCryptoAesGcmParams(const unsigned char* iv, unsigned ivSize, bool hasAdditionalData, const unsigned char* additionalData, unsigned additionalDataSize, bool hasTagLength, unsigned char tagLength)
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesGcmParams)
+ , m_iv(iv, ivSize)
+ , m_hasAdditionalData(hasAdditionalData)
+ , m_additionalData(additionalData, additionalDataSize)
+ , m_hasTagLength(hasTagLength)
+ , m_tagLength(tagLength)
+ {
+ }
+
+ const WebVector<unsigned char>& iv() const { return m_iv; }
+
+ bool hasAdditionalData() const { return m_hasAdditionalData; }
+ bool getAdditionalData(const WebVector<unsigned char>*& additionalData)
+ {
+ if (!m_hasAdditionalData)
+ return false;
+ additionalData = &m_additionalData;
+ return true;
+ }
+
+ bool hasTagLength() const { return m_hasTagLength; }
+ bool getTagLength(unsigned& tagLength)
+ {
+ if (!m_hasTagLength)
+ return false;
+ tagLength = m_tagLength;
+ return true;
+ }
+
+private:
+ const WebVector<unsigned char> m_iv;
+ const bool m_hasAdditionalData;
+ const WebVector<unsigned char> m_additionalData;
+ const bool m_hasTagLength;
+ const unsigned char m_tagLength;
+};
+
+class WebCryptoRsaOaepParams : public WebCryptoAlgorithmParams {
+public:
+ WebCryptoRsaOaepParams(const WebCryptoAlgorithm& hash, bool hasLabel, const unsigned char* label, unsigned labelSize)
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeRsaOaepParams)
+ , m_hash(hash)
+ , m_hasLabel(hasLabel)
+ , m_label(label, labelSize)
+ {
+ }
+
+ const WebCryptoAlgorithm& hash() const { return m_hash; }
+
+ bool hasLabel() const { return m_hasLabel; }
+ bool getLabel(const WebVector<unsigned char>*& label)
+ {
+ if (!m_hasLabel)
+ return false;
+ label = &m_label;
+ return true;
+ }
+
+private:
+ const WebCryptoAlgorithm m_hash;
+ const bool m_hasLabel;
+ const WebVector<unsigned char> m_label;
+};
+
} // namespace WebKit
#endif
« no previous file with comments | « public/platform/WebCryptoAlgorithm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698