1
$\begingroup$

My sincerest apologies for having to repost this but I can't edit or post a comment from the previous one I asked with a guest account.

I'm learning about the Diffie-Hellman and ElGamal ciphers, but I'm really struggling trying to decipher the exercise my lecturer has given me.

The information I've been given (all in decimals) is

g

p

a (Alice private key)

A (Alice public key)

B (Bob public key)

C (ciphertext)

I've tried calculating a shared secret S = B^a mod p then inversing it and multiplying that by C as my lecturer described in the lecture but it doesn't work. Is that wrong and if yes what am I supposed to do??

I used this tool to perform the inverse operation (inverseMod(a,b)) http://www.mobilefish.com/services/big_number_equation/big_number_equation.php

$\endgroup$
1
$\begingroup$

You need to further specify your question. The Diffie-Hellmann Key Exchange Protocol is used to establish a secret key over a public channel. After the protocol run, both Alice and Bob have the same key $k_{ab}=A^b=B^a=g^{ab}$.

The El-Gamal system is based on asymmetric cryptography and therefore public keys and secret keys are required. Since the El-Gamal ciphertext consists of two parts $c=(c_1,c_2)$ your description of the decryption function seems to be mixed up. Have a look at the decryption formula of El-Gamal and try to calculate it step by step to understand how the cipher works.

$\endgroup$
  • $\begingroup$ What confuses me is that I am given a decimal value for the ciphertext (C) in the exercise I have to solve. I don't know how to split that into c1 and c2. $\endgroup$ – Kate Mar 19 '17 at 18:17
  • $\begingroup$ @Kate If $C$ has double the length of the other values, there is only one valid way to split it (since both $c_1$ and $c_2$ need to be smaller than the modulus). If it's not, then it is a just a guessing game and you should point that out. "Guess the encoding" is not a cryptographic task. And to make it more blunt: That's just security through obscurity, and should definately not be taught in any cryptography class. Or it was just a mistake. $\endgroup$ – tylo May 17 '17 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.