Encryption 添加骆驼路由以基于文件名进行加密和签名的最佳方法

Encryption 添加骆驼路由以基于文件名进行加密和签名的最佳方法,encryption,apache-camel,sign,pgp,Encryption,Apache Camel,Sign,Pgp,基于文件名前缀,我想用不同的密钥进行PGP加密和签名。我可以使用多个加密路由,并使用。有人知道如何避免多次路由并在路由运行时获得相关的PGP密钥吗 final PGPDataFormat encryptAndSign01 = new PGPDataFormat(); encryptAndSign01.setKeyFileName(conf.pgpPublicKeyFile); encryptAndSign01.setKeyUserid(conf.pgpEncryptUser01); encryp

基于文件名前缀,我想用不同的密钥进行PGP加密和签名。我可以使用多个加密路由,并使用。有人知道如何避免多次路由并在路由运行时获得相关的PGP密钥吗

final PGPDataFormat encryptAndSign01 = new PGPDataFormat();
encryptAndSign01.setKeyFileName(conf.pgpPublicKeyFile);
encryptAndSign01.setKeyUserid(conf.pgpEncryptUser01);
encryptAndSign01.setSignatureKeyFileName(conf.pgpPrivateKeyFile);
encryptAndSign01.setSignatureKeyUserid(conf.pgpSignUser01);
encryptAndSign01.setSignaturePassword(conf.pgpSignUser01Passphrase);

from("encrypt01")
    .marshal(encryptAndSign01)
    .to("file:tmp/output?fileName=${file:name}.pgp");

...

from("file:tmp/output?include=output.*.csv")
    .choice()
        .when(...)
            .to(direct:encrypt01)
        .when(...)
            .to(direct:encrypt02);       

您可以使用消息头指定加密参数,如下所示
但是我认为如果你使用不同的方法来完成这项工作,可能会更容易。

非常感谢你。。。这真的很有帮助。