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

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

Issue 312393004: Expose WebCrypto's lookupAlgorithmInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@share_normalize
Patch Set: Created 6 years, 6 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/NormalizeAlgorithm.cpp ('k') | public/platform/WebCryptoAlgorithm.h » ('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 024b9701c8d97d5e7f2338340f7fe574d1b3ab60..6d4e82f07f64e5a5ed2213b4bafd9dd9318d1b31 100644
--- a/Source/platform/exported/WebCryptoAlgorithm.cpp
+++ b/Source/platform/exported/WebCryptoAlgorithm.cpp
@@ -35,6 +35,20 @@
#include "wtf/OwnPtr.h"
#include "wtf/ThreadSafeRefCounted.h"
+namespace {
+const char* kAlgorithmNameAesCbc = "AES-CBC";
+const char* kAlgorithmNameHmac = "HMAC";
+const char* kAlgorithmNameRsaSsaPkcs1v15 = "RSASSA-PKCS1-v1_5";
+const char* kAlgorithmNameSha1 = "SHA-1";
+const char* kAlgorithmNameSha256 = "SHA-256";
+const char* kAlgorithmNameSha384 = "SHA-384";
+const char* kAlgorithmNameSha512 = "SHA-512";
+const char* kAlgorithmNameAesGcm = "AES-GCM";
+const char* kAlgorithmNameRsaOaep = "RSA-OAEP";
+const char* kAlgorithmNameAesCtr = "AES-CTR";
+const char* kAlgorithmNameAesKw = "AES-KW";
abarth-chromium 2014/06/06 17:10:09 char* -> char[]
pneubeck (no reviews) 2014/06/10 12:33:02 Done.
+}
+
namespace blink {
class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithmPrivate> {
@@ -64,6 +78,36 @@ WebCryptoAlgorithm WebCryptoAlgorithm::adoptParamsAndCreate(WebCryptoAlgorithmId
return WebCryptoAlgorithm(id, adoptPtr(params));
}
+const char* WebCryptoAlgorithm::idToName(blink::WebCryptoAlgorithmId id)
+{
+ switch (id) {
+ case blink::WebCryptoAlgorithmIdAesCbc:
+ return kAlgorithmNameAesCbc;
+ case blink::WebCryptoAlgorithmIdHmac:
+ return kAlgorithmNameHmac;
+ case blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5:
+ return kAlgorithmNameRsaSsaPkcs1v15;
+ case blink::WebCryptoAlgorithmIdSha1:
+ return kAlgorithmNameSha1;
+ case blink::WebCryptoAlgorithmIdSha256:
+ return kAlgorithmNameSha256;
+ case blink::WebCryptoAlgorithmIdSha384:
+ return kAlgorithmNameSha384;
+ case blink::WebCryptoAlgorithmIdSha512:
+ return kAlgorithmNameSha512;
+ case blink::WebCryptoAlgorithmIdAesGcm:
+ return kAlgorithmNameAesGcm;
+ case blink::WebCryptoAlgorithmIdRsaOaep:
+ return kAlgorithmNameRsaOaep;
+ case blink::WebCryptoAlgorithmIdAesCtr:
+ return kAlgorithmNameAesCtr;
+ case blink::WebCryptoAlgorithmIdAesKw:
+ return kAlgorithmNameAesKw;
+ }
abarth-chromium 2014/06/06 17:10:08 Can we use a static array instead of a switch stat
pneubeck (no reviews) 2014/06/06 18:08:32 I did this so that the compiler can potentially ch
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
bool WebCryptoAlgorithm::isNull() const
{
return m_private.isNull();
« no previous file with comments | « Source/modules/crypto/NormalizeAlgorithm.cpp ('k') | public/platform/WebCryptoAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698