Encryption and .ASC Key

Five Stars

Encryption and .ASC Key

Hi,
I am using the tFileEncryptPGP component and am using a public key with an .ASC extension. I get an invalid header encountered message. Is there anything additional I need to install?
java.io.IOException: invalid header encountered
at org.bouncycastle.bcpg.BCPGInputStream.readPacket(Unknown Source)
at org.bouncycastle.openpgp.PGPLiteralData.<init>(Unknown Source)
at org.bouncycastle.openpgp.PGPObjectFactory.nextObject(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyRingCollection.<init>(Unknown Source)
at org.talend.pgp.PGPEncrypt.readPublicKeyFromCol(PGPEncrypt.java:84)
at org.talend.pgp.PGPEncrypt.encryptFile(PGPEncrypt.java:51)
at cornerstone_lms.encrypt_grade_file_1_0.Encrypt_Grade_File.tFileEncryptPGP_1Process(Encrypt_Grade_File.java:236)
at cornerstone_lms.encrypt_grade_file_1_0.Encrypt_Grade_File.runJobInTOS(Encrypt_Grade_File.java:440)
at cornerstone_lms.encrypt_grade_file_1_0.Encrypt_Grade_File.main(Encrypt_Grade_File.java:314)

Thanks in advance.
One Star

Re: Encryption and .ASC Key

Hi
Which version of GnuPG do you use?
Sometimes this is due to previous GPG version.
I test it with gpg4win-2.1.0 and it works fine.
Regards,
Pedro
Five Stars

Re: Encryption and .ASC Key

Hi Pedro,
I am running the same version. Does Talend support the .ASC extension or does it need to have a .GPG extension? It looks like GPG4Win creates a key with a .GPG extension. I have also tried other public keys I have received and I get the same error. Am I missing anything else for setting up Talend to use the encryption component?
Thanks!
One Star

Re: Encryption and .ASC Key

I have been receiving the same error when using a .asc key.  After doing a bit of research I was able to export the .asc (ascii armor) to a binary .gpg file.  I then used the .gpg file to successfully encrypt my file using the tFileEncryptPGP component.
$ gpg --dearmor < filename.txt > filename.bin
Also be sure to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files
Hope this helps anyone else that my run into this issue.