use available methods for structure detection

This commit is contained in:
Vincent Breitmoser 2017-09-19 00:21:45 +02:00
parent 57a5d96173
commit ac628a265d
2 changed files with 4 additions and 5 deletions

View file

@ -233,7 +233,7 @@ public class MessageCryptoStructureDetector {
return dataUnavailable || protocolMatches;
}
private static boolean isPartMultipartEncrypted(Part part) {
public static boolean isPartMultipartEncrypted(Part part) {
if (!isSameMimeType(part.getMimeType(), MULTIPART_ENCRYPTED)) {
return false;
}

View file

@ -83,10 +83,9 @@ public class MessageViewInfoExtractor {
return extractSimpleMessageForView(message, message);
}
boolean isOpenPgpEncrypted =
MimeUtility.isSameMimeType(cryptoContentPart.getMimeType(), "multipart/encrypted") &&
MimeUtility.isSameMimeType(getHeaderParameter(cryptoContentPart.getContentType(), "protocol"),
"application/pgp-encrypted");
boolean isOpenPgpEncrypted = (MessageCryptoStructureDetector.isPartMultipartEncrypted(cryptoContentPart) &&
MessageCryptoStructureDetector.isMultipartEncryptedOpenPgpProtocol(cryptoContentPart)) ||
MessageCryptoStructureDetector.isPartPgpInlineEncrypted(cryptoContentPart);
if (!K9.isOpenPgpProviderConfigured() && isOpenPgpEncrypted) {
CryptoResultAnnotation noProviderAnnotation = CryptoResultAnnotation.createErrorAnnotation(
CryptoError.OPENPGP_ENCRYPTED_NO_PROVIDER, null);