2
$\begingroup$

I'm new to asymmetric encryption guys, I read about it thoroughly lately and I don't get one thing.

If, say, I have a message, I sign it by first hashing the message, then encrypting it with my private key. After that I publish message and signature together. Then if anyone wants to check it, they have to decrypt it with my public key and compare the hash.

My question is: how do they know my public key?

If I send it with message - then anyone can forge it by altering the message, replacing the open key and making a new valid signature. Or maybe it can be requested from me? If yes, then what if someone interrupts that request and replace my public key in response with theirs fake one?

One more thing: what if the public key is not available? For example if there is a system were each node can broadcast its public key - what if some of the nodes are offline for weeks - does it mean their signatures can not be verified? Maybe their public keys are saved on some kind of centralized database, where you could request my public key by, say, my email. But this database can be hacked and public key will be replaced by a fake one - and nobody will trust my signatures anymore.

You see, maybe I don't get some particular subtle moment here - an issue of how to trust a genuine public key in any given network system, given that hacker may somehow interrupt any connection and replace messages between nodes (or if it's a centralized DB - public keys may be replaced by hacker).

$\endgroup$
1
  • 3
    $\begingroup$ FYI, signature schemes are not built out of ‘encrypting with the private key’, and verifying is not a decryption operation. Each signature scheme has a signing operation that takes a private key and a message, and yields a signature that the verifier will accept given the same message and corresponding public key. Any signature scheme whose signing operation looks like it ‘encrypts message with private key’ using a public-key encryption scheme is probably horrifically broken ‘textbook RSA’. $\endgroup$ Dec 23, 2017 at 22:19

1 Answer 1

5
$\begingroup$

A public key ultimately needs to be securely exchanged out of band to fulfill the commitment part of the signature process.

Typically the public key is pre-distributed where it needs to be used. As an example, your web browser comes pre-installed with the public keys it needs to validate certificates signed by certificate authorities. This can be used to obtain new public keys that are not pre-installed.

You are probably looking for Public Key Infrastructure (PKI).

$\endgroup$
3
  • $\begingroup$ Ok, I see, it can be done in a centralized manner. But how is it done in cryptocurrencies? A wallet has a private key and a public key. Where the public key is stored and how the community of this peer-to-peer system can make sure that this particular public key is genuine and belongs to this particular wallet? $\endgroup$
    – shal
    Dec 24, 2017 at 22:00
  • $\begingroup$ Oh, my friend told me now how they do it. The solution is perfect: a wallet address is a hash of a public key! This is how it can be easily proved that the key belongs to the wallet! And no certificates are needed $\endgroup$
    – shal
    Dec 24, 2017 at 22:09
  • $\begingroup$ @shal I am thinking that you might need to ask that as a separate question by itself, or make an edit to this question to make it clear that you want to know how the effect is accomplished in the blockchain setting. Edit: Oh, well it appears you found your answer. $\endgroup$
    – Ella Rose
    Dec 24, 2017 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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