It may be that it just doesn't like the very short keys you're using.
It may be that it just doesn't like the very short keys you're using. I found the desktop version of that article which may help, as it has a full example. EDIT: The OP realised from the example that you have to tell CryptGenKey how long the keys are, which you do by setting the top 16-bits of the flags to the number of bits you want to use.
If you leave this as 0, you get the default key length. This is documented in the Remarks section of the device documentation, and with the dwFlags parameter in the desktop documentation. For the Diffie-Hellman key-exchange algorithm, the Base provider defaults to 512-bit keys and the Enhanced provider (which is the default) defaults to 1024-bit keys, on Windows XP and later.
There doesn't seem to be any documentation for the default lengths on CE. The code should therefore be: BYTE p64 = { 139 }; // little-endian, all other bytes set to 0 BYTE g64 = { 5 }; CRYPT_DATA_BLOB pblob; pblob. CbData = sizeof( p); pblob.
PbData = p; CRYPT_DATA_BLOB gblob; gblob. CbData = sizeof( g ); gblob. PbData = g; HCRYPTKEY hKey; if ( ::CryptGenKey( m_hCryptoProvider, CALG_DH_SF, ( 512.
Thanks, Mike-- I found (from your reference) that it was two things. You have to tell CryptGenKey the key length by or'ing the length in bits, left shifted by 16, into the flags parameter (undocumented, of course, you have to read the sample). Also, the key length must be at least 512 bits.
– Kevin Dente Sep 17 '08 at 16:47.
. For Diffie-Hellman it looks like you're supposed to use KP_PUB_PARAMS and pass a DATA_BLOB that points to a DHPUBKEY_VER3 structure. Note that the article you're pointing to is from the Windows Mobile/Windows CE SDK.
It wouldn't be the first time that CE worked differently from the desktop/server. EDIT: CE does not implement KP_PUB_PARAMS. To use this structure on the desktop, see Diffie-Hellman Version 3 Public Key BLOBs.
Thanks, but the DHPUBKEY_VER3 structure doesn't appear to allow one to specify P & G (just their bit lenghts). Also, I should have mentioned, I am on Windows Mobile, not desktop. I wonder if I could just find an OpenSSL port?
;) – Eggs McLaren Sep 16 '08 at 23:49.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.