From a40a33e1da3a1d5c06c0c2f1c4e1a95e5a1a3f2e Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 27 Jul 2016 19:22:01 +0200 Subject: [PATCH] delete abandoned CryptoHelper class --- .../java/com/fsck/k9/crypto/CryptoHelper.java | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java diff --git a/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java b/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java deleted file mode 100644 index 532d3857d..000000000 --- a/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.fsck.k9.crypto; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.fsck.k9.mail.Message; -import com.fsck.k9.mail.MessagingException; -import com.fsck.k9.mail.Part; -import com.fsck.k9.mail.internet.MessageExtractor; -import com.fsck.k9.mail.internet.MimeUtility; - - -public class CryptoHelper { - - public static final Pattern PGP_MESSAGE = - Pattern.compile(".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*", - Pattern.DOTALL); - - public static final Pattern PGP_SIGNED_MESSAGE = - Pattern.compile( - ".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*", - Pattern.DOTALL); - - public CryptoHelper() { - super(); - } - - /** - * TODO: use new parseMessage() from PgpUtils to actually parse! - * @param message - * @return - */ - public boolean isEncrypted(Message message) { - String data = null; - Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain"); - if (part == null) { - part = MimeUtility.findFirstPartByMimeType(message, "text/html"); - } - if (part != null) { - data = MessageExtractor.getTextFromPart(part); - } - - if (data == null) { - return false; - } - - Matcher matcher = PGP_MESSAGE.matcher(data); - return matcher.matches(); - } - - public boolean isSigned(Message message) { - String data = null; - Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain"); - if (part == null) { - part = MimeUtility.findFirstPartByMimeType(message, "text/html"); - } - if (part != null) { - data = MessageExtractor.getTextFromPart(part); - } - - if (data == null) { - return false; - } - - Matcher matcher = PGP_SIGNED_MESSAGE.matcher(data); - return matcher.matches(); - } -}