aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-11-19 14:00:17 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-11-19 14:00:17 +0100
commit2fe508c60e51693b383481d6e626ccada85313f5 (patch)
tree9182ab2a5ecf272c02659bd5bd2dc999470e6b2a /OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
parent62918c571899855bc4a16a77c9f423ff24c7d036 (diff)
parentd4c121c2aff58fc193c4d715f4475d388b6de91e (diff)
downloadopen-keychain-2fe508c60e51693b383481d6e626ccada85313f5.tar.gz
open-keychain-2fe508c60e51693b383481d6e626ccada85313f5.tar.bz2
open-keychain-2fe508c60e51693b383481d6e626ccada85313f5.zip
Merge branch 'master' of github.com:open-keychain/open-keychain
Diffstat (limited to 'OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java')
-rw-r--r--OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
index d3c3f1df5..47c7a20ea 100644
--- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
+++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java
@@ -556,7 +556,7 @@ public class PgpEncryptDecryptTest {
}
@Test
- public void testAsymmetricMultiSubkeyEncrypt() throws Exception {
+ public void testMultiSubkeyEncryptSkipStripOrBadFlag() throws Exception {
String plaintext = "dies ist ein plaintext ☭" + TestingUtils.genPassphrase(true);
@@ -610,7 +610,8 @@ public class PgpEncryptDecryptTest {
{ // strip first encrypted subkey, decryption should skip it
- SaveKeyringParcel parcel = new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint());
+ SaveKeyringParcel parcel =
+ new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint());
parcel.mChangeSubKeys.add(new SubkeyChange(encKeyId1, true, false));
UncachedKeyRing modified = PgpKeyOperationTest.applyModificationWithChecks(parcel, mStaticRing1,
new ArrayList<RawPacket>(), new ArrayList<RawPacket>(),
@@ -631,8 +632,9 @@ public class PgpEncryptDecryptTest {
{ // change flags of second encrypted subkey, decryption should skip it
- SaveKeyringParcel parcel = new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint());
- parcel.mChangeSubKeys.add(new SubkeyChange(encKeyId1, PGPKeyFlags.CAN_CERTIFY, null));
+ SaveKeyringParcel parcel =
+ new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint());
+ parcel.mChangeSubKeys.add(new SubkeyChange(encKeyId1, KeyFlags.CERTIFY_OTHER, null));
UncachedKeyRing modified = PgpKeyOperationTest.applyModificationWithChecks(parcel, mStaticRing1,
new ArrayList<RawPacket>(), new ArrayList<RawPacket>(),
new CryptoInputParcel(new Date(), mKeyPhrase1));
@@ -650,6 +652,13 @@ public class PgpEncryptDecryptTest {
result.getLog().containsType(LogType.MSG_DC_ASKIP_BAD_FLAGS));
}
+ }
+
+ @Test
+ public void testMultiSubkeyEncryptSkipRevoked() throws Exception {
+
+ String plaintext = "dies ist ein plaintext ☭" + TestingUtils.genPassphrase(true);
+
{ // revoke first encryption subkey of keyring in database
SaveKeyringParcel parcel = new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint());
parcel.mRevokeSubKeys.add(KeyringTestingHelper.getSubkeyId(mStaticRing1, 2));
@@ -679,7 +688,7 @@ public class PgpEncryptDecryptTest {
data, out);
Assert.assertTrue("encryption must succeed", result.success());
- ciphertext = out.toByteArray();
+ byte[] ciphertext = out.toByteArray();
Iterator<RawPacket> packets = KeyringTestingHelper.parseKeyring(ciphertext);