encryption problem for wlan profile
- by Jassi
i am trying to encrypt keyMaterial element from wireless profile. so I want to convert byte array into OLECHAR but it is giving me wrong output not key sea the below code you may know the solution...
DATA_BLOB in;
DATA_BLOB out;
BYTE pin=(BYTE)"FIPL2";
DWORD din=strlen((char*)pin)+1;
in.pbData = pin;
in.cbData = din;
if(CryptProtectData(&in,L"what is it",NULL,NULL,NULL,0,&out))
{
BYTE *b=out.pbData;
USES_CONVERSION;
bstr=SysAllocString(W2BSTR((const WCHAR *)b));
HRCALL(peSubS222->put_text(bstr), "");
SysFreeString(bstr);
bstr=NULL;
}
else
{
cout<<"NOOOOOOOOOOOOOOOO :(";
}
what is missing please help me out