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
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)