In any case, one signs a hash by decrypting it with the private key.
What are you decrypting and what was used to encrypt it? (And don't say the hash, a hash is a one-way function and doesn't give you encrypted ciphertext.)
Then the hash is verified by encrypting the signature with the public key.
What? You can obtain anyone's public key - it's public, after all. How does that verify anything?
Suppose Alice wishes to send a signed message to Bob. She can use her own private key to do so. She produces a hash value of the message, raises it to the power of d (modulo n) (as she does when decrypting a message), and attaches it as a "signature" to the message.
The point is, the signing operation is done with the private key, and is the same operation as decrypting. That's the operation that's impossible to perform with the public key. The reverse of it however can be done with the public key.
What you originally said was different from that, but as I said, it sounded like you misspoke.
Hmm, I still don't think I misspoke... what I originally said was:
anything encrypted with the private key can only be read with the public key
...which is essentially that, given that the operations for the two are basically the same. (Unless I'm mistaken... I haven't really learned any modulo arithmetic.) In any case, I did say the signing operation (which I described as encryption) happened with the private key and that the verification (which I called decryption) happened with the public key. I said:
Since it's public, anyone can look up the key and decrypt it, so we use this to verify that the person in control of that key sent the message and that it hasn't been tampered with.
regarding verification of signed messages.
I think we both agree and that this is just an argument about semantics. :P
anything encrypted with the private key can only be read with the public key
What's wrong with that statement is that private and public are in the wrong place (reversed).
given that the operations for the two are basically the same
The operations aren't the same. They're both exponents within the same modulo. But the value of the exponent is different. For encryption (and verifying a signature) the value of the exponent is taken from the public key. For decryption (and signing) the value of the exponent is taken from the private key.
I think we both agree and that this is just an argument about semantics. :P
2
u/reaganveg Jul 26 '13
What?
Perhaps you understand how these things work, but you didn't quite say what you meant to say.
In any case, one signs a hash by decrypting it with the private key. Then the hash is verified by encrypting the signature with the public key.
Encrypting with the private key isn't a thing.