随笔-13  评论-11  文章-0  trackbacks-0
课本里学的信息安全,今天在工作中第一次实际使用,一开始很想翻译一下这个Challenge-Handshake Authentication Protocol,可是想了半天也没有想到什么合适的翻译,search了一下,发现中文翻译是:挑战握手协议,台湾的翻译是:验证通讯协议。现在我不得不承认有一些词语的翻译,还是台湾翻译的好一些,其实未必非要直译出来,否则听起来好奇怪。

挑战握手协议(Challenge-Handshake Authentication Protocol,CHAP)是一个用来验证用户或网络提供者的协议。负责提供验证服务的机构,可以是互联网服务供应商,又或是其他的验证机构。

CHAP 用于使用3次握手周期性的验证对端身份。在链路建立初始化时这样做,也可以在链路建立后任何时间重复验证。

  1. 在链路建立完成后,验证者向对端发送一个“challenge”信息。
  2. 对端使用一个“one-way-hash”函数,例如MD5,计算出的值响应这个信息。
  3. 验证者使用自己计算的hash值校验响应值。如果两个值匹配,则验证是承认得,否则连接应该终止。
  4. 在随机时间,验证端发送一个“challenge”给对端,重复1到3步。

CHAP通过增量改变标识和“challenge-value”的值避免“playback attack”攻击。验证的两端都需要知道“challenge”信息的明文,但不会在互联网上传播。

注:以上内容来自维基百科。

CHAP:挑战握手认证协议 (Challenge Handshake Authentication Protocol)

挑战握手认证协议(CHAP)通过三次握手周期性的校验对端的身份,在初始链路建立时完成,可以在链路建立之后的任何时候重复进行。

  1. 链路建立阶段结束之后,认证者向对端点发送“challenge”消息。
  2. 对端点用经过单向哈希函数计算出来的值做应答。
  3. 认证者根据它自己计算的哈希值来检查应答,如果值匹配,认证得到承认;否则,连接应该终止。
  4. 经过一定的随机间隔,认证者发送一个新的 challenge 给端点,重复步骤 1 到 3 。

通过递增改变的标识符和可变的挑战值,CHAP 防止了来自端点的重放攻击,使用重复校验可以限制暴露于单个攻击的时间。认证者控制验证频度和时间。

该认证方法依赖于只有认证者和对端共享的密钥,密钥不是通过该链路发送的。

虽然该认证是单向的,但是在两个方向都进行 CHAP 协商,同一密钥可以很容易的实现相互认证。

由于 CHAP 可以用在许多不同的系统认证中,因此可以用 NAME 字段作为索引,以便在一张大型密钥表中查找正确的密钥,这样也可以在一个系统中支持多个 NAME/ 密钥对,并可以在会话中随时改变密钥。

CHAP 要求密钥以明文形式存在,无法使用通常的不可回复加密口令数据库。

CHAP 在大型网络中不适用,因为每个可能的密钥由链路的两端共同维护。

协议结构

CHAP 的配置选项格式如下:

8 16 32 40 bit
Type Length Authentication-Protocol Algorithm
  • Type ― 3
  • Length ― 5
  • Authentication-Protocol ― 对于 CHAP,为 C223(Hex)。
  • Algorithm ― Algorithm 字段为八位字节,表示使用的认证方法。

CHAP 数据包结构如下所示:

8 16 32 bit Variable
Code> Identifier Length Data . . .
  • Code ― 识别 CHAP 数据包类型。CHAP 代码具有以下几种:1、Challenge;2、Response;3、Success;4、Failure。
  • Identifier ― 用于匹配 Challenges、Responses 和 Replies 信息。
  • Length ― CHAP 数据包的长度,包括 Code、Identifier、Length 和 Data 字段。
  • Data ― 0或更多八位字节。该字段格式取决于 Code 字段。对于 Success 和 Failure,Data 字段包括一个独立执行的可变信息字段

相关协议:PPPPPPoEPPPoALCPNCPPAP

组织来源:CHAP 由 IETF(http://www.ietf.org/)定义。

相关链接:http://www.javvin.com/protocol/rfc1994.pdf: PPP Challenge Handshake Authentication Protocol (CHAP)

(注:以上内容来自网络大典)

Challenge-handshake authentication protocol

In computing, the Challenge-Handshake Authentication Protocol (CHAP) authenticates a user or network host to an authenticating entity. That entity may be, for example, an Internet access provider.

RFC 1994: PPP Challenge Handshake Authentication Protocol (CHAP) defines the protocol.

CHAP is an authentication scheme used by Point to Point Protocol (PPP) servers to validate the identity of remote clients. CHAP periodically verifies the identity of the client by using a three-way handshake. This happens at the time of establishing the initial link, and may happen again at any time afterwards. The verification is based on a shared secret (such as the client user's password).

  1. After the completion of the link establishment phase, the authenticator sends a "challenge" message to the peer.
  2. The peer responds with a value calculated using a one-way hash function, such as an MD5 checksum hash.
  3. The authenticator checks the response against its own calculation of the expected hash value. If the values match, the authenticator acknowledges the authentication; otherwise it should terminate the connection.
  4. At random intervals the authenticator sends a new challenge to the peer and repeats steps 1 through 3.

CHAP provides protection against playback attack by the peer through the use of an incrementally changing identifier and of a variable challenge-value. CHAP requires that both the client and server know the plaintext of the secret, although it is never sent over the network.

Microsoft has implemented a variant of the Challenge-handshake authentication protocol, called MS-CHAP, which does not require either peer to know the plaintext.


 Working Cycle

  • Challenge Packet (System to User)
  • Response Packet (User to System)
  • Success or failure packet (System to User)

CHAP Packets

Description 1 byte 1 byte 2 bytes 1 byte Variable variable
Challenge Code = 1 ID Length Challenge length Challenge value Name
Response Code = 2 ID Length Response Length Response value Name
Success Code = 3 ID Length
Message
Failure Code = 4 ID Length
Message

CHAP packet embedded in a PPP frame. The protocol field has a value of 0xC223

Flag Address Control Protocol (0xC223) Payload (table above) FCS Flag
(注:以上内容来自英文维基百科)

今天我做的应用是在iSCSI SAN网络里对Server(host)和Storage端使用CHAP来加密,两端通过name字段来找到密钥进行验证,具体内容以后有机会再贴上来。
posted on 2009-11-20 14:21 笑笑 阅读(671) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。