1

SET UP: - I am trying to decrypt an incoming file through C# code inside a script task in my ssis package. Below is the command that is generated which works just fine when executed through debug mode in visual studio.Also The visual studio is opened using service account credentials.

--homedir C:\Users\serviceaccounntName\AppData\Roaming\gnupg\" --batch --yes --passphrase MyPassphrase -d -o "outputfileName" --always-trust "SourceFileName"

ISSUE: Once run through debug mode, the same also works fine through SQL agent Job. But as soon as i sign out from the Remote desk top where all this is set up , the incoming file does not decrypt anymore through SQl agent job and keeps on executing.I checked the task manager and i can see the pinentry.exe running under service account user. To make it work i kill the tasks and debug a sample file from debug mode which will ask for passphrase and post that even the sql agent job starts working.But as soon as i sign out the same happens again.

I have tried using command without the --homedir option both in script and process task, but the same behavior continues.

Thanks

1 Answer 1

0

Below is what worked finally.

  1. Made sure that a gpg agent session is active. For this I Ran a decryption package manually(debug mode) and entered passphrase.
  2. Ran below two commands from CMD(command prompt). gpg-agent.exe allow-loopback-pinentry gpgconf –kill gpg-agent
  3. I am using the below command in a batch file which is called from my SSIS process task. @echo OURPASSPHRASE|gpg.exe --batch --pinentry-mode=loopback --passphrase-fd 0 -d -o FILEPath\FileName.txt FilePath\FileName.txt.gpg

(All the above was done with service account we use to run our sql jobs.)

referred to this below link https://github.com/carlolars/gnupg2-msys2/issues/1

Thanks Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.