Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
PIM Messagelib
Commits
e0955ea1
Commit
e0955ea1
authored
Mar 31, 2016
by
Sandro Knauß
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use local variables
parent
2e15d855
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
35 deletions
+39
-35
mimetreeparser/src/viewer/messagepart.cpp
mimetreeparser/src/viewer/messagepart.cpp
+33
-34
mimetreeparser/src/viewer/messagepart.h
mimetreeparser/src/viewer/messagepart.h
+6
-1
No files found.
mimetreeparser/src/viewer/messagepart.cpp
View file @
e0955ea1
...
...
@@ -1868,7 +1868,7 @@ void CryptoMessagePart::startDecryption(KMime::Content *data)
}
}
bool
CryptoMessagePart
::
okVerify
(
const
QByteArray
&
data
,
const
Kleo
::
CryptoBackend
::
Protocol
*
cryptProto
,
PartMetaData
&
messagePart
,
QByteArray
&
verifiedText
,
std
::
vector
<
GpgME
::
Signature
>
&
signatures
,
const
QByteArray
&
signature
,
KMime
::
Content
*
sign
)
bool
CryptoMessagePart
::
okVerify
(
const
QByteArray
&
data
,
const
QByteArray
&
signature
)
{
enum
{
NO_PLUGIN
,
NOT_INITIALIZED
,
CANT_VERIFY_SIGNATURES
}
cryptPlugError
=
NO_PLUGIN
;
...
...
@@ -1879,37 +1879,37 @@ bool CryptoMessagePart::okVerify(const QByteArray &data, const Kleo::CryptoBacke
NodeHelper
*
nodeHelper
=
mOtp
->
nodeHelper
();
ObjectTreeSourceIf
*
source
=
mOtp
->
mSource
;
if
(
c
ryptProto
)
{
cryptPlugLibName
=
c
ryptProto
->
name
();
cryptPlugDisplayName
=
c
ryptProto
->
displayName
();
if
(
mC
rypt
o
Proto
)
{
cryptPlugLibName
=
mC
rypt
o
Proto
->
name
();
cryptPlugDisplayName
=
mC
rypt
o
Proto
->
displayName
();
}
m
essagePart
.
isSigned
=
false
;
m
essagePart
.
technicalProblem
=
(
c
ryptProto
==
0
);
m
essagePart
.
keyTrust
=
GpgME
::
Signature
::
Unknown
;
m
essagePart
.
status
=
i18n
(
"Wrong Crypto Plug-In."
);
m
essagePart
.
status_code
=
GPGME_SIG_STAT_NONE
;
m
MetaData
.
isSigned
=
false
;
m
MetaData
.
technicalProblem
=
(
mC
rypt
o
Proto
==
0
);
m
MetaData
.
keyTrust
=
GpgME
::
Signature
::
Unknown
;
m
MetaData
.
status
=
i18n
(
"Wrong Crypto Plug-In."
);
m
MetaData
.
status_code
=
GPGME_SIG_STAT_NONE
;
const
QByteArray
mementoName
=
"verification"
;
CryptoBodyPartMemento
*
m
=
dynamic_cast
<
CryptoBodyPartMemento
*>
(
nodeHelper
->
bodyPartMemento
(
sign
,
mementoName
));
CryptoBodyPartMemento
*
m
=
dynamic_cast
<
CryptoBodyPartMemento
*>
(
nodeHelper
->
bodyPartMemento
(
mNode
,
mementoName
));
if
(
!
m
)
{
if
(
!
signature
.
isEmpty
())
{
Kleo
::
VerifyDetachedJob
*
job
=
c
ryptProto
->
verifyDetachedJob
();
Kleo
::
VerifyDetachedJob
*
job
=
mC
rypt
o
Proto
->
verifyDetachedJob
();
if
(
job
)
{
m
=
new
VerifyDetachedBodyPartMemento
(
job
,
c
ryptProto
->
keyListJob
(),
signature
,
data
);
m
=
new
VerifyDetachedBodyPartMemento
(
job
,
mC
rypt
o
Proto
->
keyListJob
(),
signature
,
data
);
}
else
{
cryptPlugError
=
CANT_VERIFY_SIGNATURES
;
c
ryptProto
=
0
;
mC
rypt
o
Proto
=
0
;
}
}
else
{
Kleo
::
VerifyOpaqueJob
*
job
=
c
ryptProto
->
verifyOpaqueJob
();
Kleo
::
VerifyOpaqueJob
*
job
=
mC
rypt
o
Proto
->
verifyOpaqueJob
();
if
(
job
)
{
m
=
new
VerifyOpaqueBodyPartMemento
(
job
,
c
ryptProto
->
keyListJob
(),
data
);
m
=
new
VerifyOpaqueBodyPartMemento
(
job
,
mC
rypt
o
Proto
->
keyListJob
(),
data
);
}
else
{
cryptPlugError
=
CANT_VERIFY_SIGNATURES
;
c
ryptProto
=
0
;
mC
rypt
o
Proto
=
0
;
}
}
if
(
m
)
{
...
...
@@ -1920,39 +1920,39 @@ bool CryptoMessagePart::okVerify(const QByteArray &data, const Kleo::CryptoBacke
source
->
sourceObject
(),
SLOT
(
update
(
MimeTreeParser
::
UpdateMode
)));
if
(
m
->
start
())
{
m
essagePart
.
inProgress
=
true
;
m
MetaData
.
inProgress
=
true
;
mOtp
->
mHasPendingAsyncJobs
=
true
;
}
}
else
{
m
->
exec
();
}
nodeHelper
->
setBodyPartMemento
(
sign
,
mementoName
,
m
);
nodeHelper
->
setBodyPartMemento
(
mNode
,
mementoName
,
m
);
}
}
else
if
(
m
->
isRunning
())
{
m
essagePart
.
inProgress
=
true
;
m
MetaData
.
inProgress
=
true
;
mOtp
->
mHasPendingAsyncJobs
=
true
;
m
=
0
;
}
else
{
m
essagePart
.
inProgress
=
false
;
m
MetaData
.
inProgress
=
false
;
mOtp
->
mHasPendingAsyncJobs
=
false
;
}
if
(
m
&&
!
m
essagePart
.
inProgress
)
{
if
(
m
&&
!
m
MetaData
.
inProgress
)
{
if
(
!
signature
.
isEmpty
())
{
VerifyDetachedBodyPartMemento
*
vm
=
dynamic_cast
<
VerifyDetachedBodyPartMemento
*>
(
m
);
v
erifiedText
=
data
;
s
ignatures
=
vm
->
verifyResult
().
signatures
();
mV
erifiedText
=
data
;
mS
ignatures
=
vm
->
verifyResult
().
signatures
();
}
else
{
VerifyOpaqueBodyPartMemento
*
vm
=
dynamic_cast
<
VerifyOpaqueBodyPartMemento
*>
(
m
);
v
erifiedText
=
vm
->
plainText
();
s
ignatures
=
vm
->
verifyResult
().
signatures
();
mV
erifiedText
=
vm
->
plainText
();
mS
ignatures
=
vm
->
verifyResult
().
signatures
();
}
m
essagePart
.
auditLogError
=
m
->
auditLogError
();
m
essagePart
.
auditLog
=
m
->
auditLogAsHtml
();
m
essagePart
.
isSigned
=
!
s
ignatures
.
empty
();
m
MetaData
.
auditLogError
=
m
->
auditLogError
();
m
MetaData
.
auditLog
=
m
->
auditLogAsHtml
();
m
MetaData
.
isSigned
=
!
mS
ignatures
.
empty
();
}
if
(
!
c
ryptProto
)
{
if
(
!
mC
rypt
o
Proto
)
{
QString
errorMsg
;
switch
(
cryptPlugError
)
{
case
NOT_INITIALIZED
:
...
...
@@ -1960,7 +1960,7 @@ bool CryptoMessagePart::okVerify(const QByteArray &data, const Kleo::CryptoBacke
cryptPlugLibName
);
break
;
case
CANT_VERIFY_SIGNATURES
:
errorMsg
=
i18n
(
"Crypto plug-in
\"
%1
\"
cannot verify
s
ignatures."
,
errorMsg
=
i18n
(
"Crypto plug-in
\"
%1
\"
cannot verify
mS
ignatures."
,
cryptPlugLibName
);
break
;
case
NO_PLUGIN
:
...
...
@@ -1973,17 +1973,16 @@ bool CryptoMessagePart::okVerify(const QByteArray &data, const Kleo::CryptoBacke
}
break
;
}
m
essagePart
.
errorText
=
i18n
(
"The message is signed, but the "
m
MetaData
.
errorText
=
i18n
(
"The message is signed, but the "
"validity of the signature cannot be "
"verified.<br />"
"Reason: %1"
,
errorMsg
);
}
return
m
essagePart
.
isSigned
;
return
m
MetaData
.
isSigned
;
}
void
CryptoMessagePart
::
startVerification
(
const
QByteArray
&
text
,
const
QTextCodec
*
aCodec
)
{
startVerificationDetached
(
text
,
0
,
QByteArray
());
...
...
@@ -1998,7 +1997,7 @@ void CryptoMessagePart::startVerificationDetached(const QByteArray &text, KMime:
mMetaData
.
isEncrypted
=
false
;
mMetaData
.
isDecryptable
=
false
;
okVerify
(
text
,
mCryptoProto
,
mMetaData
,
mVerifiedText
,
mSignatures
,
signature
,
mNode
);
okVerify
(
text
,
signature
);
if
(
mMetaData
.
isSigned
)
{
mOtp
->
sigStatusToMetaData
(
mSignatures
,
mCryptoProto
,
mMetaData
,
GpgME
::
Key
());
...
...
mimetreeparser/src/viewer/messagepart.h
View file @
e0955ea1
...
...
@@ -437,7 +437,12 @@ private:
*/
bool
okDecryptMIME
(
KMime
::
Content
&
data
);
bool
okVerify
(
const
QByteArray
&
data
,
const
Kleo
::
CryptoBackend
::
Protocol
*
cryptProto
,
PartMetaData
&
messagePart
,
QByteArray
&
verifiedText
,
std
::
vector
<
GpgME
::
Signature
>
&
signatures
,
const
QByteArray
&
signature
,
KMime
::
Content
*
sign
);
/** Handles the verification of data
* If signature is empty it is handled as inline signature otherwise as detached signature mode.
* Returns true if the verfication was successfull and the block is signed.
* If used in async mode, check if mMetaData.inProgress is true, it inicates a running verification process.
*/
bool
okVerify
(
const
QByteArray
&
data
,
const
QByteArray
&
signature
);
protected:
bool
mPassphraseError
;
bool
mNoSecKey
;
...
...
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