Foundations of Security Week8 Seminar: Digital Signature

2302 字
12 分钟
Foundations of Security Week8 Seminar: Digital Signature

Digital Signature#

What is a digital signature#

A digital signature is a cryptographic result attached to data that helps a receiver verify three things:

123
Who sent itIt was not changedSender cannot easily deny it
Origin authenticationIntegrityNon-repudiation

Important: a digital signature does not hide the message. Confidentiality comes from encryption, not from the signature itself.

Simple idea: sign with the private key, verify with the public key.

Why we need it#

Without protection, a digital file can be copied, edited, or impersonated in transit. The receiver needs proof of source and integrity.

If there is no digital signature

  • Anyone can claim “I sent this.”
  • A message can be modified silently.
  • The receiver has no easy proof for a third party.
trust is weak

With a valid digital signature

  • The public key checks the sender’s signature.
  • Any change to the signed data breaks verification.
  • It supports accountability in software, email, and documents.
trust can be checked

Building blocks#

#KVID
Hash functionPrivate keyPublic keyCertificate / PKI
Turns any message into a fixed-size digest. Small changes in the message create a very different digest.Kept secret by the signer. It is used to create the signature.Shared with others. It is used to verify a signature.Binds a public key to an identity so that people know whose key they are using.
Together these components answer two questions: “Did this come from the claimed sender?” and “Has anything changed?”

How digital signatures work#

  1. Hash the message
    A hash function converts the message into a short fingerprint.
  2. Sign the hash
    The sender uses a private key to sign that fingerprint.
  3. Verify
    The receiver recomputes the hash and uses the public key of the sender to check the signature.

Key insight#

The signature is created over a hash, not by encrypting the whole document. That makes signing efficient even for large files.

Verification fails if#

  • the content changes
  • the wrong public key is used
  • the signature was forged

1. Hash
message

2. Encrypt hash
with private
key

3. Send
message
+ signature

4. Decrypt with
public key

5. Compute
message hash
& compare
hashes

If both hashes match, the signature is valid.

Algorithms and common uses#

Common signature algorithms

RSA

Widely taught and widely
deployed

ECDSA

Strong security with smaller
key sizes

EdDSA

Modern design; included in
FIPS 186-5 as Ed25519 /
Ed448 family

Common uses

Software signing

Proves a program or update
came from its publisher.

Signed email

Lets recipients verify sender
identity and tamper detection.

PDF / contract approval

Supports trusted document
workflows and audit trails.

Certificates on the web

Certificates themselves are
digitally signed by a CA.

Limitations and best practices#

Limitations / risks

  • If the private key is stolen, an attacker can create valid signatures.
  • Verification only works if the receiver trusts the correct public key or certificate.
  • A signature proves integrity and origin, but it does not prove the content is true or safe.

Best practices

  • Protect private keys with strong storage and access control.
  • Use trusted certificates and check validity / revocation status when relevant.
  • Choose modern approved algorithms and key sizes.

RSA Signature: Choosing Public and Private Keys#

  • Choose two prime numbers: p=3p = 3 and q=11q = 11
  • Compute n=p×q=3×11=33n = p \times q = 3 \times 11 = 33
  • Compute ϕ(n)=(p1)(q1)=2×10=20\phi(n) = (p − 1)(q − 1) = 2 \times 10 = 20
  • Choose e such that 1<e<ϕ(n)1 < e < \phi(n) and gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1. Let e=3\textcolor{blue}{e = 3}
  • Find d such that ed1(modϕ(n))e \cdot d \equiv 1 (\bmod \phi(n))
  • Here, 3×7=211(mod20)3 \times 7 = 21 \equiv 1 (\bmod 20), so d=7\textcolor{blue}{d = 7}

Public key

(e, n) = (3, 33)

Private key

(d, n) = (7, 33)

These keys are used for signing and verifying

RSA Signature: Signing the Message#

  • Let the message hash be h=2h = 2
  • Use the private key(d,n)=(7,33)key (d, n) = (7, 33)
  • Compute signature: s=hdmodn\textcolor{blue}{s = h^d \bmod n}

s=27mod33=128mod33=29\begin{aligned}s &= 2^7 \bmod 33 \\ &= 128 \bmod 33 \\ &= 29\end{aligned}

Therefore, the digital signature is s=29\textcolor{blue}{s = 29}

Sender uses private key to sign

RSA Signature: Verifying the Signature#

  • Receiver uses the public key(e,n)=(3,33)key (e, n) = (3, 33)
  • Verify signature s=29s = 29 by computing h=semodnh' = s^e \bmod n
  • If h\textcolor{blue}{h'} equals the original hash h=2h = 2, the signature is valid

h=293mod33=24389mod33=2\begin{aligned}h' &= 29^3 \bmod 33 \\ &= 24389 \bmod 33 \\ &= 2 \end{aligned}

Since h=2=h\textcolor{blue}{h' = 2 = h}, the signature is valid

Signature is

VALID

because

h' = h

2 = 2

Digital Signature (Activity)#

Digital Signature Activity#

Connect to CDUT_WIFI, open your browser and Enter the URL http://172.20.X.X Click on the login button and register with your Student ID and appropriate Password. Login after successful registration


Click on “Digital Signature” on the navigation tabs. Generate your key pairs (public key and private key)

Enter any message and click on “Sign and Store Message


Click on “Class Messages” on the navigation tabs.

Verify the messages submitted by your friends on the page using their public key

Presentation Slot Booking#

Connect to CDUT_WIFI, open your browser and Enter the URL http://172.20.X.X Click on the “Presentation Booking” tab to book an available slot for your class.

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!

赞助
Foundations of Security Week8 Seminar: Digital Signature
https://firefly.anka2.top/posts/obu/level5/semester2/fos/week8/seminar/
作者
🐦‍🔥不死鸟Anka
发布于
2026-04-30
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
A-n-k-a
Over the Frontier / Into the Front
看这里~
合作翻译官绝赞招募中!
音乐
封面

音乐

暂未播放

0:00 0:00
暂无歌词
分类
标签
站点统计
文章
59
分类
6
标签
20
总字数
550,118
运行时长
0
最后活动
0 天前

目录