News for hackers. Stuff that matters.
Re:HTTPS Explained with Carrier Pigeons by nier on Monday January 02, 2023 @08:59AM (#34217862)
There was a video of someone describing cryptography during a lecture with the example of a secret locked by Alice and sent to Bob. Bob has no way of opening Alice’s lock, so they simply add their lock and send it back to Alice. Then Alice removes her lock and sends the secret back to Bob, who now can remove their own lock and access the secret.

What kind of cryptography is that? Does anyone know what lecture that was?

Re:HTTPS Explained with Carrier Pigeons by tiffanyh on Monday January 02, 2023 @09:04AM (#34217911)
Public Key cryptography (e.g., PGP, TLS, SSH)

What you described is the go to illustration used for PKI

https://en.m.wikipedia.org/wiki/Public-key_cryptography

Re:HTTPS Explained with Carrier Pigeons by jagged-chisel on Monday January 02, 2023 @09:17AM (#34218051)
GP's description looks more like DH Key Exchange.

https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Pu...

Re:HTTPS Explained with Carrier Pigeons by tiffanyh on Monday January 02, 2023 @09:39AM (#34218305)
That image is found in the link I shared, with additional detail :)
Re:HTTPS Explained with Carrier Pigeons by jagged-chisel on Monday January 02, 2023 @04:24PM (#34223869)
I sourced it from your link. I disagree that the above commenter is describing "PKI" and is specifically describing "DH Key Exchange" as evidenced by the image linked from the article you referenced.
Re:HTTPS Explained with Carrier Pigeons by Feoj on Monday January 02, 2023 @09:47AM (#34218393)
Not exactly as you describe, but very similar and still a good explanation of simple key exchange is [1]. However I believe (Its a long time since college for me...) Diffie Helman as mentioned elsewhere is a bit more complex [2].

[1] https://www.youtube.com/watch?v=U62S8SchxX4 [2] https://www.youtube.com/watch?v=pa4osob1XOk

Re:HTTPS Explained with Carrier Pigeons by ansc on Monday January 02, 2023 @10:28AM (#34218894)
It's perhaps not exactly what you mean, but the paint example of Diffie-Hellman is pretty neat for coming up with a common secret: https://cdn.comparitech.com/wp-content/uploads/2019/03/diffi...
Re:HTTPS Explained with Carrier Pigeons by dspillett on Monday January 02, 2023 @11:11AM (#34219514)
> What kind of cryptography is that?

It isn't. That is an example where a physical system that would work[‡] does not when applied to mathematics, given as an example where physical world analogies do not translate to useful mathematical methods. It is used as part of the journey towards understanding remote key exchange and public key cryptography, such lectures usually follow the rough pattern:

1. That two-lock physical method is described, which won't work because there is no mathematical operation that can be applied and removed out of sequence like that which is also both not trivial to break/brute-force and doesn't require a pre-shared value which defeats the objective (if you can arrange to securely share that value then you can use that method to share the original secret).

2. But, what about modulo operations? Goes on to show how rotating through a prime modulus might have the same effect, pushing through to explaining a key exchange scheme like DH (where there are pre-shared parameters, but they do not need to be secret). Both parties end up with the same key without ever transmitting it, and can use that to encode the actual message(s).

3. But, key exchange like that, while effective and sufficiently difficult to crack assuming good parameter choices, relies upon both parties being in current contact or the latency is very high as it takes a few back-and-forths to decide the key that will be used to encode the message. What if I want to send a message to you right now, that you can read as soon as you receive it, without having to wait for you to be online so we can derive a secure key first?

4. Goes on to describe the scheme R, S, & A came up with (as did another group in GCHQ a little earlier, but their work was classified for decades so very few knew about it) using public & private key pairs and clever† application of co-prime numbers and modulo arithmetic, and the birth of public key encryption and signing.

--

[‡] ignoring the round-trip latency, and the need for truly indestructible boxes and locks!

[†] it might not seem so genius now as we've known about it for nearly half a century and other schemes are supplanting it, but it is one of those ideas that are relatively obvious once explained but not at all easy to come up with from scratch

Re:HTTPS Explained with Carrier Pigeons by hansvm on Monday January 02, 2023 @02:49PM (#34222732)
> 1. That two-lock physical method is described, which won't work because there is no mathematical operation that can be applied and removed out of sequence like that which is also both not trivial to break/brute-force and doesn't require a pre-shared value which defeats the objective (if you can arrange to securely share that value then you can use that method to share the original secret).

That isn't exactly the issue. The key sharing problem is unavailable in both meat-space and math-space and so is irrelevant in context (it applies just as well to the physical locks). With key sharing not a concern, all you need is for your locks and keys to be commutative. That's easy#1 to do securely.

#1 Basically all "secure" cryptography other than a one-time pad is reducible to a "hard" problem, but last I checked those hard problems may have vulnerabilities we haven't discovered. Nobody has proven any of those techniques actually secure. However, that would be a criticism of all modern cryptography, not just commutative locks.

Re:HTTPS Explained with Carrier Pigeons by hinkley on Monday January 02, 2023 @07:27PM (#34225801)
I think some of the current work on encrypted databases might wander into this territory.

I can't recall if symmetric ciphers are commutative or not. Specifically if:

    f(f(x)) = x 
    g(g(x)) = x
are there cipher systems where

    f(g(f(x))) = g(x)
because that's essentially the problem here. Any other encryption method would require Alice to know Bob's key, or is more easily solved with public key cryptography, where Alice just encodes the secret with Bob's public key and sends it to him.
Re:HTTPS Explained with Carrier Pigeons by kqbx on Monday January 02, 2023 @12:34PM (#34220797)
Sounds like you're describing a three-pass protocol: https://en.wikipedia.org/wiki/Three-pass_protocol

Note that this requires the encryption to be commutative - in the third step Alice has a message in the form e_B(e_A(msg)), where e_B and e_A are Bob's and Alice's encryption functions. Alice must be able to apply her key to obtain e_B(msg), removing the inner encryption. This can be achieved with some modular exponentiation magic.

I don't know of any practical applications of this, probably because it requires both parties to be online at the same time, so they may as well use the simpler Diffie-Hellman key exchange.