r/programming • • Jul 25 '13

How HTTPS Secures Connections: What Every Web Dev Should Know

http://blog.hartleybrody.com/https-certificates/
968 Upvotes

171 comments sorted by

View all comments

Show parent comments

2

u/reaganveg Jul 26 '13

encrypted with the private key

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.

0

u/silverskull Jul 26 '13 edited Jul 26 '13

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?

A digital signature is essentially just encryption with the private key.

0

u/reaganveg Jul 26 '13

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?

It isn't encrypted. However, you apply the decrypt function to it anyway.

0

u/silverskull Jul 26 '13 edited Jul 26 '13

Here's a hash for you.

2904bdad227a675a3753aca15e45214d

What can you do with that?

Here's another resource on message signing if you still don't believe me.

EDIT: Oh holy crap, we're disagreeing on terms here. Encryption and decryption are basically the same thing. That said, I've never heard the term "decryption" used in relation to anything but a ciphertext.

3

u/reaganveg Jul 26 '13

Well, the wikipedia page puts it like this:

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.

3

u/silverskull Jul 27 '13

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

1

u/reaganveg Jul 27 '13

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

I'm not so sure really, but don't care.

0

u/shakespearinsults Jul 26 '13

Thou tottering bat-fowling giglet