Skip to content
GitLab
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
1d6b96f4
Commit
1d6b96f4
authored
Jul 13, 2022
by
Ingo Klöcker
Browse files
Port to helpers in DeVSCompliance namespace
GnuPG-bug-id: 6073
parent
732b973f
Changes
10
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
1d6b96f4
...
...
@@ -34,7 +34,7 @@ set(KF5_MIN_VERSION "5.96.0")
set
(
KIDENTITYMANAGEMENT_VERSION
"5.20.40"
)
set
(
KMAILTRANSPORT_VERSION
"5.20.40"
)
set
(
KMIME_VERSION
"5.20.40"
)
set
(
LIBKLEO_VERSION
"5.2
0
.4
7
"
)
set
(
LIBKLEO_VERSION
"5.2
1
.4
1
"
)
set
(
QT_REQUIRED_VERSION
"5.15.2"
)
set
(
GPGME_REQUIRED_VERSION
"1.16.0"
)
...
...
src/crypto/decryptverifytask.cpp
View file @
1d6b96f4
...
...
@@ -17,6 +17,7 @@
#include
<QGpgME/DecryptJob>
#include
<QGpgME/DecryptVerifyJob>
#include
<Libkleo/Compliance>
#include
<Libkleo/Dn>
#include
<Libkleo/KleoException>
#include
<Libkleo/Stl_Util>
...
...
@@ -270,14 +271,14 @@ static QString formatSigningInformation(const Signature &sig)
}
text
+=
i18n
(
"With certificate:"
)
+
QStringLiteral
(
"<br>"
)
+
renderKey
(
key
);
if
(
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeVSCompliance
::
i
sCompliant
())
{
text
+=
(
QStringLiteral
(
"<br/>"
)
+
(
sig
.
isDeVs
()
?
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"The signature is %1"
,
Formatting
::
deVsString
(
))
"The signature is %1"
,
DeVSCompliance
::
name
(
true
))
:
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"The signature <b>is not</b> %1."
,
Formatting
::
deVsString
(
))));
"The signature <b>is not</b> %1."
,
DeVSCompliance
::
name
(
true
))));
}
return
text
;
...
...
@@ -574,12 +575,12 @@ static QString formatDecryptionResultDetails(const DecryptionResult &res, const
QString
details
;
if
(
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeVSCompliance
::
i
sCompliant
())
{
details
+=
((
res
.
isDeVs
()
?
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"The decryption is %1."
,
Formatting
::
deVsString
(
))
"The decryption is %1."
,
DeVSCompliance
::
name
(
true
))
:
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"The decryption <b>is not</b> %1."
,
Formatting
::
deVsString
(
)))
"The decryption <b>is not</b> %1."
,
DeVSCompliance
::
name
(
true
)))
+
QStringLiteral
(
"<br/>"
));
}
...
...
src/crypto/gui/signencryptemailconflictdialog.cpp
View file @
1d6b96f4
...
...
@@ -21,6 +21,7 @@
#include
"utils/gui-helper.h"
#include
"utils/kleo_assert.h"
#include
<Libkleo/Compliance>
#include
<Libkleo/Stl_Util>
#include
<Libkleo/Formatting>
#include
<Libkleo/SystemInfo>
...
...
@@ -247,7 +248,7 @@ private:
void
updateComplianceStatus
()
{
if
(
!
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
!
DeVSCompliance
::
i
sCompliant
())
{
return
;
}
if
(
q
->
selectedProtocol
()
==
UnknownProtocol
||
...
...
@@ -283,9 +284,9 @@ private:
}
ui
.
complianceLB
.
setText
(
de_vs
?
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication possible."
,
Formatting
::
deVsString
(
))
"%1 communication possible."
,
DeVSCompliance
::
name
(
true
))
:
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication not possible."
,
Formatting
::
deVsString
(
)));
"%1 communication not possible."
,
DeVSCompliance
::
name
(
true
)));
ui
.
complianceLB
.
setVisible
(
true
);
}
...
...
src/crypto/gui/signencryptfileswizard.cpp
View file @
1d6b96f4
...
...
@@ -28,6 +28,7 @@
#include
<KMessageWidget>
#include
"kleopatra_debug.h"
#include
<Libkleo/Compliance>
#include
<Libkleo/GnuPG>
#include
<Libkleo/Formatting>
#include
<Libkleo/SystemInfo>
...
...
@@ -193,9 +194,9 @@ public:
messageWidget
->
setToolTip
(
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>You cannot use <application>Kleopatra</application> for signing or encrypting files "
"because the <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
Formatting
::
deVsString
(
)));
DeVSCompliance
::
name
(
true
)));
messageWidget
->
setCloseButtonVisible
(
false
);
messageWidget
->
setVisible
(
Kleo
::
gnupgUses
DeV
s
Compliance
()
&&
!
Kleo
::
gnupgIsDeV
sCompliant
());
messageWidget
->
setVisible
(
DeV
S
Compliance
::
isActive
()
&&
!
DeVSCompliance
::
i
sCompliant
());
vLay
->
addWidget
(
messageWidget
);
setMinimumHeight
(
300
);
...
...
@@ -213,7 +214,7 @@ public:
bool
isComplete
()
const
override
{
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
()
&&
!
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeV
S
Compliance
::
isActive
()
&&
!
DeVSCompliance
::
i
sCompliant
())
{
return
false
;
}
return
mWidget
->
isComplete
();
...
...
@@ -255,12 +256,12 @@ public:
bool
validatePage
()
override
{
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
()
&&
!
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeV
S
Compliance
::
isActive
()
&&
!
DeVSCompliance
::
i
sCompliant
())
{
KMessageBox
::
sorry
(
topLevelWidget
(),
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>Sorry! You cannot use <application>Kleopatra</application> for signing or encrypting files "
"because the <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
Formatting
::
deVsString
(
)));
DeVSCompliance
::
name
(
true
)));
return
false
;
}
bool
sign
=
!
mWidget
->
signKey
().
isNull
();
...
...
@@ -444,8 +445,8 @@ private Q_SLOTS:
auto
btn
=
mParent
->
button
(
QWizard
::
CommitButton
);
if
(
!
label
.
isEmpty
())
{
mParent
->
setButtonText
(
QWizard
::
CommitButton
,
label
);
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
())
{
const
bool
de_vs
=
Kleo
::
gnupgIsDeV
sCompliant
()
&&
mWidget
->
isDeVsAndValid
();
if
(
DeV
S
Compliance
::
isActive
())
{
const
bool
de_vs
=
DeVSCompliance
::
i
sCompliant
()
&&
mWidget
->
isDeVsAndValid
();
btn
->
setIcon
(
QIcon
::
fromTheme
(
de_vs
?
QStringLiteral
(
"security-high"
)
:
QStringLiteral
(
"security-medium"
)));
...
...
@@ -456,9 +457,9 @@ private Q_SLOTS:
}
mParent
->
setLabelText
(
de_vs
?
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication possible."
,
Formatting
::
deVsString
(
))
"%1 communication possible."
,
DeVSCompliance
::
name
(
true
))
:
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication not possible."
,
Formatting
::
deVsString
(
)));
"%1 communication not possible."
,
DeVSCompliance
::
name
(
true
)));
}
}
else
{
mParent
->
setButtonText
(
QWizard
::
CommitButton
,
i18n
(
"Next"
));
...
...
@@ -546,7 +547,7 @@ SignEncryptFilesWizard::SignEncryptFilesWizard(QWidget *parent, Qt::WindowFlags
{
readConfig
();
const
bool
de_vs
=
Kleo
::
gnupgUses
DeV
s
Compliance
();
const
bool
de_vs
=
DeV
S
Compliance
::
isActive
();
#ifdef Q_OS_WIN
// Enforce modern style to avoid vista style ugliness.
setWizardStyle
(
QWizard
::
ModernStyle
);
...
...
src/crypto/newsignencryptemailcontroller.cpp
View file @
1d6b96f4
...
...
@@ -26,6 +26,7 @@
#include
<Libkleo/GnuPG>
#include
"utils/kleo_assert.h"
#include
<Libkleo/Compliance>
#include
<Libkleo/Stl_Util>
#include
<Libkleo/KleoException>
...
...
@@ -393,12 +394,12 @@ void NewSignEncryptEMailController::startResolveCertificates(const std::vector<M
d
->
dialog
->
pickProtocol
();
d
->
dialog
->
setConflict
(
conflict
);
const
bool
compliant
=
!
Kleo
::
gnupgUses
DeV
s
Compliance
()
||
(
Kleo
::
gnupgIsDeV
sCompliant
()
&&
is_de_vs_compliant
(
d
->
sign
,
d
->
encrypt
,
senders
,
recipients
,
d
->
presetProtocol
));
const
bool
compliant
=
!
DeV
S
Compliance
::
isActive
()
||
(
DeVSCompliance
::
i
sCompliant
()
&&
is_de_vs_compliant
(
d
->
sign
,
d
->
encrypt
,
senders
,
recipients
,
d
->
presetProtocol
));
if
(
quickMode
&&
!
conflict
&&
compliant
)
{
QMetaObject
::
invokeMethod
(
this
,
"slotDialogAccepted"
,
Qt
::
QueuedConnection
);
...
...
src/dialogs/certificatedetailswidget.cpp
View file @
1d6b96f4
...
...
@@ -39,6 +39,7 @@
#include
"utils/tags.h"
#include
<Libkleo/Algorithm>
#include
<Libkleo/Compliance>
#include
<Libkleo/Formatting>
#include
<Libkleo/Dn>
#include
<Libkleo/KeyCache>
...
...
@@ -591,7 +592,7 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
}
// ui.fingerprintField->setVisible(true); // always visible
ui
.
smimeIssuerField
->
setVisible
(
isSMIME
);
ui
.
complianceField
->
setVisible
(
Kleo
::
gnupgIsDeV
sCompliant
());
ui
.
complianceField
->
setVisible
(
DeVSCompliance
::
i
sCompliant
());
ui
.
trustedIntroducerField
->
setVisible
(
isOpenPGP
);
// may be hidden again by setupPGPProperties()
ui
.
smimeRelatedAddresses
->
setVisible
(
isSMIME
);
...
...
@@ -620,7 +621,7 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
Formatting
::
accessibleExpirationDate
(
key
,
i18nc
(
"Expires"
,
"never"
)));
ui
.
fingerprintField
->
setValue
(
Formatting
::
prettyID
(
key
.
primaryFingerprint
()),
Formatting
::
accessibleHexID
(
key
.
primaryFingerprint
()));
if
(
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeVSCompliance
::
i
sCompliant
())
{
ui
.
complianceField
->
setValue
(
Kleo
::
Formatting
::
complianceStringForKey
(
key
));
}
}
...
...
src/mainwindow.cpp
View file @
1d6b96f4
...
...
@@ -73,6 +73,7 @@
#include
<QStatusBar>
#include
<QLabel>
#include
<Libkleo/Compliance>
#include
<Libkleo/Formatting>
#include
<Libkleo/GnuPG>
#include
<Libkleo/KeyListModel>
...
...
@@ -235,15 +236,15 @@ public:
void
updateStatusBar
()
{
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
())
{
if
(
DeV
S
Compliance
::
isActive
())
{
auto
statusBar
=
std
::
make_unique
<
QStatusBar
>
();
auto
statusLbl
=
std
::
make_unique
<
QLabel
>
(
Formatting
::
deVsString
(
Kleo
::
gnupgIs
DeV
s
Complian
t
()
));
auto
statusLbl
=
std
::
make_unique
<
QLabel
>
(
DeV
S
Complian
ce
::
name
(
));
if
(
!
SystemInfo
::
isHighContrastModeActive
())
{
const
auto
color
=
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
foreground
(
Kleo
::
gnupgIsDeV
sCompliant
()
?
KColorScheme
::
NormalText
:
KColorScheme
::
NegativeText
DeVSCompliance
::
i
sCompliant
()
?
KColorScheme
::
NormalText
:
KColorScheme
::
NegativeText
).
color
();
const
auto
background
=
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
background
(
Kleo
::
gnupgIsDeV
sCompliant
()
?
KColorScheme
::
PositiveBackground
:
KColorScheme
::
NegativeBackground
DeVSCompliance
::
i
sCompliant
()
?
KColorScheme
::
PositiveBackground
:
KColorScheme
::
NegativeBackground
).
color
();
statusLbl
->
setStyleSheet
(
QStringLiteral
(
"QLabel { color: %1; background-color: %2; }"
).
arg
(
color
.
name
()).
arg
(
background
.
name
()));
...
...
src/newcertificatewizard/advancedsettingsdialog.cpp
View file @
1d6b96f4
...
...
@@ -22,6 +22,7 @@
#include
<settings.h>
#include
<Libkleo/Compat>
#include
<Libkleo/Compliance>
#include
<Libkleo/GnuPG>
#include
<KDateComboBox>
...
...
@@ -828,7 +829,7 @@ void AdvancedSettingsDialog::fillKeySizeComboBoxen()
const
KConfigGroup
config
(
KSharedConfig
::
openConfig
(),
"CertificateCreationWizard"
);
QList
<
int
>
rsaKeySizes
=
config
.
readEntry
(
RSA_KEYSIZES_ENTRY
,
QList
<
int
>
()
<<
2048
<<
-
3072
<<
4096
);
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
())
{
if
(
DeV
S
Compliance
::
isActive
())
{
rsaKeySizes
=
config
.
readEntry
(
RSA_KEYSIZES_ENTRY
,
QList
<
int
>
()
<<
-
3072
<<
4096
);
}
const
QList
<
int
>
dsaKeySizes
=
config
.
readEntry
(
DSA_KEYSIZES_ENTRY
,
QList
<
int
>
()
<<
-
2048
);
...
...
@@ -997,7 +998,7 @@ void AdvancedSettingsDialog::updateWidgetVisibility()
ui
->
ecdsaRB
->
setText
(
QStringLiteral
(
"ECDSA/EdDSA"
));
}
const
bool
deVsHack
=
Kleo
::
gnupgUses
DeV
s
Compliance
();
const
bool
deVsHack
=
DeV
S
Compliance
::
isActive
();
if
(
deVsHack
)
{
// GnuPG Provides no API to query which keys are compliant for
...
...
src/selftest/compliancecheck.cpp
View file @
1d6b96f4
...
...
@@ -14,6 +14,7 @@
#include
"implementation_p.h"
#include
<Libkleo/Compliance>
#include
<Libkleo/Formatting>
#include
<Libkleo/GnuPG>
...
...
@@ -30,33 +31,33 @@ 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
(
)))
"%1?"
,
DeVSCompliance
::
name
(
true
)))
{
runTest
();
}
void
runTest
()
{
m_skipped
=
!
gnupgUses
DeV
s
Compliance
();
m_skipped
=
!
DeV
S
Compliance
::
isActive
();
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
(
));
"<para><application>GnuPG</application> is not configured for %1 communication.</para>"
,
DeVSCompliance
::
name
(
true
));
return
;
}
m_passed
=
gnupgIsDeV
sCompliant
();
m_passed
=
DeVSCompliance
::
i
sCompliant
();
if
(
m_passed
)
{
return
;
}
m_error
=
Formatting
::
deVsString
(
m_passed
);
m_error
=
DeVSCompliance
::
name
(
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
(
));
"<para>The <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
DeVSCompliance
::
name
(
true
));
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
(
));
"<para>Install a version of <application>GnuPG</application> that is %1.</para>"
,
DeVSCompliance
::
name
(
true
));
}
};
...
...
src/view/padwidget.cpp
View file @
1d6b96f4
...
...
@@ -14,6 +14,7 @@
#include
<Libkleo/KleoException>
#include
<Libkleo/Classify>
#include
<Libkleo/Compliance>
#include
<Libkleo/KeyCache>
#include
<Libkleo/Formatting>
#include
<Libkleo/SystemInfo>
...
...
@@ -112,7 +113,7 @@ public:
mMessageWidget
->
setToolTip
(
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>You cannot use <application>Kleopatra</application> for signing or encryption "
"because the <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
Formatting
::
deVsString
(
)));
DeVSCompliance
::
name
(
true
)));
mMessageWidget
->
setCloseButtonVisible
(
false
);
mMessageWidget
->
setVisible
(
false
);
vLay
->
addWidget
(
mMessageWidget
);
...
...
@@ -384,12 +385,12 @@ public:
void
doEncryptSign
()
{
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
()
&&
!
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
DeV
S
Compliance
::
isActive
()
&&
!
DeVSCompliance
::
i
sCompliant
())
{
KMessageBox
::
sorry
(
q
->
topLevelWidget
(),
xi18nc
(
"@info %1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"<para>Sorry! You cannot use <application>Kleopatra</application> for signing or encryption "
"because the <application>GnuPG</application> system used by <application>Kleopatra</application> is not %1.</para>"
,
Formatting
::
deVsString
(
)));
DeVSCompliance
::
name
(
true
)));
return
;
}
...
...
@@ -490,8 +491,8 @@ public:
mCryptBtn
->
setEnabled
(
false
);
}
if
(
Kleo
::
gnupgUses
DeV
s
Compliance
())
{
const
bool
de_vs
=
Kleo
::
gnupgIsDeV
sCompliant
()
&&
mSigEncWidget
->
isDeVsAndValid
();
if
(
DeV
S
Compliance
::
isActive
())
{
const
bool
de_vs
=
DeVSCompliance
::
i
sCompliant
()
&&
mSigEncWidget
->
isDeVsAndValid
();
mCryptBtn
->
setIcon
(
QIcon
::
fromTheme
(
de_vs
?
QStringLiteral
(
"security-high"
)
:
QStringLiteral
(
"security-medium"
)));
...
...
@@ -502,14 +503,14 @@ public:
}
mAdditionalInfoLabel
->
setText
(
de_vs
?
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication possible."
,
Formatting
::
deVsString
(
))
"%1 communication possible."
,
DeVSCompliance
::
name
(
true
))
:
i18nc
(
"%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant"
,
"%1 communication not possible."
,
Formatting
::
deVsString
(
)));
"%1 communication not possible."
,
DeVSCompliance
::
name
(
true
)));
mAdditionalInfoLabel
->
setVisible
(
true
);
if
(
!
Kleo
::
gnupgIsDeV
sCompliant
())
{
if
(
!
DeVSCompliance
::
i
sCompliant
())
{
mCryptBtn
->
setEnabled
(
false
);
}
mMessageWidget
->
setVisible
(
!
Kleo
::
gnupgIsDeV
sCompliant
());
mMessageWidget
->
setVisible
(
!
DeVSCompliance
::
i
sCompliant
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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