You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Jain, Mayur" <Ma...@T-Mobile.com> on 2022/07/26 21:20:52 UTC

Unable to decrypt file on Linux Command line when encrypted using Camel

Hi Team,

One of our downstream application trying to decrypt a file using PGP/GPG command line tool that we encrypted using Apache Camel. But while decrypting they got error  file marked as for-your-eyes-only. We used "format.setFileName(filename)" to overcome that but still we are not able to decrypt the using command line. It is not giving any error but output file are getting decrypted as expected.

Below is the code we used for encryption. We are using Apache Camel 2.21.0

camelContext.addRoutes(new RouteBuilder() {

  override def configure(): Unit = {
    val format: PGPDataFormat = new PGPDataFormat
    val bytes: Array[Byte]    = publicKey.getBytes()
    val publicKeyRing         = Base64.getDecoder.decode(bytes)
    format.setEncryptionKeyRing(publicKeyRing)
    format.setKeyUserid(keyUserId)
    format.setPassword(passphrase)
    from(
      fromUri
    ).marshal(format)
      .to(toUri)
  }
})

command user to decrypt file :

gpg --decrypt -v --batch --passphrase ********* --output filename_dec.csv filename.csv

We are able decrypt the file again using Apache Camel, But not using GPG or PGP command line. Could you please guide us on what other parameter needs to be set to overcome this issue.

Any help is much apricated.

Regards,
Mayur