Infrequently Asked Questions: "A Problem of Encryption"
- 6 minutes read - 1120 wordsSo my Dad emailed the other day. He’d been thinking about encryption, and had a couple of questions for me. I won’t publish the whole email, as it’s a bit lengthy, but essentially he proposed a new encryption scheme. I’ve translated as best I can how his proposed scheme works, and I’ll note any fixes once I’ve checked the article with him.
He noted that there are two common issues with encryption — key distribution, and key re-use. Rightly, he notes that the more messages you encrypt with the same key, the more data there is to mount an attack on the key. To avoid this problem, you should use a different key each time. This kind of scheme is known as a “one-time pad”. As each message uses a different key, there’s no way to combine messages, as above.
However, distributing one-time pads is difficult — the “key distribution problem”. To avoid that, his idea was to use PKI public key pairs as one time keys. His scheme worked like this, for a case where Alice wishes to send a message to Bob:
- Alice notifies Bob that she has a message for him;
- Bob generates a new public key pair, and sends the public key to Alice;
- Alice encrypts the message using the public key from Bob, and sends it to Bob;
- Bob decrypts the message using the private key from the key pair;
- Alice and Bob delete the key pairs to prevent re-use;
Of course, he asserts that part of the security of this arrangement is that Eve (the eavesdropper) wouldn’t know that different key pairs are in use each time, and so would try to combine the messages to attack the key, not realising that this attack cannot work, because each message is encrypted with a different key.
So, where to begin?
Well, if you’re not sure what PKI is, or what the key pairs are, please see Wikipedia’s excellent discussion of the topic. If not, then all you need to know is that a key pair has two parts, a private key and a public key. Both Alice and Bob generate their own key pairs. Alice and Bob then exchange public keys. Anything encrypted with a public key can only be decrypted with a private key, and vice versa.
Well, at first blush, this scheme is not completely bonkers{rel=“nofollow”}. However, it’s also not entirely congruent with the way this stuff normally works.
Generating key pairs doesn’t take that long — I generated a 2048-bit key pair in about 0.655 seconds on my laptop, and a 4096-bit one in 3.2 seconds. These are certainly strong enough to use, and so creating a new 4096-bit key pair for each message interchange is certainly plausible. So that doesn’t cause the system to fail.
The overall process seems fine — Alice and Bob are using secure crypto to exchange messages, not re-using keys, and so on. However, they are encrypting everything using public key crypto. Public key crypto is very slow, compared to normal symmetric cyphers (one where the same key is used to encrypt and decrypt the message). Having said that, it’s only computer power, so even that’s not a showstopper, unless they’re exchanging vast messages.
One issue is that we normally assume that Eve does know the algorithm in use. Certainly, since Eve can see each message that Alice and Bob exchange, Eve will see the key pairs going from Bob to Alice, and thus can figure out that something is happening here. Concealing the key pairs is left as an exercise for the reader.
So, how to overcome this issue?
As I dimly remember from the last time I worked on encrypted email systems, the way the process works is more like this:
- Alice chooses a one-time session key — this will only be used once;
- Alice encrypts the one time session key with her private key, then encrypts the result of this with Bob’s public key, and calls the result of this H;
- Alice uses the one-time session key to encrypt the content of her message, and calls this T;
- Alice sends both encrypted blocks H and T to Bob;
- Bob unwraps the encryption on H and gets the session key;
- Bob uses the session key to decrypt the message;
- Alice and Bob discard the session key;
This hybrid scheme uses PKI to get over the key distribution problem, and symmetric cyphers to get over the speed issue.
Let’s compare the two schemes. First, both schemes transmit each message with a unique key, used only once for that communication, and never used again. Thus, both systems effectively use a one-time pad. So, even so far.
In the first scheme, Bob knows the message comes from Alice because he can decrypt it with the private key corresponding to the public key he sent her. Alice knows that only Bob can read the message, because the only key that will decrypt it is the private key corresponding to the public key she used to encrypt it. In the second scheme, Alice knows Bob is the only person that can obtain the session key, and Bob knows that Alice is the only person who could have provided the session key. As such, even again so far.
However, here’s where it all goes wrong. Dad’s scheme has no plausible deniability. Let’s assume that Eve sees only this one message from Alice to Bob. In the standard scheme, one encrypted message goes from Alice to Bob. There is no initial comms from Bob. If Eve, as an agent of government, kicks Bob’s door in and hauls him off for interrogation, Bob can deny all knowledge. He can plausibly claim that Alice, using only his public key, created a message for him and sent it. He can deny collusion or conspiracy, because he never communicated with Alice before this message arrived. He could even claim that the message is useless to him, because it’s encrypted with a public key that isn’t his (as there’s no proof of him having it) and thus that he can’t even decrypt the message. Thus, he can plausibly deny the message, and in the absence of any other evidence, is home free.
By contrast, Dad’s scheme lacks this. Eve can produce as evidence Alice’s message requesting a key, and Bob’s reply with the public key of his new key pair. Eve then has evidence of active collusion between Alice and Bob. Bob can’t plausibly deny having the private key needed to decrypt the message, as it’s the other half of the key pair. Thus, conspiracy between Alice and Bob cannot be denied.
And that’s why you shouldn’t use that scheme.
Comments? Mistakes? Typos? Leave a comment below.