use of com.google.gerrit.gpg.testutil.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyStoreTest method get.
@Test
public void get() throws Exception {
TestKey key1 = validKeyWithoutExpiration();
tr.branch(REFS_GPG_KEYS).commit().add(keyObjectId(key1.getKeyId()).name(), key1.getPublicKeyArmored()).create();
TestKey key2 = validKeyWithExpiration();
tr.branch(REFS_GPG_KEYS).commit().add(keyObjectId(key2.getKeyId()).name(), key2.getPublicKeyArmored()).create();
assertKeys(key1.getKeyId(), key1);
assertKeys(key2.getKeyId(), key2);
}
use of com.google.gerrit.gpg.testutil.TestKey in project gerrit by GerritCodeReview.
the class PushCertificateCheckerTest method setUp.
@Before
public void setUp() throws Exception {
TestKey key1 = validKeyWithoutExpiration();
TestKey key3 = expiredKey();
repo = new InMemoryRepository(new DfsRepositoryDescription("repo"));
store = new PublicKeyStore(repo);
store.add(key1.getPublicKeyRing());
store.add(key3.getPublicKeyRing());
PersonIdent ident = new PersonIdent("A U Thor", "author@example.com");
CommitBuilder cb = new CommitBuilder();
cb.setAuthor(ident);
cb.setCommitter(ident);
assertEquals(RefUpdate.Result.NEW, store.save(cb));
signedPushConfig = new SignedPushConfig();
signedPushConfig.setCertNonceSeed("sekret");
signedPushConfig.setCertNonceSlopLimit(60 * 24);
checker = newChecker(true);
}
use of com.google.gerrit.gpg.testutil.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyCheckerTest method revokedKeyDueToNoLongerBeingUsedDoesNotRevokeKeyRetroactively.
@Test
public void revokedKeyDueToNoLongerBeingUsedDoesNotRevokeKeyRetroactively() throws Exception {
TestKey k = add(revokedNoLongerUsedKey());
add(validKeyWithoutExpiration());
save();
assertProblems(k, "Key is revoked (retired and no longer valid): test7 not used");
PublicKeyChecker checker = new PublicKeyChecker().setStore(store).setEffectiveTime(parseDate("2010-01-01 12:00:00 -0400"));
assertNoProblems(checker, k);
}
use of com.google.gerrit.gpg.testutil.TestKey in project gerrit by GerritCodeReview.
the class PublicKeyStoreTest method addThenRemove.
@Test
public void addThenRemove() throws Exception {
TestKey key1 = validKeyWithoutExpiration();
store.add(key1.getPublicKeyRing());
store.remove(key1.getPublicKey().getFingerprint());
assertEquals(RefUpdate.Result.NO_CHANGE, store.save(newCommitBuilder()));
assertKeys(key1.getKeyId());
}
use of com.google.gerrit.gpg.testutil.TestKey in project gerrit by GerritCodeReview.
the class PushCertificateCheckerTest method missingKey.
@Test
public void missingKey() throws Exception {
TestKey key2 = validKeyWithExpiration();
PushCertificate cert = newSignedCert(validNonce(), key2);
assertProblems(cert, "No public keys found for key ID " + keyIdToString(key2.getKeyId()));
}
Aggregations