Re: Using 128 bit AES (CALG_AES_128) to generate session keys - problem

From: Dale R (daler1_at_rediffmail.com)
Date: 05/26/04


Date: 26 May 2004 13:09:40 -0700

Hi Remus,

Thank you, that is exactly what I needed..your quick reply is appreciated!

"Remus" <nospam@nowhere.moon> wrote in message news:<#ZLG7ItQEHA.620@TK2MSFTNGP10.phx.gbl>...
> In CryptAcquireContext pass in MS_ENH_RSA_AES_PROV for the provider and
> PROV_RSA_AES as provider type.
>
> HTH,
> Remus
>
> "Dale R" <daler1@rediffmail.com> wrote in message
> news:ba6cc5ed.0405251857.368f6798@posting.google.com...
> > Hi,
> >
> > Im using Visual Studio 6, Ive installed the latest version (or close
> > enough) of the Microsoft Platform SDK. Im running this on Windows XP.
> >
> > My problem arose when trying to use CryptGenKey to generate a 128 bit
> > session key using the AES algorithm. What happens is that the context
> > acquiring, container, all the standard calls go through fine. But only
> > in the case of CALG_AES_128, the CryptGenKey() call fail with
> > NTE_BAD_ALGID. With CALG_RC4 it goes through just fine (and works!).
> >
> > So my question is, what could I be doing wrong? What might I need to
> > do to get this to work? Is it perhaps a problem with the way I
> > installed PSDK?
> >
> > My call to CryptGenKey is as follows
> > CryptGenKey(hProv, ENCRYPT_ALGORITHM, CRYPT_EXPORTABLE, &hSessionKey)
> > where ENCRYPT_ALGORITHM is #defined to be CALG_AES_128.
> >
> > Any assistance is greatly appreciated! Ive gone through MSDN very
> > heavily and it was very useful to do the basic coding, but handling
> > these odd cases is something I just couldnt do from what I got there.
> >
> > Thanks!