5

In this web page GNU, it says that exporting public key using the command below will generate a public key without the secret key.

gpg --armor --export [email protected] > mykey.asc

If person B will import mykey.asc using gpg, can they use mykey to encrypt a file? Will they not encounter a problem since there is no secret key on myKey?

The command below states that if used the secret keys will be exported. Are they referring to the private key?

gpg --export-secret-keys [email protected]

Update

One of my colleague imported my public key and encrypted a test file using the public key shared but we encountered the error below. Is it because I exported the public key using --export option that doesn't include the private key?

Unexpected error: [gpg: keyblock resource `/usr/local/XXX/services/gnupg/secring.gpg': No such file or directory, gpg: keyblock resource `/usr/local/XXX/services/gnupg/pubring.gpg': No such file or directory, gpg: encrypted with RSA key, ID 2XXXXX16, gpg: decryption failed: No secret key]

command used to encrypt test file

gpg --output test.txt.gpg --encrypt --recipient [email protected] test.txt
1
  • What version of GPG are you using? Nov 16, 2016 at 17:19

1 Answer 1

3

Person B will be able to encrypt using your public key; then you (and only you) will be able to decrypt the encrypted message using your private key.

In the second command, the secret key is indeed the private key. You must never give that to anyone.

1
  • hi stephen thanks for answering, i have updated my question because we encountered an error. can you please provide your feedback? Thanks
    – dimas
    Nov 16, 2016 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .