I am trying to encrypt and decrypt a file using PGP Encryption/Decryption methodology with Apache Camel.
Further I have installed Kleopatra to generate the private and public keys. Using Kleopatra i have generated my keys successfully. The secret key and public keys are in ".asc" extension.
Below is the piece of code i am using to encrypt the file
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class PGPENC {
public static void main(String[] args) throws Exception {
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
String publicKeyFileName = "file:C:\\Users\\karthick\\Desktop\\PGP\\PGP\\Public_Key.asc";
String keyUserid = "Karthick Sambanghi <karthick88it@gmail.com>";
from("file:C:\\Users\\ITSS\\karthick\\PGP\\PGP\\IN?noop=true;delete=true").marshal()
.pgp(publicKeyFileName, keyUserid).to("file:C:\\Users\\ITSS\\Desktop\\PGP\\PGP\\OUT");
}
});
camelContext.start();
Thread.sleep(5000);
camelContext.stop();
}
}
Here the program executed successfully without any errors but the file is not being encrypted in OUT folder. Is there anyway to check the "camelContext" return statement whether it is success or failure ?
Below are the libraries used currently for executing the program
bcpg-jdk15on-1.52
bcprov-ext-jdk15on-1.57
camel-context-2.22.1
camel-core-2.22.1
camel-crypto-2.19.1
slf4j-api-1.7.25
slf4j-nop-1.7.25