Partially fix errors when using DummyKeyringModule

This fixes a few problems encountered when building and running according to the Install Guide using the DummyKeyring. It's still failing when trying to parse the JSON credential, which I haven't solved, but before proceeding I wanted to get agreement that it needs to be fixed at all since the best we could do is provide a valid format (as with the PGP keyrings), but the metrics logging will still fail for a different reason (i.e. the credential will not work for the GC project).

Things fixed in this PR:

Fix format string causing MissingFormatArgumentException in FrontendServlet
when keyring fails to load.
Include exception cause in VerifyException in PgpHelper.
Replace dummy PGP keyrings with ones without a password, as code expects.
Document how the PGP keyrings are created.
P.S. I see a tab character snuck into PgpHelper. I'll fix that if you're interested in this PR.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188342973
This commit is contained in:
Hans Ridder 2018-03-08 09:30:46 -08:00 committed by jianglai
parent 00bf8a999f
commit c4f1be4baa
4 changed files with 70 additions and 51 deletions

View file

@ -117,7 +117,7 @@ public final class PgpHelper {
new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider())
.build(new char[0]));
} catch (PGPException e) {
throw new VerifyException(e.getMessage());
throw new VerifyException(String.format("Could not load PGP private key for: %s", query), e);
}
return new PGPKeyPair(publicKey, privateKey);
}