Converting Diffie-Hellman Session keys to CALG_AES_128
- From: "Medical-Fix" <fachero1@xxxxxxxxx>
- Date: 14 Sep 2006 14:09:13 -0700
How can I convert a Diffie-Hellman Session keys to CALG_AES_128??
The following code snip shows how I created my Diffie-Hellman Session
Keys, now I need to convert this session key to AES...
Thansk for the help!
1) CryptAcquireContext(&hProv, NULL, MS_ENH_DSS_DH_PROV, PROV_DSS_DH,
CRYPT_VERIFYCONTEXT);
2)CryptGenKey(hProv, CALG_DH_EPHEM, (DHKEYSIZE << 16) |CRYPT_EXPORTABLE
| CRYPT_PREGEN, &hPrivateKey1);
3)CryptSetKeyParam(hPrivateKey1, KP_P, (PBYTE)&P, 0);
4)CryptSetKeyParam(hPrivateKey1, KP_G, (PBYTE)&G, 0);
5)CryptSetKeyParam( hPrivateKey1, KP_X, NULL, 0);
6)CryptExportKey(hPrivateKey1, NULL, PUBLICKEYBLOB, 0, NULL,
&dwDataLen2);
7)CryptImportKey(hProv, pbKeyBlobParty2, dwDataLen2, hPrivateKey1, 0,
&hSessionKey);
.
- Follow-Ups:
- Re: Converting Diffie-Hellman Session keys to CALG_AES_128
- From: joe hacker
- Re: Converting Diffie-Hellman Session keys to CALG_AES_128
- Prev by Date: RSA in CryptAPI can't work with C#'s RSACryptoServiceProvider
- Next by Date: Re: Where to securely store encryption key?
- Previous by thread: RSA in CryptAPI can't work with C#'s RSACryptoServiceProvider
- Next by thread: Re: Converting Diffie-Hellman Session keys to CALG_AES_128
- Index(es):