Signature Algorithms: RSA and DSA
17 Dec 2021
§ Motivation
Until now, we have focused on cryptosystems that are used in encrypting and decrypting messages. With signature algorithms, we can post a message publicly along with a digital signature that certifies the authenticity of the message.
§ Hashing Algorithms
One-way Hash Function
A hash function takes an input and generates an output that is typically more efficient, i.e. smaller.
A hash function does not need to be a bijective function, but for a given input it must be difficult to construct a such that . The function must also be difficult to reconstruct the input given the output .
If two inputs map to the same output, we call this a hash collision.
§ RSA Signature Algorithm
The RSA signature algorithm works very similiarly to the cryptosystem.
RSA Signature
Signing: Suppose Samantha wants to sign a message with an RSA signature. Then, Samantha chooses two large primes such that , and she chooses a such that . Next, she computes the multiplicative inverse of , . Now she computes the signaure of her message by computing
she then makes public the signature , the message , and the values and .
Verifying: If Victor wants to validate the authenticity of Samantha's message, all he has to do is compute
if , then Victor can be assured that the message is authentic.
Typically, we use a hashing function on the message and find the signature of the hash, instead of the whole message. The onus is on the verifier to use the same hashing algorithm and compute the hash of the message, then verifying that the signature matches this hash.
§ Digital Signature Algorithm (DSA)
The Digital Signature Algorithm is an alternative to the RSA signature algorithm, and one of its key benefits is that it is generally faster. Like Diffie-Hellman and Elgama, DSA relies on the difficulty of the DLP rather than factorization.
DSA
Signing: Suppose Samantha wants to sign a message with DSA. First, Samantha computes the hash of the document . Then, she chooses two large primes such that , (i.e. is a -bit prime), and for in , , , [^1]. The primes must also satisfy the following congruence
Samantha also chooses an element such that . Given a primitive root , she can choose .
Next, Samantha chooses a secret and computes . Her public signature is composed of the -tuple . Samantha then chooses a random element and computes
Finally, Samantha's signature is given by the pair .
Verifying: Victor begins by computing the values
Next, Victor checks the following congruence
If the congruence holds, the message is certified to be authentic.
By choosing our such that strengthens the DSA. We've discussed Shank's Baby-Step Giant-Step algorithm to solve the DLP when the order of a group element is a prime. It takes memory, where , so using the smallest recommended bit-size of , we can expect around bytes of memory to solve using Shank's.