@Before public void setUpEncryptorAndDecryptor() { // the following keyring contains a primary key with KeyFlag "Certify" and a subkey for signing // and a subkey for encryption encryptor.setKeyFileName(PUB_KEY_RING_SUBKEYS_FILE_NAME); encryptor.setSignatureKeyFileName("org/apache/camel/component/crypto/secringSubKeys.gpg"); encryptor.setSignaturePassword("Abcd1234"); encryptor.setKeyUserid("keyflag"); encryptor.setSignatureKeyUserid("keyflag"); // the following keyring contains a primary key with KeyFlag "Certify" and a subkey for signing // and a subkey for encryption decryptor.setKeyFileName("org/apache/camel/component/crypto/secringSubKeys.gpg"); decryptor.setSignatureKeyFileName(PUB_KEY_RING_SUBKEYS_FILE_NAME); decryptor.setPassword("Abcd1234"); decryptor.setSignatureKeyUserid("keyflag"); }
@Test public void testExceptionForSignatureVerificationOptionRequired() throws Exception { encryptor.setSignatureKeyUserid(null); // no signature decryptor.setSignatureVerificationOption(PGPDataFormat.SIGNATURE_VERIFICATION_OPTION_REQUIRED); MockEndpoint mock = getMockEndpoint("mock:exception"); mock.expectedMessageCount(1); template.sendBody("direct:subkey", "Test Message"); assertMockEndpointsSatisfied(); checkThrownException( mock, PGPException.class, null, "PGP message does not contain any signatures although a signature is expected"); }