使用Microsoft建议的过程创建主哈希:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa381960%28v=vs.85%29.aspx
我已经成功开发了一个TLS程序,它在Win Vista和Win 7上的功能就像一个魅力。不幸的是,它在Win 8.1上通过调用失败:
CryptCreateHash(hProv, CALG_SCHANNEL_MASTER_HASH, hMasterKey, 0, &hMasterHash);
返回错误0x80090020
。
获取上下文PROV_RSA_SCHANNEL
提供以下信息:
Provider Type Provider TypeName
------------------------------
1 RSA Full (Signature and Key Exchange)
3 DSS Signature
12 RSA SChannel
13 DSS Signature with Diffie-Hellman Key Exchange
18 Diffie-Hellman SChannel
24 RSA Full and AES
Provider Type Provider Name
------------------------------
1 Microsoft Base Cryptographic Provider v1.0
13 Microsoft Base DSS and Diffie-Hellman Cryptographic Provider
3 Microsoft Base DSS Cryptographic Provider
1 Microsoft Base Smart Card Crypto Provider
18 Microsoft DH SChannel Cryptographic Provider
1 Microsoft Enhanced Cryptographic Provider v1.0
13 Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider
24 Microsoft Enhanced RSA and AES Cryptographic Provider
12 Microsoft RSA SChannel Cryptographic Provider
1 Microsoft Strong Cryptographic Provider
Default Provider Name : Microsoft Strong Cryptographic Provider
ALGID dwBits algType namelen Name
------------------------------
26126 128 Data_Encrypt 8 AES 128
26128 256 Data_Encrypt 8 AES 256
26114 128 Data_Encrypt 4 RC2
26625 128 Data_Encrypt 4 RC4
26113 56 Data_Encrypt 4 DES
26121 112 Data_Encrypt 13 3DES TWO KEY
26115 168 Data_Encrypt 5 3DES
32772 160 Hash 6 SHA-1
32771 128 Hash 4 MD5
32776 288 Hash 12 SSL3 SHAMD5
32773 0 Hash 4 MAC
41984 1024 Exchange 9 RSA_KEYX
32777 0 Hash 5 HMAC
19461 40 Msg_Encrypt 12 SSL2 MASTER
19457 384 Msg_Encrypt 12 SSL3 MASTER
19462 384 Msg_Encrypt 12 TLS1 MASTER
19458 0 Msg_Encrypt 16 SCH MASTER HASH
19459 0 Msg_Encrypt 12 SCH MAC KEY
19463 0 Msg_Encrypt 12 SCH ENC KEY
我正在使用SCHANNEL_ENC_KEY = CALG_RC4/128
和SCHANNEL_MAC_KEY = CALG_SHA1/160
,但CALG_AES_256/256
或CALG_3DES/168
会产生相同的错误。在前面的CryptSetKeyParam中使用SCHANNEL_MAC_KEY = CALG_SHA_256
失败,错误为80090005
。
我在2个多月前将此问题发布到MSDN,并且尚未得到回复。