1

I have a file with pgp encryption. I want to decrypt the file using SSIS. Whenever I run the package it prompts me to enter passphrase. How can I bypass this?

I'm using execute process task to run the decrypt command from command prompt.

\C echo XXXXXXXXX|gpg --keyring "\\LSRSQL08\Share\DataServices_Key\public.pgp" --secret-keyring "\\LSRSQL08\Share\DataServices_Key\private.pgp" --batch --yes --passphrase-fd 0 -o \\LSRSQL08\Share\WorkingFolders\ACXM\DataLoad\Razor_FEB21_Install.txt -d \\LSRSQL08\Share\WorkingFolders\ACXM\Razor_FEB21_Install.txt.pgp

I have extracted public and private key like below:

gpg --output public.pgp --armor --export DataServices@company.com
gpg --output private.pgp --armor --export-secret-key DataServices@company.com
Jay Desai
  • 821
  • 3
  • 15
  • 42
  • 1
    See if [this answer](https://stackoverflow.com/a/50334044/8408335) applies. – vhoang Jan 29 '21 at 20:50
  • @vhoang, `--pinentry-mode=loopback --passphrase XXXXXX -o \\LSRSQL08\Share\WorkingFolders\ACXM\DataLoad\Razor_FEB21_Install.txt -d \\LSRSQL08\Share\WorkingFolders\ACXM\DataLoad\Razor_FEB21_Install.txt.pgp` is working fine from VS/ CMD/ GPG. However, when I run same package from SSISDB Catalog or SQL Server Agent Job it fails on decrypting part. It runs for 4-5 minutes and fails eventually. Looks like it is popping up passphrase windows in backend. – Jay Desai Jan 29 '21 at 22:24

1 Answers1

0

Below command worked for me. Just we need to make sure that we import the key in same account under which SSIS package will be running.

--pinentry-mode=loopback --passphrase XXXXXX  -o \\LSRSQL08\Share\WorkingFolders\ACXM\DataLoad\Razor_FEB21_Install.txt -d \\LSRSQL08\Share\WorkingFolders\ACXM\DataLoad\Razor_FEB21_Install.txt.pgp
Jay Desai
  • 821
  • 3
  • 15
  • 42