CAN304 W5

CAN304 W5

Designing security protocols

Security protocols:

A series of steps involving two or more parties designed to accomplish a task with suitable security

涉及两方或多方的一系列步骤,旨在以适当的安全性完成任务

Sequence is important

这些步骤的顺序很重要

Different protocols assume different levels of trust between participants

不同的协议假设参与者之间的信任程度不同。

例如:Payment protocol,Smart lock protocol。

Goals of security protocols

Each protocol is intended to achieve some very particular goal(like setting up a key between two parties)

每个协议都旨在实现一些非常特殊的目标

Protocols may only be suitable for that particular purpose

协议可能只适用于该特定目的

Important secondary goal is minimalism

重要的次要目标是极简主义

  • Fewest possible messages
  • Least possible data
  • Least possible computation

Trusted arbitrator: A disinterested third party trusted by all legitimate participants. Arbitrators often simplify protocols, but add overhead and may limit applicability(所有合法参与者都信任的无私的第三方。Arbitrators 通常会简化协议,但会增加开销,并可能限制适用性)

Key establishment protocols

Often, we want a different encryption key for each communication session

通常,我们希望每个通信会话使用不同的加密密钥。但是,我们如何将这些钥匙交给参与者?

session: period of time over which parties are willing to maintain state

Key establishment 是一种加密机制,它为通过开放网络进行通信的两方或多方提供共享密钥。

类别:

  • Key transport protocols

    ​ the shared secret key is created by one party and securely transmitted to the second party.

    • 在密钥传输协议中,共享密钥由一方创建并安全地传输给另一方
  • Key agreement (or exchange) protocols

    ​ both parties contribute information which is used to derive the shared secret key

    • 在密钥交换协议中,双方都提供用于派生共享密钥的信息

Key transport protocols

Key transport with private-key cryptography

Alice 和 Bob 想用新密钥安全地交谈,他们都信任 arbitrators Trent,并假设 Alice 和 Bob 各自与 Trent 共享一个密钥。

最初,Alice 和 Trent 分享 KA,Bob 和 Trent 分享 KB

Key establishment:

  1. Alice -> Trent: Alice 请求和 Bob 的会话密钥

  2. Trent -> Alice:\(\{K_S\}_{K_A}, \ \{K_S\}_{K_B}\) (Trent 生成密钥 KS,并分别使用 KA 和 KB 加密 KS,然后把加密后的内容发给 Alice)

  3. Alice: \(K_S \ \leftarrow \ \{K_S\}_{K_A}\) (Alice 使用 KA 解密得到 KS)

    Alice -> Bob:\(\{K_S\}_{K_B}\) (Alice 把剩下的内容发给 Bob)

  4. Bob: \(K_S \ \leftarrow \ \{K_S\}_{K_B}\) (Bob 使用 KB 解密得到 KS,KS 即他们交流所使用的密钥)

What has the protocol achieved?

  • Alice 和 Bob 都有一个新的会话密钥,会话密钥是使用只有 Alice 和 Bob 知道的密钥传输的,Alice 和 Bob 都知道 Trent 参加了
  • 不过这有一个漏洞

The man-in-the-middle attack

假如有一个攻击者 Mallory,他也是 Trent 的合法用户。当 Alice 索求和 Bob 的密钥时,Mallory 把信息改成 Alice 和 Mallory 的密钥,然后他就会和 Alice 共享一个密钥;之后 Mallory 再索求和 Bob 的密钥,然后他就和 Bob 也共享密钥;这样 Alice 和 Bob 以为他们在交流,实际上他们的信息经过了 Mallory 的中转,Mallory 可以窃听 Alice 和 Bob 的对话。

image-20230512214704636

这个问题是缺乏身份验证 ( lacking authentication) 导致的,可以通过使用MAC(using MAC)或在消息中包括时间戳/计数器和身份(including timestamps/counter and identity in the messages)

Key transport with public key cryptography

此问题中,没有受信任的 arbitrator,Alice 和 Bob 互相发送他们的公钥。

Alice 生成一个会话密钥并将其发送给 Bob,用 Bob 的公钥加密,用Alice 的私钥签名;Bob 验证签名,并用他的私钥解密 Alice 的消息,然后使用共享会话密钥加密会话。

image-20230512220502042 image-20230512221153634

Man-in-the-middle attack

攻击者 Mallory 也有一对公钥和私钥,在 Alice 和 Bob 交换公钥时,Mallory 把自己的公钥发给双方,之后 Alice 和 Bob 以为他们在交流,实际上他们的信息经过了 Mallory 的中转,Mallory 可以窃听 Alice 和 Bob 的对话。

image-20230512221735613

这个问题可以通过以下方法解决:

  • PKI: public-key infrastructure
    • CA (certificate authority) issues public-key certificates,证书中会包含验证身份的信息
  • Identity-based cryptography
    • identity 是(或可用于生成)公钥

Key exchange protocols

Basic ECDH

image-20230512223535026

x,y是私钥,k是协商出的密钥

通过 ECDDH 来共享密钥,最后 k1 和 k2 是相等的 (因为 \(xyG = yxG\) )。

Man-in-the-middle to basic ECDH

image-20230512225255253

Reason: Lack of authentication

Solution: Introduce authentication in the protocol

原因:缺乏身份验证

解决方案:在协议中引入身份验证

ECDH-based AKE example: PW-AKE

• IEEE 802.15.6 Password Authenticated Association

Other applications of security protocols

A smart lock system

Suppose in unlock process,the lock only support short-range bluetooth connection for security purpose.
假设在开锁过程中,为了安全起见,锁只支持短距离蓝牙连接。

  • Task/purpose

    ​ When receive a "unlock" request from the host, unlock

    ​ When receive a "unlock" request from host authorized guest,unlock

    ​ Otherwise, keep locked

    • 当收到主机 (host) 的“解锁”请求时,解锁
    • 当收到来自主人授权客人 (guest) 的“解锁”请求时,解锁
    • 否则,保持锁定
  • Security goals

    • Integrity: the request if originated from the host and not changed improperly(完整性:请求是从主机组织而来的,并且没有被不正确地更改)

Design 1: using private-key tools

最初,锁和主机(手机)共享一个密钥 k。

Protocol I: host unlock;Protocol II: guest unlock。

主要思路是 host 根据密钥和随机数 r 生成 MAC tag,然后锁验证 tag。

image-20230513085800473image-20230513090123518

Design 2: using public-key tools

最初,锁存储主机的公钥。

Protocol I: host unlock;Protocol II: guest unlock。

主要思路是 host 根据私钥和随机数 r 生成签名,然后锁用公钥验证签名。

image-20230513090209216image-20230513090233305

posted @ 2023-05-13 22:26  AAA建材王师傅  阅读(52)  评论(0)    收藏  举报