Commit ade4745a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for keyrecord parsing

parent 38e39e58
......@@ -61,6 +61,7 @@ if (DKIM_CHECKER_BUILD)
dkim-verify/dkimcheckauthenticationstatusjob.cpp
dkim-verify/dkimauthenticationstatusinfo.cpp
dkim-verify/dkimutil.cpp
dkim-verify/dkimkeyrecord.cpp
)
endif()
......
......@@ -15,3 +15,4 @@ add_messageviewer_dkim_verify_unittest(dkimdownloadkeyjobtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimchecksignaturejobtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimcheckauthenticationstatusjobtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimauthenticationstatusinfotest.cpp)
add_messageviewer_dkim_verify_unittest(dkimkeyrecordtest)
/*
Copyright (C) 2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "dkimkeyrecordtest.h"
#include "dkim-verify/dkimkeyrecord.h"
#include <QTest>
QTEST_GUILESS_MAIN(DKIMKeyRecordTest)
DKIMKeyRecordTest::DKIMKeyRecordTest(QObject *parent)
: QObject(parent)
{
}
/*
Copyright (C) 2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DKIMKEYRECORDTEST_H
#define DKIMKEYRECORDTEST_H
#include <QObject>
class DKIMKeyRecordTest : public QObject
{
Q_OBJECT
public:
explicit DKIMKeyRecordTest(QObject *parent = nullptr);
~DKIMKeyRecordTest() = default;
};
#endif // DKIMKEYRECORDTEST_H
......@@ -88,12 +88,26 @@ void DKIMCheckSignatureJob::downloadKey(const DKIMInfo &info)
DKIMDownloadKeyJob *job = new DKIMDownloadKeyJob(this);
job->setDomainName(info.domain());
job->setSelectorName(info.selector());
connect(job, &DKIMDownloadKeyJob::error, this, [this](){
deleteLater();
});
connect(job, &DKIMDownloadKeyJob::error, this, &DKIMCheckSignatureJob::slotDownloadKeyDone);
if (!job->start()) {
qCWarning(MESSAGEVIEWER_LOG) << "Impossible to start downloadkey";
deleteLater();
}
}
void DKIMCheckSignatureJob::slotDownloadKeyDone()
{
//TODO
}
void DKIMCheckSignatureJob::parseDKIMKeyRecord()
{
//TODO
}
MessageViewer::DKIMCheckSignatureJob::DKIMStatus DKIMCheckSignatureJob::checkSignature(const DKIMInfo &info)
{
const qint64 currentDate = QDateTime::currentSecsSinceEpoch();
......
......@@ -71,6 +71,8 @@ Q_SIGNALS:
private:
void downloadKey(const DKIMInfo &info);
void slotDownloadKeyDone();
void parseDKIMKeyRecord();
//TODO add message ?
QString mDkimValue;
QString mWarningFound;
......
/*
Copyright (C) 2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "dkimkeyrecord.h"
using namespace MessageViewer;
DKIMKeyRecord::DKIMKeyRecord()
{
}
bool DKIMKeyRecord::parseKey(const QString &key)
{
//TODO
return false;
}
/*
Copyright (C) 2019 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DKIMKEYRECORD_H
#define DKIMKEYRECORD_H
#include "messageviewer_export.h"
#include <QString>
#include <QStringList>
#include <QObject>
namespace MessageViewer {
class MESSAGEVIEWER_EXPORT DKIMKeyRecord
{
public:
DKIMKeyRecord();
Q_REQUIRED_RESULT bool parseKey(const QString &key);
};
}
#endif // DKIMKEYRECORD_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment