ECDSA

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

ECDSA

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. ECDSA uses the private key to create a signature and the public key to verify it.
A True
B False
2. Which key should be used to create a signature: the private key, or the public key?
A Private key
B Public key
3. It's safe to share your private key so others can verify your signature.
A True
B False
4. Which is used to check a signature's authenticity: the sender's public key, or their private key?
A The sender's public key
B The sender's private key
5. A valid ECDSA signature confirms that a message hasn't been altered since it was signed.
A False
B True

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1signature = sign(message, priv) AThe mistake: exposing the private key, which must stay secret
2valid = verify(message, signature, pub) Bif valid == True:
3ECDSA uses a private key to sign and a public key to verify Cpriv, pub = gen_keys()
4A valid signature proves the message came from the claimed signer DThe mistake: swapping the order of the message and signature arguments
5share_publicly(priv) ECreating a signature for a message using the private key
6valid = verify(sig, msg, pub) FChecking a signature's authenticity using the public key

Definitions

ECDSA

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
_________ = sign(message, priv)
2.
signature = ____(message, priv)
3.
valid = ______(message, signature, pub)
4.
priv, pub = ________()
5.
if valid __ True:

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A sig = verify(msg, priv)
B valid = verify(msg, sig, pub)
C print(valid)
Question 2
A sig = sign(pub, priv)
B valid = verify(msg, sig, pub)
C print(valid)
Question 3
A sig = sign(msg, priv)
B priv = pub
C valid = verify(msg, sig, pub)
Question 4
A sig = sign(msg, priv)
B valid = sign(msg, sig)
C print(valid)
Question 5
A sig = sign(msg, priv)
B valid = verify(msg, sig, pub)
C pub = None

Answer Key

ECDSA
Section A: Quick Questions
Q1
A — True
Q2
A — Private key
Q3
B — False
Q4
A — The sender's public key
Q5
B — True
Section B: Match the Pairs
Q1
signature = sign(message, priv) → Creating a signature for a message using the private key
Q2
valid = verify(message, signature, pub) → Checking a signature's authenticity using the public key
Q3
ECDSA uses a private key to sign and a public key to verify → priv, pub = gen_keys()
Q4
A valid signature proves the message came from the claimed signer → if valid == True:
Q5
share_publicly(priv) → The mistake: exposing the private key, which must stay secret
Q6
valid = verify(sig, msg, pub) → The mistake: swapping the order of the message and signature arguments
Section C: Definitions
Q1
ECDSA — A digital signature algorithm that uses a private key to sign a message and the matching public key to verify it.
Section D: Fill in the Blanks
Q1
signature = sign(message, priv)
Q2
signature = sign(message, priv)
Q3
valid = verify(message, signature, pub)
Q4
priv, pub = gen_keys()
Q5
if valid == True:
Section E: Spot the Error
Q1
A — Line 1 calls verify() to create the signature, but sign() should be used with the private key to create it.
Q2
A — Line 1 passes the public key pub as the message, but sign() should take the actual message being signed.
Q3
B — Line 2 overwrites priv with pub, but the private key must stay distinct and secret for signing.
Q4
B — Line 2 calls sign() again instead of verify(), so the signature is never actually checked.
Q5
C — Line 3 discards the public key after verifying, but it may be needed again to verify future signatures.