Digital Signatures
Slide deck 15. Signature model, requirements, ElGamal, DSA and DSS sign/verify formulas.
What are Digital Signatures? - ComputerphileComputerphile · what digital signatures prove and how they work, 10 min
Digital Signatures: The Elgamal Signature schemeThe Random Professor · the ElGamal signature scheme, 9 min
Elgamal Digital Signature ExampleThe Random Professor · a worked ElGamal signature example, 5 min
Digital Signature Algorithm (DSA) explained with example - Daniel's Security AcademyDaniel's Security Academy · DSA key generation, signing and verification with an example, 25 minSignature basicsSearch on YouTube
Why digital signaturesSearch on YouTube
Message authentication protects a message against changes and a false origin. But it does not address the lack of trust between the two parties. Digital signatures give the ability to:
- Verify the author, the date and the time of the signature.
- Authenticate the message contents.
- Be verified by third parties to resolve disputes.
Thus a digital signature includes the authentication function, with additional capabilities.
Signature modelSearch on YouTube
The slides show two figures of the model. Bob signs a message , and Alice verifies it.
- Generation: Bob puts and his private key into the digital signature generation algorithm. The output is Bob's signature for .
- Transmission: Bob sends together with .
- Verification: Alice puts , and Bob's public key into the verification algorithm. The algorithm returns "signature valid" or "not valid".
The second figure shows the inside of the two algorithms:
- Bob hashes to get , and encrypts with his private key. The result is .
- Alice hashes the received to get .
- Alice decrypts with Bob's public key to get .
- Alice compares and . If they are equal, the signature is valid.
A signature is like a wax seal with a unique pattern. Anyone can see and check the pattern. Only the owner of the stamp can make it.
RequirementsSearch on YouTube
- The signature must depend on the message that is signed.
- It must use information unique to the sender, to prevent both forgery and denial.
- It must be relatively easy to produce.
- It must be relatively easy to recognize and verify.
- It must be computationally infeasible to forge:
- with a new message for an existing digital signature, or
- with a fraudulent digital signature for a given message.
- It must be practical to save the digital signature in storage.
Requirements 1 and 2 work together. If a signature does not depend on the message, an attacker can copy it to a different message. If it does not use sender-unique information, anyone can make it.
Direct digital signaturesSearch on YouTube
Direct signatures involve only the sender and the receiver. We assume that the receiver has the sender's public key.
- The sender makes the signature. The sender signs the entire message, or its hash, with the sender's private key.
- The sender can encrypt the message and the signature with the receiver's public key.
- Always sign first, then encrypt the message and the signature. The receiver decrypts first, then verifies the signature.
- The security depends on the sender's private key.
If the sender's private key is lost or stolen, an attacker can sign in the sender's name. Also, the sender can claim that the key was stolen and deny a valid signature.
ElGamal signaturesSearch on YouTube
KeysSearch on YouTube
The ElGamal signature is a signature variant of ElGamal, related to Diffie-Hellman (D-H).
- It uses exponentiation in a finite (Galois) field.
- Its security is based on the difficulty of computing discrete logarithms, as in D-H.
- The global elements are a prime number and , a primitive root of .
- It uses the private key for encryption (signing) and the public key for decryption (verification).
| Phase | Computation | Conditions |
|---|---|---|
| Global parameters | Prime and , a primitive root of | Known to all users |
| Private key of user A | ||
| Public key of user A | Published |
SigningSearch on YouTube
Alice signs a message to Bob:
- Compute the hash , with .
- Choose a random integer with and .
- Compute the temporary key .
- Compute , the inverse of mod .
- Compute .
- The signature is the pair .
uses only the random . mixes the hash, the private key and . Use a new for each message. If two messages use the same , an observer can calculate .
VerificationSearch on YouTube
Any user B can verify the signature with public values only:
The signature is valid if .
Proof. With and :
Also modulo . Thus .
Worked exampleSearch on YouTube
The slide example uses the field : and .
| Step | Slide value | Formula |
|---|---|---|
| Alice chooses private key | ||
| Alice computes public key | ||
| Message hash | ||
| Random key | ||
| Temporary key | ||
| Inverse of | ||
| Second part | ||
| Signature |
Verification by any user B:
| Verification part | Value |
|---|---|
| The signature is valid |
ElGamal signing order: Hash, pick K, S, Invert , S (H-K-S-I-S). Verification compares with .
DSS and DSASearch on YouTube
The standardSearch on YouTube
- The Digital Signature Standard (DSS) is a US government approved signature scheme.
- NIST and NSA designed it in the early 1990s.
- The slides say that it was published as FIPS 186 in 1991 and revised in 1993, 1996 and then 2000.
- It uses the SHA hash algorithm.
- DSS is the standard. DSA is the algorithm.
- FIPS 186-2 (2000) includes alternative RSA and elliptic curve signature variants.
- DSA is a public-key technique for digital signatures only, unlike RSA.
Do not use DSS and DSA as the same term. DSS is the standard document (FIPS 186). DSA is the signature algorithm in that standard.
DSA propertiesSearch on YouTube
- DSA creates a 320-bit signature, in two 160-bit parts and .
- It is smaller and faster than RSA.
- It is a digital signature scheme only. It gives no encryption or key exchange.
- Its security depends on the difficulty of computing discrete logarithms.
- It is a variant of the ElGamal and Schnorr schemes.
DSS versus RSASearch on YouTube
| (a) RSA approach | (b) DSS approach | |
|---|---|---|
| Signing | Hash , then encrypt the hash with : | Function Sig takes , a random , the global public key and |
| Sent | and | and the pair |
| Verifying | Decrypt the signature with and compare it with a new | Function Ver takes , , , and . Its output is compared with |
In the RSA approach, decryption gives back the hash. In the DSS approach, verification gives no hash. It gives a value that must equal .
DSA algorithmSearch on YouTube
Key generationSearch on YouTube
The shared global public key values are . Each user also has a private key and a public key .
| Value | How to choose | Constraint |
|---|---|---|
| A prime number | 160-bit prime | |
| A large prime | , with to bits and a multiple of | |
| and | is a 160-bit prime divisor of | |
| and | ||
| Random private key | ||
| Public key |
The value has order modulo . The condition prevents .
Signature creationSearch on YouTube
To sign a message , the sender:
- Generates a random signature key , with . The key must be random, must be destroyed after use and must never be reused.
- Computes the signature pair:
- Sends the signature with the message .
Never reuse . Two signatures with the same have the same . From the two values, an attacker can calculate and then the private key . The same rule applies to in ElGamal.
Signature verificationSearch on YouTube
The recipient receives and the signature . To verify the signature, the recipient computes:
If , the signature is verified. The slides refer to Appendix A for the proof.
Verification builds again from public values. Because and :
Then , reduced mod , gives .
DSS overviewSearch on YouTube
The DSS overview figure shows signing with two functions and verifying with two functions. The received values are , and .
| Function | Side | Inputs |
|---|---|---|
| (compute ) | Signing | , , private key , , |
| (compute ) | Signing | and the public , , |
| (compute ) | Verifying | and |
| (compute ) | Verifying | Public key , , , , , |
Finally, the verifier compares with .
DSA verification order: w, , , v. Invert to get . Multiply by the hash and by . Do one combined exponentiation to get . Accept if .
Quick self-testSearch on YouTube
What three capabilities do digital signatures add to message authentication?
They verify the author, date and time of the signature. They authenticate the message contents. Third parties can verify them to resolve disputes.
List the six digital signature requirements from the slides.
Depend on the message. Use information unique to the sender, to prevent forgery and denial. Be relatively easy to produce. Be relatively easy to recognize and verify. Be computationally infeasible to forge, with a new message or with a fraudulent signature. Be practical to save in storage.
In a direct digital signature, in which order do you sign and encrypt?
Sign first, then encrypt the message and the signature with the receiver's public key. The receiver decrypts first, then verifies. The security depends on the sender's private key.
Describe the inside of the digital signature model.
Bob hashes to and encrypts with his private key to get . Alice hashes the received to get . She decrypts with Bob's public key to get . If , the signature is valid.
Give the ElGamal signing and verification formulas.
Signing: , choose with , then and . Verification: and . The signature is valid if .
Do the slide example: GF(19), , , , .
Key: . Signing: , , . The signature is . Verification: and . Thus the signature is valid.
DSS or DSA: which is the standard and which is the algorithm?
DSS is the standard, FIPS 186 (1991 on the slides), revised in 1993, 1996 and 2000. DSA is the algorithm. FIPS 186-2 (2000) also includes RSA and elliptic curve variants. DSS uses SHA.
Give the DSA global parameters and user keys, with the size constraints.
is a 160-bit prime divisor of . is a large prime with , where to and is a multiple of 64. , with and . The private key is and the public key is .
Give the DSA signing formulas and the rules for .
and . The key is random with . Destroy it after use and never reuse it. The signature has 320 bits.
Give the four DSA verification formulas and the final check.
, , and . The signature is verified if . In the DSS overview, these are and .
- Digital signatures verify the author, date, time and contents, and third parties can check them. The six requirements go from message dependence to practical storage.
- In the model, the sender encrypts the hash with the private key. The receiver decrypts with the public key and compares with a new hash.
- Direct signatures involve only the two parties. Sign first, then encrypt. The security depends on the sender's private key.
- ElGamal: , , . Compare with . In the slide example, the signature is and both values are .
- DSS (FIPS 186, NIST and NSA) is the standard and DSA is the algorithm. DSA gives 320-bit signatures only, and its security depends on discrete logarithms.
- DSA: and , with a new random . Verify through , , and , and accept if .