aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain-Test
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-08-16 07:06:07 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-08-16 07:06:07 +0200
commit7c7ba217148d0560744fd417c4e76726df3ffec7 (patch)
tree69725fc408456bcb2dcb2e9367eb70459fe7dd48 /OpenKeychain-Test
parent6e84c728011cebe44c3b2ef6c6cacee64098c16a (diff)
downloadopen-keychain-7c7ba217148d0560744fd417c4e76726df3ffec7.tar.gz
open-keychain-7c7ba217148d0560744fd417c4e76726df3ffec7.tar.bz2
open-keychain-7c7ba217148d0560744fd417c4e76726df3ffec7.zip
tests: add test for master key revocation
Diffstat (limited to 'OpenKeychain-Test')
-rw-r--r--OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java
index 10a42b80f..deec1cf3a 100644
--- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java
+++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperationTest.java
@@ -583,6 +583,31 @@ public class PgpKeyOperationTest {
}
@Test
+ public void testMasterRevoke() throws Exception {
+
+ parcel.reset();
+ parcel.mRevokeSubKeys.add(ring.getMasterKeyId());
+
+ UncachedKeyRing modified = applyModificationWithChecks(parcel, ring, onlyA, onlyB);
+
+ Assert.assertEquals("no extra packets in original", 0, onlyA.size());
+ Assert.assertEquals("exactly one extra packet in modified", 1, onlyB.size());
+
+ Packet p;
+
+ p = new BCPGInputStream(new ByteArrayInputStream(onlyB.get(0).buf)).readPacket();
+ Assert.assertTrue("first new packet must be secret subkey", p instanceof SignaturePacket);
+ Assert.assertEquals("signature type must be subkey binding certificate",
+ PGPSignature.KEY_REVOCATION, ((SignaturePacket) p).getSignatureType());
+ Assert.assertEquals("signature must have been created by master key",
+ ring.getMasterKeyId(), ((SignaturePacket) p).getKeyID());
+
+ Assert.assertTrue("subkey must actually be revoked",
+ modified.getPublicKey().isRevoked());
+
+ }
+
+ @Test
public void testSubkeyRevoke() throws Exception {
long keyId = KeyringTestingHelper.getSubkeyId(ring, 1);