Implemented SOAP message generation.
This commit is contained in:
+37
-6
@@ -5,7 +5,6 @@
|
||||
|
||||
EetSigner::EetSigner(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QByteArray EetSigner::signData(const QByteArray &data)
|
||||
@@ -15,15 +14,12 @@ QByteArray EetSigner::signData(const QByteArray &data)
|
||||
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())
|
||||
if (m_result != QCA::ConvertGood || m_bundle.isNull())
|
||||
{
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QCA::PrivateKey privKey = bundle.privateKey();
|
||||
QCA::PrivateKey privKey = m_bundle.privateKey();
|
||||
|
||||
return privKey.signMessage(QCA::MemoryRegion(data), QCA::EMSA3_SHA256);
|
||||
}
|
||||
@@ -37,3 +33,38 @@ QByteArray EetSigner::sha1HashData(const QByteArray &data)
|
||||
|
||||
return QCA::Hash("sha1").hash(QCA::MemoryRegion(data)).toByteArray();
|
||||
}
|
||||
|
||||
QByteArray EetSigner::sha256HashData(const QByteArray &data)
|
||||
{
|
||||
if (!QCA::isSupported("sha256"))
|
||||
{
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
return QCA::Hash("sha256").hash(QCA::MemoryRegion(data)).toByteArray();
|
||||
}
|
||||
|
||||
QString EetSigner::getCertificate()
|
||||
{
|
||||
if (!QCA::isSupported("cert"))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (m_result != QCA::ConvertGood || m_bundle.isNull())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!m_bundle.certificateChain().isEmpty())
|
||||
{
|
||||
return m_bundle.certificateChain().primary().toPEM();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void EetSigner::setup(const QString &certPath, const QCA::SecureArray &certPasswd)
|
||||
{
|
||||
m_bundle = QCA::KeyBundle::fromFile(certPath, certPasswd, &m_result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user