0

How to make imported public key available after logging off? I have a Powershell process that encrypts the file (recipient was masked):

Start-Process "gpg.exe" -ArgumentList "--batch --yes --always-trust --recipient 3******D --log-file l.txt --encrypt $fileToSend" -Wait -NoNewWindow

That key was imported using the service account I logged as (same as my SQL Server and SQL Agent's account). It was set to trust = 5 and saved. It works perfectly fine in SQL Server Integration Services (SSIS) only if I'm interactively logged on the server with the same account that my SQL Agent is running. If I log off from the server, the job starts to fail:

2019-09-16 09:01:20 gpg[11268] 3******D: skipped: No public key
2019-09-16 09:01:20 gpg[11268] D:\\***MyPath***.txt: encryption failed: No public key

When I log on using Remote Desktop Connection again and I start the job, it works fine again. This is like the public key is visible only if the account is interactively logged in, but not available when the account is non-interactively used by SQL Agent / SSIS. I have repeated the process many times to confirm it. Any thoughts how to make it working without forcing me to RDC?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.