diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-15 17:26:41 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-15 17:26:41 +0200 |
commit | 1dafd1b629102180d7e6cb7bb31d1959f1ff6665 (patch) | |
tree | 4640f5119b7cf19219abae0d47462acf214adb79 /OpenKeychain/src/test/java/org/sufficientlysecure | |
parent | 2ceec6ff687cf5b9e40bb3486c53e6445cf9b2f5 (diff) | |
parent | fe0b083bc5fdcd3cd4543945ef22bcec7a2876f4 (diff) | |
download | open-keychain-1dafd1b629102180d7e6cb7bb31d1959f1ff6665.tar.gz open-keychain-1dafd1b629102180d7e6cb7bb31d1959f1ff6665.tar.bz2 open-keychain-1dafd1b629102180d7e6cb7bb31d1959f1ff6665.zip |
Merge pull request #1435 from open-keychain/revocation-on-deletion
Revocation on deletion
Diffstat (limited to 'OpenKeychain/src/test/java/org/sufficientlysecure')
4 files changed, 32 insertions, 20 deletions
diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java index 6984f126e..472e4507a 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/operations/CertifyOperationTest.java @@ -52,6 +52,7 @@ import org.sufficientlysecure.keychain.util.TestingUtils; import java.io.PrintStream; import java.security.Security; import java.util.ArrayList; +import java.util.Date; import java.util.Random; @RunWith(RobolectricGradleTestRunner.class) @@ -158,7 +159,7 @@ public class CertifyOperationTest { CertifyActionsParcel actions = new CertifyActionsParcel(mStaticRing1.getMasterKeyId()); actions.add(new CertifyAction(mStaticRing2.getMasterKeyId(), mStaticRing2.getPublicKey().getUnorderedUserIds())); - CertifyResult result = op.execute(actions, new CryptoInputParcel(mKeyPhrase1)); + CertifyResult result = op.execute(actions, new CryptoInputParcel(new Date(), mKeyPhrase1)); Assert.assertTrue("certification must succeed", result.success()); @@ -186,7 +187,7 @@ public class CertifyOperationTest { CertifyActionsParcel actions = new CertifyActionsParcel(mStaticRing1.getMasterKeyId()); actions.add(new CertifyAction(mStaticRing2.getMasterKeyId(), null, mStaticRing2.getPublicKey().getUnorderedUserAttributes())); - CertifyResult result = op.execute(actions, new CryptoInputParcel(mKeyPhrase1)); + CertifyResult result = op.execute(actions, new CryptoInputParcel(new Date(), mKeyPhrase1)); Assert.assertTrue("certification must succeed", result.success()); @@ -209,7 +210,7 @@ public class CertifyOperationTest { actions.add(new CertifyAction(mStaticRing1.getMasterKeyId(), mStaticRing2.getPublicKey().getUnorderedUserIds())); - CertifyResult result = op.execute(actions, new CryptoInputParcel(mKeyPhrase1)); + CertifyResult result = op.execute(actions, new CryptoInputParcel(new Date(), mKeyPhrase1)); Assert.assertFalse("certification with itself must fail!", result.success()); Assert.assertTrue("error msg must be about self certification", @@ -228,7 +229,8 @@ public class CertifyOperationTest { uids.add("nonexistent"); actions.add(new CertifyAction(1234L, uids)); - CertifyResult result = op.execute(actions, new CryptoInputParcel(mKeyPhrase1)); + CertifyResult result = op.execute(actions, new CryptoInputParcel(new Date(), + mKeyPhrase1)); Assert.assertFalse("certification of nonexistent key must fail", result.success()); Assert.assertTrue("must contain error msg about not found", @@ -240,7 +242,8 @@ public class CertifyOperationTest { actions.add(new CertifyAction(mStaticRing1.getMasterKeyId(), mStaticRing2.getPublicKey().getUnorderedUserIds())); - CertifyResult result = op.execute(actions, new CryptoInputParcel(mKeyPhrase1)); + CertifyResult result = op.execute(actions, new CryptoInputParcel(new Date(), + mKeyPhrase1)); Assert.assertFalse("certification of nonexistent key must fail", result.success()); Assert.assertTrue("must contain error msg about not found", 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 39230df0e..edd7880fc 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/PgpEncryptDecryptTest.java @@ -25,6 +25,7 @@ import java.security.Security; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.Date; import org.junit.Assert; import org.junit.Before; @@ -160,7 +161,8 @@ public class PgpEncryptDecryptTest { b.setSymmetricPassphrase(mPassphrase); b.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); @@ -269,7 +271,8 @@ public class PgpEncryptDecryptTest { input.setEncryptionMasterKeyIds(new long[] { mStaticRing1.getMasterKeyId() }); input.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); @@ -359,7 +362,8 @@ public class PgpEncryptDecryptTest { input.setEncryptionMasterKeyIds(new long[] { mStaticRing1.getMasterKeyId() }); input.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); @@ -393,7 +397,8 @@ public class PgpEncryptDecryptTest { SaveKeyringParcel parcel = new SaveKeyringParcel(mStaticRing1.getMasterKeyId(), mStaticRing1.getFingerprint()); parcel.mRevokeSubKeys.add(KeyringTestingHelper.getSubkeyId(mStaticRing1, 2)); UncachedKeyRing modified = PgpKeyOperationTest.applyModificationWithChecks(parcel, mStaticRing1, - new ArrayList<RawPacket>(), new ArrayList<RawPacket>(), new CryptoInputParcel(mKeyPhrase1)); + new ArrayList<RawPacket>(), new ArrayList<RawPacket>(), + new CryptoInputParcel(new Date(), mKeyPhrase1)); ProviderHelper providerHelper = new ProviderHelper(RuntimeEnvironment.application); providerHelper.saveSecretKeyRing(modified, new ProgressScaler()); @@ -413,7 +418,8 @@ public class PgpEncryptDecryptTest { input.setEncryptionMasterKeyIds(new long[] { mStaticRing1.getMasterKeyId() }); input.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(input, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); @@ -457,7 +463,8 @@ public class PgpEncryptDecryptTest { }); b.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); @@ -575,7 +582,8 @@ public class PgpEncryptDecryptTest { b.setSignatureSubKeyId(KeyringTestingHelper.getSubkeyId(mStaticRing1, 1)); b.setSymmetricEncryptionAlgorithm(PGPEncryptedData.AES_128); - PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(mKeyPhrase1), data, out); + PgpSignEncryptResult result = op.execute(b, + new CryptoInputParcel(new Date(), mKeyPhrase1), data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); @@ -655,7 +663,8 @@ public class PgpEncryptDecryptTest { // this only works with ascii armored output! b.setEnableAsciiArmorOutput(true); b.setCharset("iso-2022-jp"); - PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(), data, out); + PgpSignEncryptResult result = op.execute(b, new CryptoInputParcel(new Date()), + data, out); Assert.assertTrue("encryption must succeed", result.success()); ciphertext = out.toByteArray(); diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java index ad4c1fb75..a0f3b6be6 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringCanonicalizeTest.java @@ -554,7 +554,7 @@ public class UncachedKeyringCanonicalizeTest { CanonicalizedSecretKey masterSecretKey = canonicalized.getSecretKey(); masterSecretKey.unlock(new Passphrase()); PGPPublicKey masterPublicKey = masterSecretKey.getPublicKey(); - CryptoInputParcel cryptoInput = new CryptoInputParcel(); + CryptoInputParcel cryptoInput = new CryptoInputParcel(new Date()); PGPSignature cert = PgpKeyOperation.generateSubkeyBindingSignature( PgpKeyOperation.getSignatureGenerator(masterSecretKey.getSecretKey(), cryptoInput), cryptoInput.getSignatureTime(), diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java index cc5c487bd..6755431d0 100644 --- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java +++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringMergeTest.java @@ -194,11 +194,11 @@ public class UncachedKeyringMergeTest { parcel.reset(); parcel.mAddUserIds.add("flim"); - modifiedA = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); + modifiedA = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); parcel.reset(); parcel.mAddUserIds.add("flam"); - modifiedB = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); + modifiedB = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); } { // merge A into base @@ -235,8 +235,8 @@ public class UncachedKeyringMergeTest { parcel.reset(); parcel.mAddSubKeys.add(new SaveKeyringParcel.SubkeyAdd( Algorithm.RSA, 1024, null, KeyFlags.SIGN_DATA, 0L)); - modifiedA = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); - modifiedB = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); + modifiedA = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); + modifiedB = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); subKeyIdA = KeyringTestingHelper.getSubkeyId(modifiedA, 2); subKeyIdB = KeyringTestingHelper.getSubkeyId(modifiedB, 2); @@ -277,7 +277,7 @@ public class UncachedKeyringMergeTest { parcel.mRevokeSubKeys.add(KeyringTestingHelper.getSubkeyId(ringA, 1)); CanonicalizedSecretKeyRing secretRing = new CanonicalizedSecretKeyRing( ringA.getEncoded(), false, 0); - modified = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); + modified = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); } { @@ -376,7 +376,7 @@ public class UncachedKeyringMergeTest { CanonicalizedSecretKeyRing secretRing = new CanonicalizedSecretKeyRing( ringA.getEncoded(), false, 0); - modified = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Passphrase()), parcel).getRing(); + modified = op.modifySecretKeyRing(secretRing, new CryptoInputParcel(new Date(), new Passphrase()), parcel).getRing(); } { |