1
$\begingroup$

I read about elgamal algorithm it work like the follow steps

  1. Bashir chooses a large random prime p and a primitive root α modulo p.
  2. Bashir then chooses a random integer a with 2 ≤ a < p - 1 and computes α^a mod p.
  3. Bashir’s public key is (p,α,α^a) and his private session key is a.

Enciphering stage consists of the following steps:

  1. Amina obtains Bashir’s public key (p,α,α^a).
  2. She chooses a random natural number b < p - 1.
  3. She computes α^b mod p and mα^ab mod p.
  4. Amina then sends the cipher text c = (α^b,mα^ab) to Bashir.

Deciphering stage consists of the following steps:

  1. Bashir uses his private key to compute (α^b )^(-a) mod p.

  2. Then he deciphers m by computing (α^b )^(-a) .mα^ab mod p.

    I understood this algorithm but I have Wondered simple

Imagine that we have a message consists of four parts (block data) and want Amina encrypted and sent to Bashir.

Is Amina used the same Private Key (b) Of four parts or generate a new private key for each part of the message During the session encryption.

$\endgroup$

1 Answer 1

1
$\begingroup$

I never thought Alice and Bob would get international counterparts. Anyway, in reading your question I've spotted some issues.

  1. Bashir generates a public and a private key. The private key you call a private session key, which is a bit confusing and may lead to errors like the one below.
  2. In order for Amina to encrypt something for Bashir, she has to use Bashir's public key and also generate another value, (b), which is called the ephemeral key or session key, hence the confusion I mention above.

To answer your question: Amina has to generate a new ephemeral key (b) for each message. If she uses the same key for all messages, and two messages happen to be the same, the corresponding ciphertexts will be the same as well. Moreover if someone gets his hands on a plaintext, he can figure out the ephemeral key and seriously compromise all the messages encrypted with the same ephemeral key. Therefore Amina must generate a new ephemeral key every time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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