All the sites I have been to illustrate how to encrypt data with a recipient. I know this means that you are using the recipient's public key to encrypt the data, encryption that can only be decrypted by the recipient's private key. What I want to know is how do you encrypt data with your private key, encrypted data that can only be decrypted with your public key?

I'm doing all this in GPG, and I've scoured the internet for examples and cheat-sheets and such to no avail.

How is this done?


This is not what I am looking for. I'm pretty sure I know how to sign arbitrary data.

  • "What I want to know is how do you encrypt data with your private key, encrypted data that can only be decrypted with your public key?" - If the data could be decrypted with the public key it means anyone could decrypt the data because the public key is the only key that is shared. If want that to be the case, then share both the public and private key, that way everyone can decrypt the file. – Ramhound Aug 17 '17 at 18:33
  • Do you mean encrypt so only you can decrypt it, with your key (you mean the private key probably). Doesn't using --recipient with your id work? – Xen2050 Aug 23 '17 at 12:21

You don't. As your public key is public, such an operation would be merely a weak, obscure alternative to signing, so it is neither implemented by GnuPG, nor defined by OpenPGP (RFC 4880).

(Besides that, it would also likely be limited to RSA keypairs only.)

| improve this answer | |

I've figured it out. The purpose here would be to encrypt data with your private key so that only people with your public key can decrypt it. I'm implying here that the public key is somewhat a secret between a single person or group of people and the owner of the corresponding private key, but this is not how public key cryptography works; theoretically everyone can have a copy of the public key. This implies that the public key is not a shared secret but public, and therefore there would be no point in encrypting data that anyone and everyone can see; it might as well be unencrypted!

To achieve what I am trying to do we use not asymmetric encryption like public key cryptography, but symmetric cryptography, commonly known as private key cryptography. In symmetric cryptography we encrypt data with a shared secret (a password for example, though any data can be used as the shared secret or passphrase), and this secret is shared amongst a group of individuals. As long as the shared secret is kept secret by only those with said shared secret then only those individuals can encrypt and decrypt data with that shared secret. This is what I was searching for. Unfortunately symmetric encryption does not provide identification and non-repudiation; all you know about the sender of symmetric key encrypted data is that it came from someone whom has the symmetric key, hopefully from a party that rightfully should have the key, that the key is still secret.

If you really want all the qualities of asymmetric cryptography (identification, confidentiality, integrity, non-repudiation) then get a group together and grab each others' public keys and start sending individual messages using each others' public keys. This doesn't work in the way you send bulk messages to multiple recipients like with private key (symmetric) cryptography, but that doesn't really matter when public key cryptography provides many more benefits, and really, is sending multiple messages really that hard?

| improve this answer | |
  • A single message can be encrypted to multiple recipients at once, though... – user1686 Aug 24 '17 at 18:27
  • Yeah, you encrypt with your private key and the multple recipients whom have your public key can decrypt, or are you saying you can encrypt with multiple public keys? – Steve Mucci Aug 25 '17 at 3:45
  • 1
    I'm saying the latter. It's something PGP has supported since day one (search this site for "hybrid" encryption). There is no need for hacks like a public-but-actually-secret key. – user1686 Aug 25 '17 at 4:12
  • Interesting. Linkey for all the folks out there; gnupg.org/gph/en/manual.html#AEN210 – Steve Mucci Aug 25 '17 at 15:08

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.