当前位置:
文档之家› 消息认证(Message Authentication)
消息认证(Message Authentication)
Message Digest
目标:确保信息的完整性(Integrity) 特色: (1) 不需密钥 (2) 任意长信息输入,固定长摘要输出 (3) 找出两个不同的输入,使输出相同在计算上很难 常用系統: MD5 (RFC 1321) SHA-1 (FIPS 180-1)
Structure of Message Digest
Message authentication code
• Prerequisite: A and B shares a key K
– Can be a session key
• MAC: a short fixed-size data block, depending on the message M and the shared key K • MAC(K,M)=CK(M) • Sender: M||CK(M) • Receiver: on receiving M’|C’
HMAC的设计目标
• Hash函数不使用密钥,不能直接用于MAC • HMAC要求 –可不经修改使用现有hash函数 –其中嵌入的hash函数可易于替换为更快和更安 全的hash函数 –保持嵌入的hash函数的最初性能,不因适用于 HAMC而使其性能降低 –以简单方式使用和处理密钥 –在对嵌入的hash函数合理假设的基础上,易于 分析 HMAC用于认证时的密码强度
MD5不再安全!?
安全的杂凑函数在设计时必须满足两个要求
● ●
找到两个不同输入而得到相同的输出值在计算上是不可行的—— 抗碰撞
给定一输出值找出输入值在計算上是不可行的——单向性
2004年在Crypto會議,來自山東大學的王出一种可以快速找到碰撞的方法 受影响的算法—— MD5、HAVAL-128、MD4、RIPEMD SHA-0及減弱条件下的SHA-1不安全——在任何初始值下 用240次hash运算可以找出SHA-0的碰撞 SHA-1预计至2010年也会被破解
Message Encryption
• message encryption by itself also provides a measure of authentication • if symmetric encryption is used then:
– receiver know sender must have created it – since only sender and receiver know key used – know content cannot of been altered – if message has suitable structure, redundancy or a checksum to detect any changes
●
美国政府5年内将不再使用SHA-1,并计划在2010年改用其他更长 更安全的算法(如SHA-224、SHA-256、SHA-384和SHA-512)来替 代
Recall: Encryption for authentication
Hash function: usage
Hash function: usage (cont.)
1. 消息认证目的
• 消息认证目的包括 – 消息內容认证
– 消息来源认证
– 可信任的通訊密钥建立
消息认证(Message Authentication)
Goal:
A => M => B
1. Guarantee no message changed 2. Confirm the message sent by specified user
– Let F be a public checksum function – Compute C=EK(M||F(M)) – Authentication
• Compute DK(C)=M’||S’ • Check S’=F(M’)
Encryption for authentication (cont.)
如何实现消息认证
2. 数字信封
– 结合对称加密系统和公钥加密系统
– 利用对称加密系统计算量较少优点來加密消息 – 利用公钥加密系统來加密对称密钥,所以不必 事先分享好密钥。
如何实现消息认证
3. 数字签名 – 消息来源认证
– 消息不可否否认性
– 消息的完整性 – 但计算量大
如何实现消息认证
4. hash函数构造—消息认证码
(Message Authentication Code, MAC)
较简单的方法是利用具密钥的杂凑函数
(Keyed Hash Function)产生MAC. 可以实现消
息认证 (Message Authentication)或完整性
(Integrity)
认证的种类–消息认证
• 以MAC為例
– M为发送方要发送给接收方的信息 – K为发送方与接收方事先分享的密钥 – MAC的输入为M与K,输出为digest (只有拥有K的人才能計 算出digest) – 接收方可以利用MAC,对收到的M’或digest’做验证,以确 保消息的完整性
– Compute C’’=CK(M’) – Check whether C’=C’’
MAC: example
• The last block of DES-CBC Cipher block chaining mode
MAC: security
• Only A and B who share a key can create a valid MAC code for a message M • Only the designated receiver A or B can authenticate the received message • An attacker cannot modify M without recalculating the MAC=CK(M’)
• Methods (Important)=> Thinking
Method-1: Message encryption
Method-2: Message authentication code
Method-3: Hash function (Partial properties)
如何实现消息认证
• hash includes a key along with the message • original proposal:
KeyedHash = Hash(Key|Message) – some weaknesses were found with this
• eventually led to development of HMAC
Encryption for authentication
• First symmetric encryption:
– Let M be a message of some bit pattern – Eg. M=X||111110000011111 – Authenticator: V=EK(M) – Authentication
Keyed Hash Functions as MACs
• have desire to create a MAC using a hash function rather than a block cipher
– because hash functions are generally faster – not limited by export controls unlike block ciphers
认证内容
• 认证的种类 • 认证的需求 • 认证的功能
认证的种类
• 消息认证(Message Authentication)
• 身份认证(Identity Authentication)
• 基于身份的身份认证(ID-based Identity
Authentication)
消息认证
• 目的
– 验证消息是否为真正的通讯双方所传送,并
Message Encryption
• if public-key encryption is used:
– encryption provides no confidence of sender – since anyone potentially knows public-key – however if
• sender signs message using their private-key • then encrypts with recipients public key • have both secrecy and authentication
– again need to recognize corrupted messages – but at cost of two public-key uses on message
M4
Ek (x)
…
Mn
Ek (x)
IV
Ek (x)
…
C1
C2
C3
C4
…
Cn MAC
如何实现消息认证
1. 加密 – 消息內容只有加密者和拥有解密密钥者才知道, 确保消息的秘密性。 – 如果明文內容中有可辨别的信息,则可确认消息 的正确性 1) 对称加密系统 – 优点:计算速度快 – 缺点:事先必須分享好共同密钥 2) 公钥加密系统 – 优点:不需要事先必須分享好共同密钥 – 缺点:计算速度慢, 需要认证公钥来源的正确性
– Step2: 比较算出來的MAC值是否
和传送过来的MAC’一样,如果一 样即通过验证
• Authenticator: a short string (value) MAC appended to a message M for authenticating the message