From a7aaefe4046328698daa6328b3e09defa20aff6b Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 28 Jun 2017 16:17:52 +0200 Subject: [PATCH] fix autocrypt tests (they were still INBOME) --- .../main/java/com/fsck/k9/crypto/AutocryptOperations.java | 8 ++++---- .../java/com/fsck/k9/crypto/AutocryptOperationsTest.java | 6 +++--- .../test/resources/autocrypt/rsa2048-broken-base64.eml | 2 +- .../test/resources/autocrypt/rsa2048-explicit-type.eml | 2 +- k9mail/src/test/resources/autocrypt/rsa2048-simple.eml | 2 +- .../test/resources/autocrypt/rsa2048-unknown-critical.eml | 2 +- .../resources/autocrypt/rsa2048-unknown-non-critical.eml | 2 +- k9mail/src/test/resources/autocrypt/unknown-type.eml | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/crypto/AutocryptOperations.java b/k9mail/src/main/java/com/fsck/k9/crypto/AutocryptOperations.java index 692cd0aba..12b890605 100644 --- a/k9mail/src/main/java/com/fsck/k9/crypto/AutocryptOperations.java +++ b/k9mail/src/main/java/com/fsck/k9/crypto/AutocryptOperations.java @@ -44,7 +44,7 @@ public class AutocryptOperations { } String messageFromAddress = currentMessage.getFrom()[0].getAddress(); - if (!autocryptHeader.to.equalsIgnoreCase(messageFromAddress)) { + if (!autocryptHeader.addr.equalsIgnoreCase(messageFromAddress)) { return false; } @@ -146,13 +146,13 @@ public class AutocryptOperations { @VisibleForTesting class AutocryptHeader { final byte[] keyData; - final String to; + final String addr; final Map parameters; final boolean isPreferEncryptMutual; - private AutocryptHeader(Map parameters, String to, byte[] keyData, boolean isPreferEncryptMutual) { + private AutocryptHeader(Map parameters, String addr, byte[] keyData, boolean isPreferEncryptMutual) { this.parameters = parameters; - this.to = to; + this.addr = addr; this.keyData = keyData; this.isPreferEncryptMutual = isPreferEncryptMutual; } diff --git a/k9mail/src/test/java/com/fsck/k9/crypto/AutocryptOperationsTest.java b/k9mail/src/test/java/com/fsck/k9/crypto/AutocryptOperationsTest.java index af044a219..e9e11981b 100644 --- a/k9mail/src/test/java/com/fsck/k9/crypto/AutocryptOperationsTest.java +++ b/k9mail/src/test/java/com/fsck/k9/crypto/AutocryptOperationsTest.java @@ -59,7 +59,7 @@ public class AutocryptOperationsTest { AutocryptHeader autocryptHeader = autocryptOperations.getValidAutocryptHeader(message); assertNotNull(autocryptHeader); - assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.to); + assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.addr); assertEquals(0, autocryptHeader.parameters.size()); assertEquals(1225, autocryptHeader.keyData.length); } @@ -71,7 +71,7 @@ public class AutocryptOperationsTest { AutocryptHeader autocryptHeader = autocryptOperations.getValidAutocryptHeader(message); assertNotNull(autocryptHeader); - assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.to); + assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.addr); assertEquals(0, autocryptHeader.parameters.size()); } @@ -100,7 +100,7 @@ public class AutocryptOperationsTest { AutocryptHeader autocryptHeader = autocryptOperations.getValidAutocryptHeader(message); assertNotNull(autocryptHeader); - assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.to); + assertEquals("alice@testsuite.autocrypt.org", autocryptHeader.addr); assertEquals(1, autocryptHeader.parameters.size()); assertEquals("ignore", autocryptHeader.parameters.get("_monkey")); } diff --git a/k9mail/src/test/resources/autocrypt/rsa2048-broken-base64.eml b/k9mail/src/test/resources/autocrypt/rsa2048-broken-base64.eml index 0eca32499..e61e7f348 100644 --- a/k9mail/src/test/resources/autocrypt/rsa2048-broken-base64.eml +++ b/k9mail/src/test/resources/autocrypt/rsa2048-broken-base64.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: an INBOME RSA test -INBOME: to=alice@testsuite.autocrypt.org; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; key= m!@#$%hVF+ABCADu17FBUgA3mCemeKbNaBTyWe3VGxjbu7fUyHgdLK7i3tnd7IRtxQy/AEN2t6Vq 0/xeZEAKYRInsHI/HjvmhqPeWFzipk71jRQ02WUY1pZytFjYNIrTdMk4eLYdC1N0go83PU33V4R8 fc2fWHD8N5JPsDH2xOB6WNWkMPxgMbtGIa0QTx7TINhDif4/1/VcrX3wz1gZ6xYI+sujbC54iBZo diff --git a/k9mail/src/test/resources/autocrypt/rsa2048-explicit-type.eml b/k9mail/src/test/resources/autocrypt/rsa2048-explicit-type.eml index c7d8c941c..1a2c1141e 100644 --- a/k9mail/src/test/resources/autocrypt/rsa2048-explicit-type.eml +++ b/k9mail/src/test/resources/autocrypt/rsa2048-explicit-type.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: inbome rsa2048 with correct type -INBOME: to=alice@testsuite.autocrypt.org; type=p; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; type=1; key= mQENBFhVF+ABCADu17FBUgA3mCemeKbNaBTyWe3VGxjbu7fUyHgdLK7i3tnd7IRtxQy/AEN2t6Vq 0/xeZEAKYRInsHI/HjvmhqPeWFzipk71jRQ02WUY1pZytFjYNIrTdMk4eLYdC1N0go83PU33V4R8 fc2fWHD8N5JPsDH2xOB6WNWkMPxgMbtGIa0QTx7TINhDif4/1/VcrX3wz1gZ6xYI+sujbC54iBZo diff --git a/k9mail/src/test/resources/autocrypt/rsa2048-simple.eml b/k9mail/src/test/resources/autocrypt/rsa2048-simple.eml index 96440dbdc..512506209 100644 --- a/k9mail/src/test/resources/autocrypt/rsa2048-simple.eml +++ b/k9mail/src/test/resources/autocrypt/rsa2048-simple.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: an INBOME RSA test -INBOME: to=alice@testsuite.autocrypt.org; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; key= mQENBFhVF+ABCADu17FBUgA3mCemeKbNaBTyWe3VGxjbu7fUyHgdLK7i3tnd7IRtxQy/AEN2t6Vq 0/xeZEAKYRInsHI/HjvmhqPeWFzipk71jRQ02WUY1pZytFjYNIrTdMk4eLYdC1N0go83PU33V4R8 fc2fWHD8N5JPsDH2xOB6WNWkMPxgMbtGIa0QTx7TINhDif4/1/VcrX3wz1gZ6xYI+sujbC54iBZo diff --git a/k9mail/src/test/resources/autocrypt/rsa2048-unknown-critical.eml b/k9mail/src/test/resources/autocrypt/rsa2048-unknown-critical.eml index 32acf0d88..7f06f9e27 100644 --- a/k9mail/src/test/resources/autocrypt/rsa2048-unknown-critical.eml +++ b/k9mail/src/test/resources/autocrypt/rsa2048-unknown-critical.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: another inbome with rsa2048 but with an unknown critical attribute -INBOME: to=alice@testsuite.autocrypt.org; danger=do-not-use; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; danger=do-not-use; key= mQENBFhVGA8BCADK+qTRkAfax0LtJ6RiyxzuAFyIohBTwvtcOM2sd/tRmWq1eyNif5AGDnc1+b6X zJ6l3BXiYM/8qXU/F04UA5BP05SgIqXjqT5I13blrydjKtUbZFchK7lJU7cyDbar+TH70DZURSQm MusCj0+fdx6hx8y4LSOM68rjwVeq7JXAPU78QQsYgMrbtkf5mZWUquDdb7tEoxU+PcNifvtvuHF2 diff --git a/k9mail/src/test/resources/autocrypt/rsa2048-unknown-non-critical.eml b/k9mail/src/test/resources/autocrypt/rsa2048-unknown-non-critical.eml index af1b5d8fa..3d91cc250 100644 --- a/k9mail/src/test/resources/autocrypt/rsa2048-unknown-non-critical.eml +++ b/k9mail/src/test/resources/autocrypt/rsa2048-unknown-non-critical.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: inbome: rsa 2048 with unknown non-critical attribute -INBOME: to=alice@testsuite.autocrypt.org; _monkey=ignore; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; _monkey=ignore; key= mQENBFhVF+ABCADu17FBUgA3mCemeKbNaBTyWe3VGxjbu7fUyHgdLK7i3tnd7IRtxQy/AEN2t6Vq 0/xeZEAKYRInsHI/HjvmhqPeWFzipk71jRQ02WUY1pZytFjYNIrTdMk4eLYdC1N0go83PU33V4R8 fc2fWHD8N5JPsDH2xOB6WNWkMPxgMbtGIa0QTx7TINhDif4/1/VcrX3wz1gZ6xYI+sujbC54iBZo diff --git a/k9mail/src/test/resources/autocrypt/unknown-type.eml b/k9mail/src/test/resources/autocrypt/unknown-type.eml index 7a79a26aa..7b423cfdc 100644 --- a/k9mail/src/test/resources/autocrypt/unknown-type.eml +++ b/k9mail/src/test/resources/autocrypt/unknown-type.eml @@ -1,7 +1,7 @@ From: Alice To: Bob Subject: INBOME with invalid type attribute -INBOME: to=alice@testsuite.autocrypt.org; type=x; key= +Autocrypt: addr=alice@testsuite.autocrypt.org; type=x; key= mQENBFhVGA8BCADK+qTRkAfax0LtJ6RiyxzuAFyIohBTwvtcOM2sd/tRmWq1eyNif5AGDnc1+b6X zJ6l3BXiYM/8qXU/F04UA5BP05SgIqXjqT5I13blrydjKtUbZFchK7lJU7cyDbar+TH70DZURSQm MusCj0+fdx6hx8y4LSOM68rjwVeq7JXAPU78QQsYgMrbtkf5mZWUquDdb7tEoxU+PcNifvtvuHF2