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

Unified Diff: Source/modules/crypto/Key.cpp

Issue 179353002: [webcrypto] Add the KeyAlgorithm interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase yet again (another conflict) Created 6 years, 10 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 | « Source/modules/crypto/Key.h ('k') | Source/modules/crypto/Key.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/Key.cpp
diff --git a/Source/modules/crypto/Key.cpp b/Source/modules/crypto/Key.cpp
index c6a693f9cae0d6c025eb1c2f2ab723c90589c4dd..664410c37c5e1a4f4d44789c69632ce62a5c0859 100644
--- a/Source/modules/crypto/Key.cpp
+++ b/Source/modules/crypto/Key.cpp
@@ -33,7 +33,7 @@
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
-#include "modules/crypto/Algorithm.h"
+#include "modules/crypto/KeyAlgorithm.h"
#include "platform/CryptoResult.h"
#include "public/platform/WebCryptoAlgorithmParams.h"
#include "public/platform/WebString.h"
@@ -120,19 +120,6 @@ blink::WebCryptoKeyUsageMask toKeyUsage(AlgorithmOperation operation)
return 0;
}
-bool getHmacHashId(const blink::WebCryptoAlgorithm& algorithm, blink::WebCryptoAlgorithmId& hashId)
-{
- if (algorithm.hmacParams()) {
- hashId = algorithm.hmacParams()->hash().id();
- return true;
- }
- if (algorithm.hmacKeyParams()) {
- hashId = algorithm.hmacKeyParams()->hash().id();
- return true;
- }
- return false;
-}
-
} // namespace
Key::~Key()
@@ -155,10 +142,10 @@ bool Key::extractable() const
return m_key.extractable();
}
-Algorithm* Key::algorithm()
+KeyAlgorithm* Key::algorithm()
{
if (!m_algorithm)
- m_algorithm = Algorithm::create(m_key.algorithm());
+ m_algorithm = KeyAlgorithm::create(m_key.algorithm());
return m_algorithm.get();
}
@@ -189,20 +176,6 @@ bool Key::canBeUsedForAlgorithm(const blink::WebCryptoAlgorithm& algorithm, Algo
return false;
}
- // Verify that the algorithm-specific parameters for the key conform to the
- // algorithm.
- // FIXME: This is incomplete and not future proof. Operational parameters
- // should be enumerated when defining new parameters.
-
- if (m_key.algorithm().id() == blink::WebCryptoAlgorithmIdHmac) {
- blink::WebCryptoAlgorithmId keyHash;
- blink::WebCryptoAlgorithmId algorithmHash;
- if (!getHmacHashId(m_key.algorithm(), keyHash) || !getHmacHashId(algorithm, algorithmHash) || keyHash != algorithmHash) {
- result->completeWithError("key.algorithm does not match that of operation (HMAC's hash differs)");
- return false;
- }
- }
-
return true;
}
« no previous file with comments | « Source/modules/crypto/Key.h ('k') | Source/modules/crypto/Key.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698