use QCryptographicHash

This commit is contained in:
Aaron Seigo 2011-05-27 12:33:31 +02:00
parent b0c769c4c1
commit 791c327c87

View File

@ -17,10 +17,9 @@
*/
#include "credentials.h"
#include "authorizationmanager.h"
#include "config-plasma.h"
#include <QCryptographicHash>
#include <QObject>
#ifdef ENABLE_REMOTE_WIDGETS
@ -30,6 +29,8 @@
#include <kdebug.h>
#include <kstandarddirs.h>
#include "authorizationmanager.h"
#define REQUIRED_FEATURES "rsa,sha1,pkey"
namespace Plasma {
@ -112,7 +113,7 @@ Credentials Credentials::createCredentials(const QString &name)
QCA::KeyGenerator generator;
QCA::PrivateKey key = generator.createRSA(2048);
QString pemKey(key.toPublicKey().toPEM());
QString id = QCA::Hash("sha1").hashToString(pemKey.toAscii());
QString id = QCryptographicHash::hash(pemKey.toAscii(), QCryptographicHash::Sha1);
return Credentials(id, name, key.toPEM(), true);
#else
return Credentials();
@ -146,7 +147,7 @@ bool Credentials::isValid() const
if (d->publicKey.isNull()) {
return false;
} else {
QString id = QCA::Hash("sha1").hashToString(d->publicKey.toPEM().toAscii());
QString id = QCryptographicHash::hash(d->publicKey.toPEM().toAscii(), QCryptographicHash::Sha1);
return (id == d->id);
}
#else