Implemented PKP and BKP code generation. Certificate path temporary hardcoded.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#include "eetsigner.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
EetSigner::EetSigner(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QByteArray EetSigner::signData(const QByteArray &data)
|
||||
{
|
||||
if (!QCA::isSupported("sha256"))
|
||||
{
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QCA::ConvertResult result;
|
||||
QCA::KeyBundle bundle = QCA::KeyBundle::fromFile("/home/pepa/Dokumenty/dev/eet/01000003.p12", QCA::SecureArray("eet"), &result);
|
||||
|
||||
if (result != QCA::ConvertGood || bundle.isNull())
|
||||
{
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QCA::PrivateKey privKey = bundle.privateKey();
|
||||
|
||||
return privKey.signMessage(QCA::MemoryRegion(data), QCA::EMSA3_SHA256);
|
||||
}
|
||||
|
||||
QByteArray EetSigner::sha1HashData(const QByteArray &data)
|
||||
{
|
||||
if (!QCA::isSupported("sha1"))
|
||||
{
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
return QCA::Hash("sha1").hash(QCA::MemoryRegion(data)).toByteArray();
|
||||
}
|
||||
Reference in New Issue
Block a user