Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / exported / WebCryptoKeyAlgorithm.cpp
index ae759d9..1648380 100644 (file)
@@ -80,12 +80,6 @@ WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(WebCryptoAlgorithmId has
     return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, adoptPtr(new WebCryptoHmacKeyAlgorithmParams(createHash(hash), keyLengthBits)));
 }
 
-WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsa(WebCryptoAlgorithmId id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize)
-{
-    // FIXME: Verify that id is an RSA algorithm without a hash
-    return WebCryptoKeyAlgorithm(id, adoptPtr(new WebCryptoRsaKeyAlgorithmParams(modulusLengthBits, publicExponent, publicExponentSize)));
-}
-
 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createRsaHashed(WebCryptoAlgorithmId id, unsigned modulusLengthBits, const unsigned char* publicExponent, unsigned publicExponentSize, WebCryptoAlgorithmId hash)
 {
     // FIXME: Verify that id is an RSA algorithm which expects a hash
@@ -129,20 +123,19 @@ WebCryptoHmacKeyAlgorithmParams* WebCryptoKeyAlgorithm::hmacParams() const
     return 0;
 }
 
-WebCryptoRsaKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaParams() const
+WebCryptoRsaHashedKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaHashedParams() const
 {
     ASSERT(!isNull());
-    if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsa || paramsType() == WebCryptoKeyAlgorithmParamsTypeRsaHashed)
-        return static_cast<WebCryptoRsaKeyAlgorithmParams*>(m_private->params.get());
+    if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsaHashed)
+        return static_cast<WebCryptoRsaHashedKeyAlgorithmParams*>(m_private->params.get());
     return 0;
 }
 
-WebCryptoRsaHashedKeyAlgorithmParams* WebCryptoKeyAlgorithm::rsaHashedParams() const
+void WebCryptoKeyAlgorithm::writeToDictionary(WebCryptoKeyAlgorithmDictionary* dict) const
 {
     ASSERT(!isNull());
-    if (paramsType() == WebCryptoKeyAlgorithmParamsTypeRsaHashed)
-        return static_cast<WebCryptoRsaHashedKeyAlgorithmParams*>(m_private->params.get());
-    return 0;
+    dict->setString("name", WebCryptoAlgorithm::lookupAlgorithmInfo(id())->name);
+    m_private->params.get()->writeToDictionary(dict);
 }
 
 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other)