use of com.google.gerrit.gpg.testing.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyStoreTest method getMultiple.
@Test
public void getMultiple() throws Exception {
TestKey key1 = validKeyWithoutExpiration();
TestKey key2 = validKeyWithExpiration();
tr.branch(REFS_GPG_KEYS).commit().add(keyObjectId(key1.getKeyId()).name(), key1.getPublicKeyArmored() + // Mismatched for this key ID, but we can still read it out.
key2.getPublicKeyArmored()).create();
assertKeys(key1.getKeyId(), key1, key2);
}
use of com.google.gerrit.gpg.testing.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyStoreTest method removeMasterKeyRemovesSubkey.
@Test
public void removeMasterKeyRemovesSubkey() throws Exception {
TestKey key1 = validKeyWithoutExpirationWithSubkeyWithExpiration();
PGPPublicKeyRing keyRing = key1.getPublicKeyRing();
store.add(keyRing);
assertEquals(RefUpdate.Result.NEW, store.save(newCommitBuilder()));
long masterKeyId = key1.getKeyId();
long subKeyId = 0;
for (PGPPublicKey key : keyRing) {
if (masterKeyId != subKeyId) {
subKeyId = key.getKeyID();
}
}
store.remove(key1.getPublicKey().getFingerprint());
assertEquals(RefUpdate.Result.FAST_FORWARD, store.save(newCommitBuilder()));
assertKeys(masterKeyId);
assertKeys(subKeyId);
}
use of com.google.gerrit.gpg.testing.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyCheckerTest method keyRevokedByExpiredKeyAfterExpirationIsNotRevoked.
@Test
public void keyRevokedByExpiredKeyAfterExpirationIsNotRevoked() throws Exception {
TestKey k = add(keyRevokedByExpiredKeyAfterExpiration());
add(expiredKey());
save();
PublicKeyChecker checker = new PublicKeyChecker().setStore(store);
assertNoProblems(checker, k);
}
use of com.google.gerrit.gpg.testing.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyCheckerTest method revokedByKeyNotPresentInStore.
@Test
public void revokedByKeyNotPresentInStore() throws Exception {
TestKey k = add(revokedCompromisedKey());
save();
assertProblems(k, "Key is revoked (key material has been compromised): test6 compromised");
}
use of com.google.gerrit.gpg.testing.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyCheckerTest method revokedKeyDueToNoLongerBeingUsed.
@Test
public void revokedKeyDueToNoLongerBeingUsed() throws Exception {
TestKey k = add(revokedNoLongerUsedKey());
add(validKeyWithoutExpiration());
save();
assertProblems(k, "Key is revoked (retired and no longer valid): test7 not used");
}
Aggregations