aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain-Test/src/test/java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-02-20 11:04:18 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-02-20 11:04:18 +0100
commit5b017dbf7a0a82c1bcad9649bf9a6361f4b1bcd0 (patch)
tree28678980224277f9c18c305fda146782099c8284 /OpenKeychain-Test/src/test/java
parent9d7e05c06ea485725389768c83eade445f5ecbb5 (diff)
parentbb30cb540123577e87c313f71b460482be3e287c (diff)
downloadopen-keychain-5b017dbf7a0a82c1bcad9649bf9a6361f4b1bcd0.tar.gz
open-keychain-5b017dbf7a0a82c1bcad9649bf9a6361f4b1bcd0.tar.bz2
open-keychain-5b017dbf7a0a82c1bcad9649bf9a6361f4b1bcd0.zip
Merge branch 'development' of github.com:open-keychain/open-keychain into development
Diffstat (limited to 'OpenKeychain-Test/src/test/java')
-rw-r--r--OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
index ba7a31e65..d782230c7 100644
--- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
+++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
@@ -22,6 +22,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.openintents.openpgp.OpenPgpMetadata;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.robolectric.*;
import org.robolectric.shadows.ShadowLog;
@@ -162,6 +163,10 @@ public class PgpEncryptDecryptTest {
Assert.assertArrayEquals("decrypted ciphertext should equal plaintext",
out.toByteArray(), plaintext.getBytes());
Assert.assertNull("signature should be an error", result.getSignatureResult());
+
+ OpenPgpMetadata metadata = result.getDecryptMetadata();
+ Assert.assertEquals("filesize must be correct",
+ out.toByteArray().length, metadata.getOriginalSize());
}
{ // decryption with a bad passphrase should fail
@@ -239,6 +244,11 @@ public class PgpEncryptDecryptTest {
Assert.assertArrayEquals("decrypted ciphertext with provided passphrase should equal plaintext",
out.toByteArray(), plaintext.getBytes());
Assert.assertNull("signature be empty", result.getSignatureResult());
+
+ OpenPgpMetadata metadata = result.getDecryptMetadata();
+ Assert.assertEquals("filesize must be correct",
+ out.toByteArray().length, metadata.getOriginalSize());
+
}
// TODO how to test passphrase cache?
@@ -318,6 +328,10 @@ public class PgpEncryptDecryptTest {
Assert.assertArrayEquals("decrypted ciphertext with cached passphrase should equal plaintext",
out.toByteArray(), plaintext.getBytes());
Assert.assertNull("signature should be empty", result.getSignatureResult());
+
+ OpenPgpMetadata metadata = result.getDecryptMetadata();
+ Assert.assertEquals("filesize must be correct",
+ out.toByteArray().length, metadata.getOriginalSize());
}
{ // decryption with passphrase cached should succeed for the first key
@@ -411,6 +425,10 @@ public class PgpEncryptDecryptTest {
out.toByteArray(), plaintext.getBytes());
Assert.assertEquals("signature should be verified and certified",
OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED, result.getSignatureResult().getStatus());
+
+ OpenPgpMetadata metadata = result.getDecryptMetadata();
+ Assert.assertEquals("filesize must be correct",
+ out.toByteArray().length, metadata.getOriginalSize());
}
{ // decryption with passphrase cached should succeed for the other key if first is gone