Hi,
I've ran into a problem with the Camel-Crypto pgp DataFormat. It works great with RSA keys, but with DSA/ElGamal keys it fails with the java.security.InvalidKeyException. It does this because the signing DSA key is being used as the private key instead of the ElGamal encryption key. For a test, you can make a simple route that just marshals and unmarshals using PGP format and DSA/ElGamal keys.
I opened
https://issues.apache.org/jira/browse/CAMEL-5475 and have a patch included.
Below is a test case:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:TestGPG-context.xml"})
public class TestGPG {
@Resource
protected CamelContext camel;
@Produce(uri = "direct:test.elgamal")
protected ProducerTemplate myTemplate;
@EndpointInject(uri = "mock:end")
protected MockEndpoint endpoint;
@Before
public void initialize() throws Exception {
camel.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:test.elgamal")
.marshal().pgp("classpath:pubring.gpg","
[hidden email]")
.unmarshal().pgp("classpath:secring.gpg", "
[hidden email]", "password")
.to("mock:end");
}
});
}
@Test
@DirtiesContext
public void testTheirMocksAreValid() throws Exception {
myTemplate.sendBody("file:src/data?fileName=plain_text.txt");
endpoint.assertIsSatisfied();
}
}
Confidentiality Statement: The information (including any attachments)
contained in this communication is only meant for the intended recipient of
the transmission, and may be a confidential or a communication privileged
by law. If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based on
this message or any information herein. If you have received this
communication in error, please re-send this communication to the sender
and delete the original message or any copy of it from your computer
system. Thank You