1

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 you@example.com > 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 you@example.com

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 ABC@mail.com test.txt
  • What version of GPG are you using? – Stephen Kitt Nov 16 '16 at 17:19
2

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.

  • 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 '16 at 13:14

Your Answer

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

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