encryption problem for wlan profile

Posted by Jassi on Stack Overflow See other posts from Stack Overflow or by Jassi
Published on 2010-03-11T09:31:35Z Indexed on 2010/03/12 5:27 UTC
Read the original article Hit count: 207

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about vc++

Related posts about Windows