return false when implementing setSecurityParams

return false when implementing setSecurityParams

Anonymous
Not applicable
713 Views
5 Replies
Message 1 of 6

return false when implementing setSecurityParams

Anonymous
Not applicable
always return false,implementing setSecurityParams. I don't know why it will be caused!!! please,help me.

CString csBuffer = _T("111111");
wchar_t *pwdBuf = csBuffer.AllocSysString();
CString csProvName = _T("Microsoft Base Cryptographic Provider v1.0");
wchar_t *provName = csProvName.AllocSysString();

AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();

SecurityParams *secParams = new SecurityParams();
secParams->cbSize = 48;
secParams->ulFlags = 1;
secParams->ulProvType = 1;
secParams->ulAlgId = 26625;
secParams->ulKeyLength = 40;
secParams->wszPassword = pwdBuf;
secParams->wszProvName = provName;

bool ret = pDb->setSecurityParams(secParams);

delete secParams;
0 Likes
714 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Place a breakpoint at the call to setSecurityParams and inspect the
password and provider that you are passing to the function. I don't think
those values are what you think they are. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


wrote in message news:[email protected]...
always return false,implementing setSecurityParams. I don't know why it will
be caused!!! please,help me.

CString csBuffer = _T("111111");
wchar_t *pwdBuf = csBuffer.AllocSysString();
CString csProvName = _T("Microsoft Base Cryptographic Provider v1.0");
wchar_t *provName = csProvName.AllocSysString();

AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();

SecurityParams *secParams = new SecurityParams();
secParams->cbSize = 48;
secParams->ulFlags = 1;
secParams->ulProvType = 1;
secParams->ulAlgId = 26625;
secParams->ulKeyLength = 40;
secParams->wszPassword = pwdBuf;
secParams->wszProvName = provName;

bool ret = pDb->setSecurityParams(secParams);

delete secParams;
0 Likes
Message 3 of 6

Anonymous
Not applicable
I inspected the
password and provide, those values are no problems.But also return false.
the results are in the attach files.
0 Likes
Message 4 of 6

Anonymous
Not applicable
> I inspected the password and provide, those values are no problems.

You are allocating a BSTR and assigning the BSTR to the wchar_t* members
of the SecurityParams structure (and not freeing the BSTR as I recall).
This is incorrect usage, despite the compiler not detecting the problem. It
may not be the cause of the problem in your case, but I would start by
setting those values correctly. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
0 Likes
Message 5 of 6

pkohut-og
Contributor
Contributor
cbSize is wrong as well.

Paul Kohut
0 Likes
Message 6 of 6

Anonymous
Not applicable
can you provide a sample about setSecurityParams?
0 Likes