PDA

View Full Version : IMVCrypt usage SetKey



FS7
August 19, 2009, 14:34:55
Hi,

could anybody get me an example, how IMVCrypt::SetKey is to call?

I allways get HRESULT 0x80070057 (An invalid parameter was passed to the returning function)

My Code:
CString strK = "9471BD247F6B887FA291...";
BYTE *byteK = new BYTE[strK.GetLength()+1];
ZeroMemory(byteK,strK.GetLength()+1);
memcpy(&byteK[0],strK,strK.GetLength());
hr = pNWCrypt->SetKey(strK.GetLength(), byteK); //hr=0x80070057
delete [] byteK;


Any Idea?

Bestz Regards
FS7

FS7
August 21, 2009, 10:30:21
Hi again,

in the meantime i was testing something:

// Create Key, Succeeded!
hr = pNWCrypt->CreateKey();

// Get Key, Succeeded!
int length=0;
BYTE pkey[MAX_KEY_LENGTH];
ZeroMemory(pkey,MAX_KEY_LENGTH);
hr = pNWCrypt->GetKey(MAX_KEY_LENGTH, &length, pkey);

// Set Key, Failed with 80070057 (An invalid parameter was passed to the returning function)!!!!
hr = pNWCrypt->SetKey(length, pkey);

What's wrong?
I just set the key i got before!

For any idea i would be happy!

Marc Cymontkowski
August 21, 2009, 17:43:45
Hi,

Please ignore the current return value, as it is not set to S_OK after a successful operation. We will fix this issue in the next filter version.


Thank You,

Marc Cymontkowski