mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-02 14:02:17 -05:00
Fix class name
This commit is contained in:
parent
d678ccc160
commit
0a07250417
@ -19,13 +19,13 @@ import static junit.framework.Assert.assertSame;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class MessageDecryptVerifyerTest {
|
public class MessageDecryptVerifierTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void findEncryptedPartsShouldReturnEmptyListForEmptyMessage() throws Exception {
|
public void findEncryptedPartsShouldReturnEmptyListForEmptyMessage() throws Exception {
|
||||||
MimeMessage emptyMessage = new MimeMessage();
|
MimeMessage emptyMessage = new MimeMessage();
|
||||||
|
|
||||||
List<Part> encryptedParts = MessageDecryptVerifyer.findEncryptedParts(emptyMessage);
|
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(emptyMessage);
|
||||||
assertEquals(0, encryptedParts.size());
|
assertEquals(0, encryptedParts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class MessageDecryptVerifyerTest {
|
|||||||
MimeMessage message = new MimeMessage();
|
MimeMessage message = new MimeMessage();
|
||||||
message.setBody(new TextBody("message text"));
|
message.setBody(new TextBody("message text"));
|
||||||
|
|
||||||
List<Part> encryptedParts = MessageDecryptVerifyer.findEncryptedParts(message);
|
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
|
||||||
assertEquals(0, encryptedParts.size());
|
assertEquals(0, encryptedParts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public class MessageDecryptVerifyerTest {
|
|||||||
mulitpartEncrypted.setSubType("encrypted");
|
mulitpartEncrypted.setSubType("encrypted");
|
||||||
MimeMessageHelper.setBody(message, mulitpartEncrypted);
|
MimeMessageHelper.setBody(message, mulitpartEncrypted);
|
||||||
|
|
||||||
List<Part> encryptedParts = MessageDecryptVerifyer.findEncryptedParts(message);
|
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
|
||||||
assertEquals(1, encryptedParts.size());
|
assertEquals(1, encryptedParts.size());
|
||||||
assertSame(message, encryptedParts.get(0));
|
assertSame(message, encryptedParts.get(0));
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class MessageDecryptVerifyerTest {
|
|||||||
MimeBodyPart bodyPartThree = new MimeBodyPart(mulitpartEncryptedThree);
|
MimeBodyPart bodyPartThree = new MimeBodyPart(mulitpartEncryptedThree);
|
||||||
multipartMixed.addBodyPart(bodyPartThree);
|
multipartMixed.addBodyPart(bodyPartThree);
|
||||||
|
|
||||||
List<Part> encryptedParts = MessageDecryptVerifyer.findEncryptedParts(message);
|
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
|
||||||
assertEquals(2, encryptedParts.size());
|
assertEquals(2, encryptedParts.size());
|
||||||
assertSame(bodyPartOne, encryptedParts.get(0));
|
assertSame(bodyPartOne, encryptedParts.get(0));
|
||||||
assertSame(bodyPartThree, encryptedParts.get(1));
|
assertSame(bodyPartThree, encryptedParts.get(1));
|
@ -14,7 +14,7 @@ import com.fsck.k9.mail.Multipart;
|
|||||||
import com.fsck.k9.mail.Part;
|
import com.fsck.k9.mail.Part;
|
||||||
|
|
||||||
|
|
||||||
public class MessageDecryptVerifyer {
|
public class MessageDecryptVerifier {
|
||||||
private static final String MULTIPART_ENCRYPTED = "multipart/encrypted";
|
private static final String MULTIPART_ENCRYPTED = "multipart/encrypted";
|
||||||
private static final String MULTIPART_SIGNED = "multipart/signed";
|
private static final String MULTIPART_SIGNED = "multipart/signed";
|
||||||
private static final String PROTOCOL_PARAMETER = "protocol";
|
private static final String PROTOCOL_PARAMETER = "protocol";
|
@ -5,7 +5,7 @@ import android.content.Context;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.crypto.MessageDecryptVerifyer;
|
import com.fsck.k9.crypto.MessageDecryptVerifier;
|
||||||
import com.fsck.k9.mail.Address;
|
import com.fsck.k9.mail.Address;
|
||||||
import com.fsck.k9.mail.Body;
|
import com.fsck.k9.mail.Body;
|
||||||
import com.fsck.k9.mail.BodyPart;
|
import com.fsck.k9.mail.BodyPart;
|
||||||
@ -478,7 +478,7 @@ public class LocalMessageExtractor {
|
|||||||
parts.add(part);
|
parts.add(part);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (MessageDecryptVerifyer.isPgpMimeSignedPart(part)) {
|
} else if (MessageDecryptVerifier.isPgpMimeSignedPart(part)) {
|
||||||
parts.add(part);
|
parts.add(part);
|
||||||
return true;
|
return true;
|
||||||
} else if (isPgpMimeDecryptedPart(part)) {
|
} else if (isPgpMimeDecryptedPart(part)) {
|
||||||
@ -492,7 +492,7 @@ public class LocalMessageExtractor {
|
|||||||
public static boolean isPgpMimeDecryptedPart (Part part) {
|
public static boolean isPgpMimeDecryptedPart (Part part) {
|
||||||
Body body = part.getBody();
|
Body body = part.getBody();
|
||||||
return (body instanceof Multipart)
|
return (body instanceof Multipart)
|
||||||
&& MessageDecryptVerifyer.isPgpMimeEncryptedPart(part)
|
&& MessageDecryptVerifier.isPgpMimeEncryptedPart(part)
|
||||||
&& ((Multipart) part.getBody()).getCount() == 3;
|
&& ((Multipart) part.getBody()).getCount() == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ public class LocalMessageExtractor {
|
|||||||
OpenPgpResultBodyPart openPgpResultBodyPart = (OpenPgpResultBodyPart) part;
|
OpenPgpResultBodyPart openPgpResultBodyPart = (OpenPgpResultBodyPart) part;
|
||||||
return openPgpResultBodyPart;
|
return openPgpResultBodyPart;
|
||||||
}
|
}
|
||||||
if (MessageDecryptVerifyer.isPgpMimeSignedPart(part)) {
|
if (MessageDecryptVerifier.isPgpMimeSignedPart(part)) {
|
||||||
Multipart multi = (Multipart) part.getBody();
|
Multipart multi = (Multipart) part.getBody();
|
||||||
if (multi.getCount() == 3 && multi.getBodyPart(2) instanceof OpenPgpResultBodyPart) {
|
if (multi.getCount() == 3 && multi.getBodyPart(2) instanceof OpenPgpResultBodyPart) {
|
||||||
OpenPgpResultBodyPart openPgpResultBodyPart = (OpenPgpResultBodyPart) multi.getBodyPart(2);
|
OpenPgpResultBodyPart openPgpResultBodyPart = (OpenPgpResultBodyPart) multi.getBodyPart(2);
|
||||||
|
@ -20,7 +20,7 @@ import com.fsck.k9.Account;
|
|||||||
import com.fsck.k9.Identity;
|
import com.fsck.k9.Identity;
|
||||||
import com.fsck.k9.K9;
|
import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.activity.MessageList;
|
import com.fsck.k9.activity.MessageList;
|
||||||
import com.fsck.k9.crypto.MessageDecryptVerifyer;
|
import com.fsck.k9.crypto.MessageDecryptVerifier;
|
||||||
import com.fsck.k9.crypto.OpenPgpApiHelper;
|
import com.fsck.k9.crypto.OpenPgpApiHelper;
|
||||||
import com.fsck.k9.helper.IdentityHelper;
|
import com.fsck.k9.helper.IdentityHelper;
|
||||||
import com.fsck.k9.mail.Body;
|
import com.fsck.k9.mail.Body;
|
||||||
@ -61,8 +61,8 @@ public class MessageCryptoHelper {
|
|||||||
void decryptOrVerifyMessagePartsIfNecessary(LocalMessage message) {
|
void decryptOrVerifyMessagePartsIfNecessary(LocalMessage message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
|
||||||
List<Part> encryptedParts = MessageDecryptVerifyer.findEncryptedParts(message);
|
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
|
||||||
List<Part> signedParts = MessageDecryptVerifyer.findSignedParts(message);
|
List<Part> signedParts = MessageDecryptVerifier.findSignedParts(message);
|
||||||
if (!encryptedParts.isEmpty() || !signedParts.isEmpty()) {
|
if (!encryptedParts.isEmpty() || !signedParts.isEmpty()) {
|
||||||
partsToDecryptOrVerify = new ArrayDeque<Part>();
|
partsToDecryptOrVerify = new ArrayDeque<Part>();
|
||||||
partsToDecryptOrVerify.addAll(encryptedParts);
|
partsToDecryptOrVerify.addAll(encryptedParts);
|
||||||
@ -77,7 +77,7 @@ public class MessageCryptoHelper {
|
|||||||
if (!partsToDecryptOrVerify.isEmpty()) {
|
if (!partsToDecryptOrVerify.isEmpty()) {
|
||||||
|
|
||||||
Part part = partsToDecryptOrVerify.peekFirst();
|
Part part = partsToDecryptOrVerify.peekFirst();
|
||||||
if (MessageDecryptVerifyer.isPgpMimePart(part)) {
|
if (MessageDecryptVerifier.isPgpMimePart(part)) {
|
||||||
startDecryptingOrVerifyingPart(part);
|
startDecryptingOrVerifyingPart(part);
|
||||||
} else {
|
} else {
|
||||||
partsToDecryptOrVerify.removeFirst();
|
partsToDecryptOrVerify.removeFirst();
|
||||||
@ -139,7 +139,7 @@ public class MessageCryptoHelper {
|
|||||||
intent.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, accountName);
|
intent.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, accountName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (MessageDecryptVerifyer.isPgpMimeSignedPart(currentlyDecrypringOrVerifyingPart)) {
|
if (MessageDecryptVerifier.isPgpMimeSignedPart(currentlyDecrypringOrVerifyingPart)) {
|
||||||
callAsyncDetachedVerify(intent);
|
callAsyncDetachedVerify(intent);
|
||||||
} else {
|
} else {
|
||||||
callAsyncDecrypt(intent);
|
callAsyncDecrypt(intent);
|
||||||
@ -168,7 +168,7 @@ public class MessageCryptoHelper {
|
|||||||
private void callAsyncDetachedVerify(Intent intent) throws IOException, MessagingException {
|
private void callAsyncDetachedVerify(Intent intent) throws IOException, MessagingException {
|
||||||
PipedInputStream pipedInputStream = getPipedInputStreamForSignedData();
|
PipedInputStream pipedInputStream = getPipedInputStreamForSignedData();
|
||||||
|
|
||||||
byte[] signatureData = MessageDecryptVerifyer.getSignatureData(currentlyDecrypringOrVerifyingPart);
|
byte[] signatureData = MessageDecryptVerifier.getSignatureData(currentlyDecrypringOrVerifyingPart);
|
||||||
intent.putExtra(OpenPgpApi.EXTRA_DETACHED_SIGNATURE, signatureData);
|
intent.putExtra(OpenPgpApi.EXTRA_DETACHED_SIGNATURE, signatureData);
|
||||||
|
|
||||||
openPgpApi.executeApiAsync(intent, pipedInputStream, null, new IOpenPgpCallback() {
|
openPgpApi.executeApiAsync(intent, pipedInputStream, null, new IOpenPgpCallback() {
|
||||||
|
Loading…
Reference in New Issue
Block a user