In the bitcoin-qt client you can sign and verify messages using only the public address. Since the public address is a RIPEMD160 hash how is it possible that I can verify a signature since I do not have access to the public key?
3 Answers
When signing a message (as opposed to signing a transaction), the signature contains additional information needed to recover the public key using the signature and the signed message. The recovered public key is then hashed and the result compared to the address. If they match, the message was signed by that address.
It is possible to recover the public key from the signed message and the signature. This public key can than be hashed and compared to the hashed public key you already have.
So you don't really "verify the signature with the public key*, because you don't need to have it beforehand to verify the signature. What you do is calculate the public key that corresponds to the private key with which the signature has been created.
Actually messages are signed using the private key and verified using the public key. If you'd be able to sign and verify only with the public key, that wouldn't make sense and it wouldn't stop anybody from reading your messages and signing them with your public key, which as the name states, is public.
-
When I said "using only the public address" my intention was to say, verified with only the public address which is a hash. Anyways, I found the answer elseware: it looks like you can extract a public key from certain signature encodings. This public key then can be used both to verify the signature and to verify the address hash. bitcointalk.org/index.php?topic=6430.0– e1000Dec 21, 2013 at 22:10
-
Maybe post that as an answer to your own question, rather than a comment. It's correct. Jan 20, 2014 at 19:24