802.11 Four-way handshake Messages

1.  4-way handshake sequence

0_13104396958zm8

2. Key Heirarchy

0_1310440023gpQ0

The EAPOL encryption key is the middle 128 bits of the PTK value.

And the first 128 bits of the PTK (KCK), is used in the computation(and validation) of the EAPOL frame MIC field value (4way handshake Message 1/2).

3. EAPOL Frame format

0_1310440523Xe68

4 Key Data Format

0_13104406628SwT

Key data may be zero or more InformationElement(s) (such as the RSN information element), and zero or more key dataencapsulation(s) (KDEs) (such as GTK(s)).

4.1 RSN Information

0_1310440804770w

4.2 GTK

If theEncrypted Key Data subfield (of the Key Information field) is set, the entireKey Data field shall be encrypted. If the Key Data field uses the NIST AES keywrap, then the Key Data field shall be padded before encrypting if the key datalength is less than 16 octets or if it is not a multiple of 8. The paddingconsists of appending a single octet 0xdd followed by zero or more 0x00 octets.When processing a received EAPOL-Key message, the receiver shall ignore thistrailing padding.  Key Data fields that are encrypted but do not containthe GroupKey or STAKey KDE, shall be accepted.

If the GroupKey or STAKey KDE is included in the Key Data field but theKey data field is not encrypted the EAPOL-Key frames shall be ignored.

0_1310440955sZ01

5. Sample 4-way Handshake

5.1 Message 1

The Authenticator sends an EAPOL-Key frame containing an ANonce.

0_13104413205d5G

Key data is zero.

5.2 Message 2

The Supplicant derives a PTK from ANonce and SNonce.

The Supplicant sends an EAPOL-Key frame containing SNonce, the RSN information element

from the Association Request frame and a MIC.

0_1310441522WyDx

MIC is the KCK (The first 128 bits in the PTK).

Key data is RSN Information.

802.1X authentication, CCMP pairwise dna group cipher suites.

5.3 Message 3

The Authenticator derives PTK from ANonce and SNonce and validates the MIC in the EAPOL Key frame

The Authenticator sends an EAPOL-Key frame containing ANonce, the RSN from its Beacon or Probe

Response messages, MIC whether to install the temporal keys, and the encapsulated GTK

0_1310442380H8du

Should the MIC data  be same with the one in Message 2   ?!

Key data is RSN Information + GTK,  and the data is encapsulated by using of the AES algrithm with the KEK(The middle 128 bits in PTK).

5.4  Message 4

To be added.

原始链接 http://blog.csdn.net/stevenliyong/article/details/6599528

在VC中编译和使用OpenSSL

在编译OpenSSL前,需要正确安装Perl,因为在编译OpenSSL时需要使用到该程序。

下载最新版本的Perl:http://downloads.activestate.com/ActivePerl/releases/5.20.1.2000/ActivePerl-5.20.1.2000-MSWin32-x64-298557.msi。然后安装之。

Windows 一定要使用 ActivePerl 主要是由于换行跟Linux ,Unix 的不同,如果使用其他的Perl生成的MakeFile 文件,会导致NMake无法正常的编译。

另外,一定要确保ActivePerl在系统的PATH 环境变量中在最前面,并且在命令行中执行 PATH命令的输出是跟环境变量中是一致的,Windows中有时候会发生刚刚添加的环境变量不能及时更新到命令行界面的问题,即使是你已经重新打开新的命令行窗口了。

下载最新版本的OpenSSL:http://www.openssl.org/source/openssl-1.0.1j.tar.gz

一定要使用最新的OpenSSL,早期的版本有Heartbleed的BUG,另外一定要是新下载并且刚刚解压缩出来的,没有修改过的文件,有时候,某些不经意的修改会导致编译不成功。

然后将源码释放的c:\openssl-1.0.1j目录中。

进入openssl源码目录。

以下为参照该目录下的文件INSTALL.W32的执行过程:

运行configure:

创建Makefile文件:

此处建议执行 do_ms ,有时候执行do_nasm会不正常,尽管文档中说执行 do_nasm

编译动态库:

编译静态库:

测试动态库:

测试静态库:

安装动态库:

安装静态库:

清除上次动态库的编译,以便重新编译:

清除上次静态库的编译,以便重新编译: