Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
b823dc58
Commit
b823dc58
authored
Oct 26, 2021
by
Ingo Klöcker
Browse files
Add a self-test checking de-vs compliance of GnuPG
GnuPG-bug-id: 5362
parent
83dbedef
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
b823dc58
...
...
@@ -108,6 +108,7 @@ set(_kleopatra_SRCS
selftest/gpgconfcheck.cpp
selftest/gpgagentcheck.cpp
selftest/libkleopatrarccheck.cpp
selftest/compliancecheck.cpp
${
_kleopatra_extra_SRCS
}
...
...
src/commands/selftestcommand.cpp
View file @
b823dc58
...
...
@@ -27,6 +27,7 @@
#endif
#include <selftest/gpgagentcheck.h>
#include <selftest/libkleopatrarccheck.h>
#include <selftest/compliancecheck.h>
#include <Libkleo/Stl_Util>
...
...
@@ -133,6 +134,7 @@ private:
#ifndef Q_OS_WIN
tests
.
push_back
(
makeGpgAgentConnectivitySelfTest
());
#endif
tests
.
push_back
(
makeDeVSComplianceCheckSelfTest
());
tests
.
push_back
(
makeLibKleopatraRcSelfTest
());
if
(
!
dialog
&&
std
::
none_of
(
tests
.
cbegin
(),
tests
.
cend
(),
...
...
src/selftest/compliancecheck.cpp
0 → 100644
View file @
b823dc58
/* -*- mode: c++; c-basic-offset:4 -*-
selftest/compliancecheck.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kleopatra.h>
#include "compliancecheck.h"
#include "implementation_p.h"
#include <Libkleo/Formatting>
#include <Libkleo/GnuPG>
#include <KLocalizedString>
using
namespace
Kleo
;
using
namespace
Kleo
::
_detail
;
namespace
{
class
DeVsComplianceCheck
:
public
SelfTestImplementation
{
public:
explicit
DeVsComplianceCheck
()
:
SelfTestImplementation
(
i18nc
(
"@title %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1?"
,
Formatting
::
deVsString
()))
{
runTest
();
}
void
runTest
()
{
m_skipped
=
!
gnupgUsesDeVsCompliance
();
if
(
m_skipped
)
{
m_explanation
=
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para><application>GnuPG</application> is not configured for %1 communication.</para>"
,
Formatting
::
deVsString
());
return
;
}
m_passed
=
gnupgIsDeVsCompliant
();
if
(
m_passed
)
{
return
;
}
m_error
=
Formatting
::
deVsString
(
m_passed
);
m_explanation
=
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>The <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
Formatting
::
deVsString
());
m_proposedFix
=
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>Install a version of <application>GnuPG</application> that is %1.</para>"
,
Formatting
::
deVsString
());
}
};
}
std
::
shared_ptr
<
SelfTest
>
Kleo
::
makeDeVSComplianceCheckSelfTest
()
{
return
std
::
make_shared
<
DeVsComplianceCheck
>
();
}
src/selftest/compliancecheck.h
0 → 100644
View file @
b823dc58
/* -*- mode: c++; c-basic-offset:4 -*-
selftest/compliancecheck.h
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <selftest/selftest.h>
#include <memory>
namespace
Kleo
{
class
SelfTest
;
std
::
shared_ptr
<
SelfTest
>
makeDeVSComplianceCheckSelfTest
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment