I'm setting up a system to update software on a device and I would like to encrypt the update files using a private key that I have created and then decrypt them with the public key. All of the examples that I have found encrypt with the recipients public key, I want to encrypt with my private key. I have seen Bob & Alice examples that use encryption of a file with your private key and then with the recipients public key, but I can't figure out how to do the private key encryption.

  • Do you want to be the only one to be able to decrypt the files ? – Vinz Nov 3 '15 at 19:27
  • Maybe this will help you : crypto.stackexchange.com/questions/2123/… – Vinz Nov 3 '15 at 19:37
  • In my scenario I don't really care if anyone can decrypt the file, although the public key will only be distributed to the systems that need it. What I care about is that I am the only one that can encrypt the file that contains the code updates. I suppose that I can just reverse the definitions in my case, and never disclose the 'public' key and put the 'private' key on the systems to be updated. – GWLindberg Nov 4 '15 at 21:36

This is not the way GPG works.

You encrypt a file with a public key (may be yours), and decrypt it with a private key.

So if you share your public key on the Internet, anyone would be able to encrypt a file with your public key, but you would be the only one able to decrypt it.

See : http://www.dewinter.com/gnupg_howto/english/GPGMiniHowto-1.html

  • I suppose that the function that I'm using the encryption for could be done with signing where the file and the sign are concatenated to one file, as I don't care it anyone sees what the data is, just that it can be verified that I'm the one that generated it. – GWLindberg Nov 4 '15 at 21:40

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.