Solved

CALG_AES_256  vc++ 6.0

Posted on 2009-03-30
35
3,815 Views
Last Modified: 2013-12-14
I am ahving errors  
C:\Documents and Settings\hariere\Desktop\testcrypto\testcrypto.cpp(67) : error C2065: 'PROV_RSA_AES' : undeclared identifier
C:\Documents and Settings\hariere\Desktop\testcrypto\testcrypto.cpp(101) : error C2065: 'CALG_AES_256' : undeclared identifier
Error executing cl.exe.
Please help where i am worng
// testcrypto.cpp : Defines the entry point for the console application.

//
 
 

#include "stdafx.h"

#include <windows.h>

#include<string.h>

#include <cstring>
 

#include <stdio.h>

#include <stdlib.h>

#include <wincrypt.h>

#include<malloc.h>
 

#ifdef USE_BLOCK_CIPHER

    // defines for RC2 block cipher

    #define ENCRYPT_ALGORITHM      CALG_RC2

    #define ENCRYPT_BLOCK_SIZE      8

#else

    // defines for RC4 stream cipher

    #define ENCRYPT_ALGORITHM      CALG_RC4

    #define ENCRYPT_BLOCK_SIZE      1

#endif

#ifndef MS_ENH_RSA_AES_PROV

#ifdef UNICODE

#define MS_ENH_RSA_AES_PROV \

L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

#else

#define MS_ENH_RSA_AES_PROV \

"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

#endif

#endif /* MS_ENH_RSA_AES_PROV */

#ifndef CALG_HMAC

#define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)

#endif

#ifdef CONFIG_TLS_INTERNAL

#ifdef __MINGW32_VERSION

#define PROV_RSA_AES  "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

#endif

#endif /* MS_ENH_RSA_AES_PROV */

#ifndef CALG_HMAC

#define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)

#endif

 
 
 
 

	DWORD dwResult;

	HCRYPTPROV hProv;

	HCRYPTKEY hKey;

	HCRYPTKEY hSessionKey;

	DWORD cbBlob;

	BYTE *pbBlob;

	HCRYPTHASH hHash;
 

	//CString	m_cipher;

void Encrypt();

int main()

{
 

	

	if (!CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0))

				{

						dwResult = GetLastError();

					if (dwResult == NTE_BAD_KEYSET)

						{

								if (!CryptAcquireContext(&hProv, 

									NULL, MS_DEF_PROV, PROV_RSA_AES, 

										CRYPT_NEWKEYSET))

									{

										printf("error creating cryptoAcquireContext");

									}

						}

    
 

				}
 

			if(CryptCreateHash(

									hProv, 

									 CALG_MD5, 

										0, 

										0, 

									 &hHash)) 

						{

							printf("An empty hash object has been created. \n");

						}

				else

			{

						printf("Error during CryptBeginHash!\n");

					exit(1);

			}
 

		

	

						if (!CryptImportKey(hProv, pbBlob, cbBlob, 0, 0, &hSessionKey))

								{

			

									printf("error creating CryptImportKey");

								}

		
 

					if (!CryptGenKey(hProv, CALG_AES_256, CRYPT_EXPORTABLE, &hSessionKey))

								{

			

									printf("error creating CryptGenKey");

								}	

	

    //Encrypt();

	return 0;

}
 
 

/*void Encrypt()

{

    //unsigned long length = m_clear.GetLength() +1;

	unsigned long length = 10;

    unsigned char * cipherBlock  ; // = (unsigned char*)malloc(length);

    LPCSTR mm = "hari";

	char myname[5] = "hari";

    memcpy(&cipherBlock, &myname, 10 -1); 
 

    if (!CryptEncrypt(hSessionKey, 0, TRUE, 0, mm, &length, 9))

    {

        printf("error creating CryptEncrypt");

    }
 

    //m_cipher = cipherBlock;

    //m_clear = "";

    //free(cipherBlock);

}*/

Open in new window

0
Comment
Question by:hp746
  • 15
  • 13
  • 2
  • +1
35 Comments
 
LVL 5

Expert Comment

by:migoEX
ID: 24026433
"undeclared identifier" - are you missing some includes? "wincrypt.h"?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24026781
>>>> are you missing some includes? "wincrypt

migoEx is right. You need to add

#include <wincrypt.h>

below include "stdafx.h"  and recompile.

The missing constants were defined there.
0
 

Author Comment

by:hp746
ID: 24028567
i did tat i have received error in wincrypt.h

error C2146: syntax error : missing ';' before identifier 'HRESULT'
0
 

Author Comment

by:hp746
ID: 24028585
i paste some part of my wincrypt.h code am i using the old one?is it correct wincrypt.h?


//+---------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright 1992 - 1998 Microsoft Corporation.
//
//  File:       wincrypt.h
//
//  Contents:   Cryptographic API Prototypes and Definitions
//
//----------------------------------------------------------------------------

#ifndef __WINCRYPT_H__
#define __WINCRYPT_H__


#if(_WIN32_WINNT >= 0x0400)

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef LONG HRESULT;

#endif // !_HRESULT_DEFINED

#if !defined(_CRYPT32_)
#define W
0
 
LVL 5

Expert Comment

by:migoEX
ID: 24028658
try adding
#include <windows.h>
before you include "wincrypt"
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24034040
>>>> try adding
>>>> #include <windows.h>
>>>> before you include "wincrypt"

Hmmm. Isn't the windows.h already included in stdafx.h ? Note, a precompiled header like stdafx.h makes only sense if it does include some of the (rarely changing) big headers like windows.h and/or afx.h (MFC) respectively atlmfc.h (ATL and MFC since VC7). If not, you should remove it and switch off the Precompiled Header option which is in the C++ settings.

If your stdafx.h already includes windows.h your error  may occur because you need to rebuild the precompiled header. Either compile stdafx.cpp for that or use 'rebuild all'.

If the error still exists you may have to set the _WIN32_WINNT preprocessor macro. Go to menu Project - Properties - Configuration Properties - C++ -Preprocessor  and add  _WIN32_WINNT=0x0500 to the list of preprocessor macros (use a semicolon ; as separator).
0
 

Author Comment

by:hp746
ID: 24035048
i did it still i have same problem btw i am using visual c++ 6.0 console application
and #include <windows.h> in stadfx.h

 
0
 

Author Comment

by:hp746
ID: 24035689
I wonder if vc++ 6.0 is support 'CALG_AES_256'  alogrithms
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24066782
>>>> I wonder if vc++ 6.0 is support 'CALG_AES_256'  alogrithms

You are right. wincrypt.h supplied with VC6 doesn't offer the CALG_AES_256.


But you could try to add the missing definitions below wyncrypt.h. If the advapi32.dll on the target system is younger then 1998 (check your Windows\system32) it probably supports additional codes.

Try to put

#define ALG_SID_TLS1PRF                 10
#define ALG_SID_HASH_REPLACE_OWF        11
#define ALG_SID_SHA_256                 12
#define ALG_SID_SHA_384                 13
#define ALG_SID_SHA_512                 14

#define CALG_AES_128            (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
#define CALG_AES_192            (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
#define CALG_AES_256            (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
#define CALG_AES                (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES)

below #include <wincrypt.h>




0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24066788
It was the wrong ALG_SID... codes take

#define ALG_SID_AES_128                 14
#define ALG_SID_AES_192                 15
#define ALG_SID_AES_256                 16
#define ALG_SID_AES                     17


instead
0
 
LVL 86

Expert Comment

by:jkr
ID: 24067916
Defining these constants manually is not the usual way to go - instead, update your SDK from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc (Don't get confused by the name, that only representy the latest product that SDK complies with)
0
 

Author Comment

by:hp746
ID: 24068515
jkr am using vc++ 6.0  am not developingin .net
0
 
LVL 86

Expert Comment

by:jkr
ID: 24068535
Yes, I am aware of that. Yet that's where you update your native C++ headers and libraries also.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24068908
>>>> Defining these constants manually is not the usual way to go

No problem if it works. It is no code but only constants which were fully supported by any advapi32.dll younger than 2003.


>>>> update your SDK from
No, don't make updates which could spoil VC6. With VC7 MS made a major step towards .NET. That step is not compatible with VC6.

Defining the constants is a harmless thing. It either works or fails but won't make things worse. The SDK would bring an update which was made for later versions of C++ compiler and will change your VC6 environment. It is like to crack a nut with a sledgehammer and I highly recommend against it as long as you want to keep with VC6.
0
 

Author Comment

by:hp746
ID: 24070326
I have changed my code and i have few errors
// testcrypto.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"


#include<string.h>
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include<malloc.h>
#include <wincrypt.h>
#define ALG_SID_AES_128                 14
#define ALG_SID_AES_192                 15
#define ALG_SID_AES_256                 16
#define ALG_SID_AES                     17


#define CALG_AES_128                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
#define CALG_AES_192                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
#define CALG_AES_256                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
#define CALG_AES                       (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES)
#ifndef MS_ENH_RSA_AES_PROV
#ifdef UNICODE
#define MS_ENH_RSA_AES_PROV \
L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#else
#define MS_ENH_RSA_AES_PROV \
"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#endif
#endif /* MS_ENH_RSA_AES_PROV */

#ifndef CALG_HMAC
#define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
#endif

#define PROV_RSA_AES                           "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

      


      DWORD dwResult;
      HCRYPTPROV hProv;
      HCRYPTKEY hKey;
      HCRYPTKEY hSessionKey;
      DWORD cbBlob;
      BYTE *pbBlob;
      HCRYPTHASH hHash;

      //CString      m_cipher;
void Encrypt();
int main()
{

      
      if (!CryptAcquireContext(&hProv, NULL, MS_ENH_RSA_AES_PROV" (Prototype)", PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
                        {
                                    dwResult = GetLastError();
                              if (dwResult == NTE_BAD_KEYSET)
                                    {
                                                if (!CryptAcquireContext(&hProv,
                                                      NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES,
                                                            CRYPT_NEWKEYSET))
                                                      {
                                                            printf("error creating cryptoAcquireContext");
                                                      }
                                    }
   

                        }

                  if(CryptCreateHash(
                                                      hProv,
                                                       CALG_MD5,
                                                            0,
                                                            0,
                                                       &hHash))
                                    {
                                          printf("An empty hash object has been created. \n");
                                    }
                        else
                  {
                                    printf("Error during CryptBeginHash!\n");
                              exit(1);
                  }

            
      
                                    if (!CryptImportKey(hProv, pbBlob, cbBlob, 0, 0, &hSessionKey))
                                                {
                  
                                                      printf("error creating CryptImportKey");
                                                }
            

                              if (!CryptGenKey(hProv, CALG_AES_256, CRYPT_EXPORTABLE, &hSessionKey))
                                                {
                  
                                                      printf("error creating CryptGenKey");
                                                }      
      
    //Encrypt();
      return 0;
}


/*void Encrypt()
{
    //unsigned long length = m_clear.GetLength() +1;
      unsigned long length = 10;
    unsigned char * cipherBlock  ; // = (unsigned char*)malloc(length);
    LPCSTR mm = "hari";
      char myname[5] = "hari";
    memcpy(&cipherBlock, &myname, 10 -1);

    if (!CryptEncrypt(hSessionKey, 0, TRUE, 0, mm, &length, 9))
    {
        printf("error creating CryptEncrypt");
    }

    //m_cipher = cipherBlock;
    //m_clear = "";
    //free(cipherBlock);
}*/



Errors are

Deleting intermediate files and output files for project 'testcrypto - Win32 Debug'.
--------------------Configuration: testcrypto - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
testcrypto.cpp
C:\Documents and Settings\hariere\Desktop\testcrypto\testcrypto.cpp(57) : error C2664: 'CryptAcquireContextA' : cannot convert parameter 4 from 'char [66]' to 'unsigned long'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Documents and Settings\hariere\Desktop\testcrypto\testcrypto.cpp(64) : error C2664: 'CryptAcquireContextA' : cannot convert parameter 4 from 'char [66]' to 'unsigned long'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.

testcrypto.exe - 2 error(s), 0 warning(s)
0
 

Author Comment

by:hp746
ID: 24070327
if (!CryptAcquireContext(&hProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
the error is at the fourth parameter
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24071126
>>>>>error C2664: 'CryptAcquireContextA' : cannot convert parameter 4 from 'char [66]' to 'unsigned long'

It is the PROV_RSA_AES which you defined at the top

      #define PROV_RSA_AES  "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

as a string while the CryptAcquireContext expects an unsigned long.

The provider is the third argument while the fourth is the provider type whchis rarely is a string. You probably have to exchange parameter 3 and 4.




0
 

Author Comment

by:hp746
ID: 24071952
what values i can exchange?
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24072263
I would try to exchange MS_ENH_RSA_AES_PROV and PROV_RSA_AES cause the first is a ULONG and the second a LPCSTR as required from function.
0
 

Author Comment

by:hp746
ID: 24083771
i have exchanged parameters but it did not work
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24084360
>>>> MS_ENH_RSA_AES_PROV and PROV_RSA_AES

where did you get these parameters from?

>>>  have exchanged parameters but it did not work

Does it compile? If yes, does it call the function and what error (return) did you get?

Check both advapi32.dll and wincrypt.dll in system32 folder and tell me which create time they have.

Check all folders of your machine for elder versions of these dlls so that not the (old) ones coming with VC6 come to use.
0
 

Author Comment

by:hp746
ID: 24103781
advapi32.dll   =  Wednesday, August 04, 2004, 5:00:00 AM
and i have not seen wincrypt.dll  in my system32 directory.
i am using wincrypt.h header file in my program

0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24104584
>>>> and i have not seen wincrypt.dll  in my system32 directory.

it's crypt32.dll

>>>> advapi32.dll   =  Wednesday, August 04, 2004, 5:00:00 AM

young enough.

Could you get any error return when trying it?

And where are the constants MS_ENH_RSA_AES_PROV and PROV_RSA_AES from? Where did you know them?
0
 

Author Comment

by:hp746
ID: 24113382
crypt32.dll = Wednesday, August 04, 2004, 5:00:00 AM


>>>>the constants MS_ENH_RSA_AES_PROV and PROV_RSA_AES
I have defind in my program

#define ALG_SID_AES_128                 14
#define ALG_SID_AES_192                 15
#define ALG_SID_AES_256                 16
#define ALG_SID_AES                     17


#define CALG_AES_128                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
#define CALG_AES_192                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
#define CALG_AES_256                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
#define CALG_AES                       (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES)
#ifndef MS_ENH_RSA_AES_PROV
#ifdef UNICODE
#define MS_ENH_RSA_AES_PROV \
L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#else
#define MS_ENH_RSA_AES_PROV \
"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#endif
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24113697
>>>>the constants MS_ENH_RSA_AES_PROV and PROV_RSA_AES
>>> I have defind in my program

Yes, but where do you know from that they were the right ones?

And what is the error you can retrieve by calling GetLastError()?
0
 

Author Comment

by:hp746
ID: 24127354
This i have get on online i am  not if they are the right ones for the vc++ 6.0
I have to do encrypt/decrypt using CALG_AES_256  algorithim using VC++ 6.0
I am not sure if it is support vc++ 6.0
if it support please let me know how can i apporach to solve the problem or if you have any example in vc++ 6.0 using CALG_AES_256 that would be great
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24136544
>>>> I am not sure if it is support vc++ 6.0

It definitively isn't supported by VC 6.0 (as proofed by the missing constant definitions). But there has been a chance that newer advapi32.dll and crypt32.dll could provide the needed functionality.

But you didn't tell what errors you have though I asked a few times. So it is difficult to help.

0
 

Author Comment

by:hp746
ID: 24137820
here is the error





error C2664: 'CryptAcquireContextA' : cannot convert parameter 4 from 'char [66]' to 'unsigned long'


here is my code snippet


// testcrypto.cpp : Defines the entry point for the console application.
//


#include "stdafx.h"


#include<string.h>
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include<malloc.h>
#include <wincrypt.h>
#define ALG_SID_AES_128                 14
#define ALG_SID_AES_192                 15
#define ALG_SID_AES_256                 16
#define ALG_SID_AES                     17


#define CALG_AES_128                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
#define CALG_AES_192                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
#define CALG_AES_256                   (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
#define CALG_AES                       (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES)
#ifndef MS_ENH_RSA_AES_PROV
#ifdef UNICODE
#define MS_ENH_RSA_AES_PROV \
L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#else
#define MS_ENH_RSA_AES_PROV \
"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#endif
#endif /* MS_ENH_RSA_AES_PROV */

#ifndef CALG_HMAC
#define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
#endif

#define PROV_RSA_AES                           "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

      


      DWORD dwResult;
      HCRYPTPROV hProv;
      HCRYPTKEY hKey;
      HCRYPTKEY hSessionKey;
      DWORD cbBlob;
      BYTE *pbBlob;
      HCRYPTHASH hHash;

      //CString      m_cipher;
void Encrypt();
int main()
{

      
      if (!CryptAcquireContext(&hProv, NULL,  MS_ENH_RSA_AES_PROV ,PROV_RSA_AES,CRYPT_VERIFYCONTEXT))
                        {
                                    
            
                              dwResult = GetLastError();
                              if (dwResult == NTE_BAD_KEYSET)
                                    {
                                                if (!CryptAcquireContext(&hProv,
                                                      NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES,
                                                            CRYPT_NEWKEYSET))
                                                      {
                                                            printf("error creating cryptoAcquireContext");
                                                      }
                                    }
   

                        }

                  if(CryptCreateHash(
                                                      hProv,
                                                       CALG_AES_256,
                                                            0,
                                                            0,
                                                       &hHash))
                                    {
                                          printf("An empty hash object has been created. \n");
                                    }
                        else
                  {
                                    printf("Error during CryptBeginHash!\n");
                              exit(1);
                  }

            
      
                                    if (!CryptImportKey(hProv, pbBlob, cbBlob, 0, 0, &hSessionKey))
                                                {
                  
                                                      printf("error creating CryptImportKey");
                                                }
            

                              if (!CryptGenKey(hProv, CALG_AES_256, CRYPT_EXPORTABLE, &hSessionKey))
                                                {
                  
                                                      printf("error creating CryptGenKey");
                                                }      
      
    //Encrypt();
      return 0;
}



0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24141274
That is a compiler error, which doesn't let make any statements to the runtime behavior.


Here is the prototype of ContextAcquireNext

BOOL WINAPI CryptAcquireContext(
  HCRYPTPROV* phProv,
  LPCTSTR pszContainer,
  LPCTSTR pszProvider,
  DWORD dwProvType,
  DWORD dwFlags
);

You see, argument 2 and 3 are strings (long pointer to const T string, where T means single-byte - ANSI - if not a UNICODE project) while argument 4 is a DWORD (unsigned integer). But you were passing PROV_RSA_AES as 4th argument which is defined as a string.

#define PROV_RSA_AES   "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"

The 4th argument is the 'provider type' while you were passing the 'provider name'.

If you check the definition of MS_ENH_RSA_AES_PROV  which you were passing as 3rd argument, you see that it is the same string as for PROV_RSA_AES what obviously is false.

In my wincrypt.h I found

#define PROV_RSA_AES            24

You should check, whether your wincrypt.h already contains that definition. If yes, simply drop the above redefinition. If no, exchange the wrong definition of PROV_RSA_AES with the one above. You also could call

if (!CryptAcquireContext(&hProv, NULL,  MS_ENH_RSA_AES_PROV ,24,CRYPT_VERIFYCONTEXT))

though that is less recommended.
0
 

Author Comment

by:hp746
ID: 24144494
if(!CryptCreateHash(hProv,CALG_AES_256, 0, 0,  &hHash)) is failing

when i change to CALG_AES_128 i have not seen any issue .
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 24145207
>>>> if(!CryptCreateHash(hProv,CALG_AES_256, 0, 0,  &hHash)) is failing

check the error code by calling

     int rc = GetLastError();
0
 

Author Comment

by:hp746
ID: 24164151
hmm My Problem sloved  I Really thank you very much  "itsmeandnobodyelse" to lsove this problem
I thank you very much EE Community .
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now