In Chapter 15, we extended the .NET Framework by creating an implementation of the ElGamal algorithm that supported encryption. In this section, we extend our implementation to include support for creating and verifying digital signatures.

We have provided a C# implementation of the ElGamal algorithm only. Like almost all encryption algorithms, ElGamal relies on mathematical operations that are not possible in Visual Basic .NET without creating additional support functions to compensate for the limited numeric support the language provides.

The ElGamal algorithm
supports encryption and digital
signatures using the same key pair. Keys created by following the key
generation protocol (discussed in Chapter 15) can
be used to create and verify digital signatures using the functions
that we explain in this section. As a reminder, the parameters
*p*, *g*, and
*y* form the public key, and the parameter
*x* is the private key.

The basic protocol for creating an ElGamal signature is:

Choose a random number,

*k*, that is relatively prime to (*p*-1).Compute the signature element,

*a*, as follows:*a*=*g*mod^{k}*p*Compute the signature element,

*b*, as follows (*m*is the data to sign):Concatenate

*a*and*b*to form the signature.

To verify an ElGamal signature, we follow the following protocol:

Split the digital signature to form the signature elements, ...

Start Free Trial

No credit card required