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

Unified Diff: Source/platform/exported/WebCryptoAlgorithm.cpp

Issue 707743002: WebCrypto: Add ECDSA algorithm (Blink side). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 6 years, 1 month 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/SubtleCrypto.cpp ('k') | Source/platform/exported/WebCryptoKeyAlgorithm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/exported/WebCryptoAlgorithm.cpp
diff --git a/Source/platform/exported/WebCryptoAlgorithm.cpp b/Source/platform/exported/WebCryptoAlgorithm.cpp
index 5696dbb95219c1114270124463b03cb47d1672f3..11098147e6f6fd092c8bb37baf138d69da8755f6 100644
--- a/Source/platform/exported/WebCryptoAlgorithm.cpp
+++ b/Source/platform/exported/WebCryptoAlgorithm.cpp
@@ -211,6 +211,20 @@ const WebCryptoAlgorithmInfo algorithmIdToInfo[] = {
WebCryptoAlgorithmParamsTypeNone, // WrapKey
WebCryptoAlgorithmParamsTypeNone // UnwrapKey
}
+ }, { // Index 12
+ "ECDSA", {
+ WebCryptoAlgorithmInfo::Undefined, // Encrypt
+ WebCryptoAlgorithmInfo::Undefined, // Decrypt
+ WebCryptoAlgorithmParamsTypeEcdsaParams, // Sign
+ WebCryptoAlgorithmParamsTypeEcdsaParams, // Verify
+ WebCryptoAlgorithmInfo::Undefined, // Digest
+ WebCryptoAlgorithmParamsTypeEcKeyGenParams, // GenerateKey
+ WebCryptoAlgorithmParamsTypeEcKeyImportParams, // ImportKey
+ WebCryptoAlgorithmInfo::Undefined, // DeriveKey
+ WebCryptoAlgorithmInfo::Undefined, // DeriveBits
+ WebCryptoAlgorithmParamsTypeNone, // WrapKey
+ WebCryptoAlgorithmParamsTypeNone // UnwrapKey
+ }
},
};
@@ -229,7 +243,8 @@ COMPILE_ASSERT(WebCryptoAlgorithmIdRsaOaep == 8, RsaOaep_idDoesntMatch);
COMPILE_ASSERT(WebCryptoAlgorithmIdAesCtr == 9, AesCtr_idDoesntMatch);
COMPILE_ASSERT(WebCryptoAlgorithmIdAesKw == 10, AesKw_idDoesntMatch);
COMPILE_ASSERT(WebCryptoAlgorithmIdRsaPss == 11, RsaPss_idDoesntMatch);
-COMPILE_ASSERT(WebCryptoAlgorithmIdLast == 11, Last_idDoesntMatch);
+COMPILE_ASSERT(WebCryptoAlgorithmIdEcdsa == 12, Ecdsa_idDoesntMatch);
+COMPILE_ASSERT(WebCryptoAlgorithmIdLast == 12, Last_idDoesntMatch);
COMPILE_ASSERT(10 == WebCryptoOperationLast, UpdateParamsMapping);
} // namespace
@@ -367,6 +382,30 @@ const WebCryptoRsaPssParams* WebCryptoAlgorithm::rsaPssParams() const
return 0;
}
+const WebCryptoEcdsaParams* WebCryptoAlgorithm::ecdsaParams() const
+{
+ ASSERT(!isNull());
+ if (paramsType() == WebCryptoAlgorithmParamsTypeEcdsaParams)
+ return static_cast<WebCryptoEcdsaParams*>(m_private->params.get());
+ return 0;
+}
+
+const WebCryptoEcKeyGenParams* WebCryptoAlgorithm::ecKeyGenParams() const
+{
+ ASSERT(!isNull());
+ if (paramsType() == WebCryptoAlgorithmParamsTypeEcKeyGenParams)
+ return static_cast<WebCryptoEcKeyGenParams*>(m_private->params.get());
+ return 0;
+}
+
+const WebCryptoEcKeyImportParams* WebCryptoAlgorithm::ecKeyImportParams() const
+{
+ ASSERT(!isNull());
+ if (paramsType() == WebCryptoAlgorithmParamsTypeEcKeyImportParams)
+ return static_cast<WebCryptoEcKeyImportParams*>(m_private->params.get());
+ return 0;
+}
+
bool WebCryptoAlgorithm::isHash(WebCryptoAlgorithmId id)
{
switch (id) {
@@ -383,6 +422,7 @@ bool WebCryptoAlgorithm::isHash(WebCryptoAlgorithmId id)
case WebCryptoAlgorithmIdAesCtr:
case WebCryptoAlgorithmIdAesKw:
case WebCryptoAlgorithmIdRsaPss:
+ case WebCryptoAlgorithmIdEcdsa:
break;
}
return false;
« no previous file with comments | « Source/modules/crypto/SubtleCrypto.cpp ('k') | Source/platform/exported/WebCryptoKeyAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698