I’ve been trying to get my head around this and I’ve watched a few videos but they don’t seem to specifically answer my question.

According to what I’ve found online, messages encrypted with a public key can only be decrypted with a private key. But in practice, how is that possible?

Surely a public key contains a set of instructions, and anyone could just run those instructions in reverse to decrypt a message? If everything you need to encrypt a message is stored within a public key, then how is it a one-way process?

It’s likely that I’m misunderstanding a core element of this!

  • friend_of_satan@lemmy.world
    link
    fedilink
    English
    arrow-up
    42
    arrow-down
    2
    ·
    edit-2
    7 months ago

    Public key cryptography is a bit like one of those blue public mailboxes. There is an input slot where anybody can drop something in, but only people with the private key can open the door to get things out. You can’t run that input in reverse because gravity and the mechanics of the slot do not allow that to happen. The same thing exists mathematically for public key cryptography.