Hi Daniel,

Thanks for response. You are right, I am trying to import key for different 
user from which I have logged in. But the problem is I need to import the key 
for service account user. I do not allow to login. SQL Agent jobs run with this.

I am trying to do this after reading below article:

" gpg: decryption failed: No secret key
I realised that I was being an idiot and that the service account that I was 
running the SQL Agent under did not have the certificate registered under that 
userid. I had only imported the certificate into Kleopatra for the development 
userid I logged in with and not for the service account. I simply imported the 
certificate to the service account profile and then everything worked. This 
meant that the original instructions and code were valid, but I thought I’d put 
this post up in case anyone did the same stupid thing as me. It’s worth 
remembering that the certificates are by default imported at a user level into 
Kleopatra. "


Article link: 
http://globalgoat.com/2012/03/13/create-automated-pgp-task-in-ssis-using-gnupg/

Thanks & Regards,

Pankaj K Chaurasia
Sr. Database Developer
Smart Utility Systems
0120-4208528 (O)  |  +91- 8109510013 (M) |  +91- 9406929510 (M)
pankaj.chaura...@smartusys.com  | www.smartusys.com 



  

This message may contain confidential and/or privileged information. If you are 
not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose or take any action based on this message or any information 
herein. If you have received this message in error, please advise the sender 
immediately by reply e-mail and delete this message. Thank you for your 
cooperation.
 Please consider the environment before printing this email.

-----Original Message-----
From: Daniel Kahn Gillmor [mailto:d...@fifthhorseman.net] 
Sent: Monday, March 20, 2017 8:52 PM
To: Pankaj Kumar. Chaurasia; gnupg-users@gnupg.org
Subject: Re: Need Help.

On Mon 2017-03-20 06:57:18 -0400, Pankaj Kumar. Chaurasia wrote:
> Does anyone know how to import a public key for a server account.
>
> I tried below one, but it is not working:
>
> Gpg2 -import -u NT\MSSQLAgent e:\MyPub.gpg

Usually --import needs two leading hyphens, not one.

it's not clear to me what "NT\MSSQLAgent" is supposed to mean -- the -u flag is 
to identify an OpenPGP User ID, which isn't relevant for the --import operation.

It looks like you're trying to use it to switch user accounts, which GnuPG 
won't do.  You'll need to use your operating system's mechanism to switch user 
accounts first, and then run gpg from the other user.  In Windows (which it 
looks like you're using) that'd be "Run as…" or something like that.

          --dkg
_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to