我需要通过PGP技术使用Apache骆驼对文件进行加密并添加签名。 我使用下面的代码片段执行加密和签名,但是它不起作用。
public class EncryptionRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:encryptionRoute").routeId(ENCRYPTION_ROUTE).log("PGP Encryption route started")
.marshal(pgpDataFormat())
.log("Encrypted file is saved to :" + String.format(FILE_COMPONENT, destination))
.to(String.format(FILE_COMPONENT, destination));
}
public PGPDataFormat pgpDataFormat() {
PGPDataFormat encrypt = new PGPDataFormat();
encrypt.setKeyFileName(publickeyFileName);
encrypt.setKeyUserid(keyUserId);
encrypt.setSignatureKeyFileName(privateKey);
encrypt.setPassword(password);
return encrypt;
}
}
}