Unable to encrypt file with private/public key
Haritwal, Dhiraj
Dhiraj.Haritwal at ap.sony.com
Thu Dec 18 16:39:35 CET 2014
Hi,
Thanks for your response.
About the below command, it's asking for passphrase whereas my requirement is to use only keys to encrypt/sign it.
gpg2 -u FFEEDDCC -r AABBCCDD -se supersecret.txt
I tried below command which shows confirmation screen where I have entered y (yes) & now able to see a file named supersecret.txt.gpg. m not sure what file it is because it think encrypted file should has an .asc extension.
./gpg --encrypt --hidden-recipient AABBCCDD supersecret.txt
gpg: 89709B71: There is no assurance this key belongs to the named user
Regards,
Dhiraj
-----Original Message-----
From: Gnupg-users [mailto:gnupg-users-bounces at gnupg.org] On Behalf Of Duplicity Mailing List
Sent: 17 December 2014 23:03
To: gnupg-users at gnupg.org
Subject: Re: Unable to encrypt file with private/public key
On 17/12/14 14:43, Haritwal, Dhiraj wrote:
> Hi,
>
>
>
> I am using gpg (GnuPG) 1.4.7 & trying to encrypt a file with private
> key whose public key I have shared to the partner who have to decrypt
> this file. I tried with --armour -symmetric switches which requires a
> passphrase to encrypt but I have requirement to encrypt it through
> private/public key. If I am using -encrypt --hidden-recipient option
> showing below error. I am able to see the public key while running
> -list-keys option. I am running it on AIX 6.1 under root user.
If you just wish to encrypt, not sign, to the user, use:-
>gpg2 --recipient AABBCCDD --encrypt supersecret.txt
Or the shorter version:-
>gpg2 -r AABBCCDD -e supersecret.txt
It will dump supersecret.txt.gpg, that's your encrypted file. This isn't signed (I.E. the receiver won't be able to verify _you_ sent it, and can be replaced (Although not read) in transit). If you wish to sign it, you'll also need a GPG key in your keyring, then run:-
>gpg2 --local-user FFEEDDCC --recipient AABBCCDD --encrypt --sign
supersecret.txt
Or the shorter version:-
>gpg2 -u FFEEDDCC -r AABBCCDD -se supersecret.txt
Where FFEEDDCC is your key identifier and AABBCCDD is the recipient's key identifier. When they decrypt the file, they will see something along the lines of:-
>gpg: Good signature from "John Doe (JohnDoe at Example.com) [ultimate]"
>gpg: binary signature, digest algorithm SHA512
>gpg: decryption okay
the command you're using, --symmetric, is for using a passphrase for encryption/decrypt (I.E. symmetric encryption, not asymmetric).
--hidden-recipient should work too, and is used if you don't wish to include information about the recipient in the gpg file, you probably don't want to use this option (As oppose to --recipient) unless you really do wish to use the features it provides.
As for the failed public key, may I ask the exact command you're running? I get the same error message when I specify a recipient that doesn't exist:-
>$ gpg2 -e -r ${RANDOM} b
>gpg: 31546: skipped: No public key
>gpg: b: encryption failed: No public key
_______________________________________________
Gnupg-users mailing list
Gnupg-users at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users
________________________________
This email is confidential and intended only for the use of the individual or entity named above and may contain information that is privileged. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or telephone and destroy the original message. - This mail is sent via Sony Asia Pacific Mail Gateway..
More information about the Gnupg-users
mailing list