如何使用Apache骆驼加密和添加签名

时间:2018-11-25 11:43:21

标签: apache apache-camel spring-camel

我需要通过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;
    }
}
}

0 个答案:

没有答案