mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-18 23:17:59 +01:00
Remove QCA usage in JSResolver
This commit is contained in:
parent
34ff1d6687
commit
f0ea99fc71
@ -312,6 +312,11 @@ Tomahawk.asyncRequest = function (url, callback, extraHeaders, options) {
|
||||
};
|
||||
|
||||
Tomahawk.sha256 = Tomahawk.sha256 || CryptoJS.SHA256;
|
||||
Tomahawk.md5 = Tomahawk.md5 || CryptoJS.MD5;
|
||||
// Return a HMAC (md5) signature of the input text with the desired key
|
||||
Tomahawk.hmac = function (key, message) {
|
||||
return CryptoJS.HmacMD5(message, key);
|
||||
};
|
||||
|
||||
// some aliases
|
||||
Tomahawk.setTimeout = Tomahawk.setTimeout || window.setTimeout;
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "UrlHandler.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <QtCrypto>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMap>
|
||||
@ -416,39 +415,6 @@ JSResolverHelper::setResolverConfig( const QVariantMap& config )
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
JSResolverHelper::hmac( const QByteArray& key, const QByteArray &input )
|
||||
{
|
||||
#ifdef QCA2_FOUND
|
||||
if ( !QCA::isSupported( "hmac(md5)" ) )
|
||||
{
|
||||
tLog() << "HMAC(md5) not supported with qca-ossl plugin, or qca-ossl plugin is not installed! Unable to generate signature!";
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QCA::MessageAuthenticationCode md5hmac1( "hmac(md5)", QCA::SecureArray() );
|
||||
QCA::SymmetricKey keyObject( key );
|
||||
md5hmac1.setup( keyObject );
|
||||
|
||||
md5hmac1.update( QCA::SecureArray( input ) );
|
||||
QCA::SecureArray resultArray = md5hmac1.final();
|
||||
|
||||
QString result = QCA::arrayToHex( resultArray.toByteArray() );
|
||||
return result.toUtf8();
|
||||
#else
|
||||
tLog() << "Tomahawk compiled without QCA support, cannot generate HMAC signature";
|
||||
return QString();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
JSResolverHelper::md5( const QByteArray& input )
|
||||
{
|
||||
QByteArray const digest = QCryptographicHash::hash( input, QCryptographicHash::Md5 );
|
||||
return QString::fromLatin1( digest.toHex() );
|
||||
}
|
||||
|
||||
void
|
||||
JSResolverHelper::addCustomUrlHandler( const QString& protocol,
|
||||
const QString& callbackFuncName,
|
||||
|
@ -42,10 +42,6 @@ public:
|
||||
JSResolverHelper( const QString& scriptPath, JSResolver* parent );
|
||||
void setResolverConfig( const QVariantMap& config );
|
||||
|
||||
// Return a HMAC (md5) signature of the input text with the desired key
|
||||
Q_INVOKABLE QString hmac( const QByteArray& key, const QByteArray& input );
|
||||
Q_INVOKABLE QString md5( const QByteArray& input );
|
||||
|
||||
Q_INVOKABLE void addCustomUrlHandler( const QString& protocol, const QString& callbackFuncName, const QString& isAsynchronous = "false" );
|
||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl );
|
||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl, const QVariantMap& headers );
|
||||
|
Loading…
x
Reference in New Issue
Block a user