Any help or just info about NTE_PERM would be much appreciated.
/Martin
http://support.microsoft.com/default.aspx?scid=kb;en-us;259484
--
Cheers, Michael
Writing Secure Code 2nd Edition
(http://www.microsoft.com/MSPress/books/5957.asp)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Martin" <martin...@edicom.se> wrote in message
news:u8VraggH...@TK2MSFTNGP10.phx.gbl...
/Martin
"Michael Howard [MSFT]" <mik...@online.microsoft.com> skrev i meddelandet
news:uhKeEViH...@TK2MSFTNGP10.phx.gbl...
1) any chance this is NOT the error you're seeing? can you pls provide the
hex value?
2) are you doing something crypto-related?
--
Cheers, Michael
Writing Secure Code 2nd Edition
(http://www.microsoft.com/MSPress/books/5957.asp)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Martin" <martin...@edicom.se> wrote in message
news:ed$YsBqHD...@tk2msftngp13.phx.gbl...
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b310794
Regards,
John Banes
[Microsoft Security Developer]
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Martin" <martin...@edicom.se> wrote in message
news:u8VraggH...@TK2MSFTNGP10.phx.gbl...
One funny thing is that I get it through GetLastError but GetLastError only
have errors upp to just below 15000 and not HRESULT errors like NTE_PERM.
"Michael Howard [MSFT]" <mik...@online.microsoft.com> skrev i meddelandet
news:uYv7RYvH...@tk2msftngp13.phx.gbl...
/Martin
"John Banes [MS]" <jba...@online.microsoft.com> skrev i meddelandet
news:OoweFY0H...@TK2MSFTNGP10.phx.gbl...
--
Cheers, Michael
Writing Secure Code 2nd Edition
(http://www.microsoft.com/MSPress/books/5957.asp)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Martin" <martin...@edicom.se> wrote in message
news:e15n2H6H...@tk2msftngp13.phx.gbl...
Here is a snippet of the code that I'm using:
CSupportLog::Write(INFO,_T("CHttpsConnection::Send - Calling HttpSendRequest
1st Try."));
bRet = HttpSendRequest(m_hRequest, NULL, 0, (void*)i_pcBuffer, i_uLength);
if (!bRet)
{
CSupportLog::Write(ERR,_T("CHttpsConnection::Send - HttpSendRequest
failed"));
rc = ::GetLastError();
if (rc != ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED)
{
CString strTmp;
InternetCloseHandle(m_hRequest);
m_hRequest = NULL;
SetError(rc);
strTmp.Format("CHttpsConnection::Send - Error code : %u",rc);
CSupportLog::Write(ERR,strTmp);
Abort();
Disconnect();
return E_FAIL;
}
CSupportLog::Write(ERR,_T("CHttpsConnection::Send - HttpSendRequest
failure = ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED Continuing execution"));
if (WaitForSingleObject(m_hAbortEvent, 0) == WAIT_OBJECT_0)
{
//Abort();
return SetError(TCP_ABORT);
}
CString strTmp;
CSupportLog::Write(INFO,_T("--------------------------------------"));
CSupportLog::Write(INFO,_T("Cert info: "));
// Get subject
char szName[400];
CertNameToStr(X509_ASN_ENCODING, &m_pCertCtx->pCertInfo->Subject,
CERT_SIMPLE_NAME_STR, szName, 300);
strTmp.Format(_T("Name: %s"), szName);
CSupportLog::Write(INFO,strTmp);
CSupportLog::Write(INFO,_T("--------------------------------------"));
// Add cert
CSupportLog::Write(INFO,_T("CHttpsConnection::Send - Calling
InternetSetOption"));
bRet = InternetSetOption(m_hRequest,
INTERNET_OPTION_CLIENT_CERT_CONTEXT, (void*)m_pCertCtx,
sizeof(CERT_CONTEXT));
if (!bRet)
{
rc = ::GetLastError();
CString strTmp;
InternetCloseHandle(m_hRequest);
m_hRequest = NULL;
SetError(rc);
CSupportLog::Write(ERR,_T("CHttpsConnection::Send -
InternetSetOption failed"));
strTmp.Format("CHttpsConnection::Send - Error code : %u",rc);
CSupportLog::Write(ERR,strTmp);
Abort();
return E_FAIL;
}
// Cancelled?
if (WaitForSingleObject(m_hAbortEvent, 0) == WAIT_OBJECT_0)
{
//Abort();
return SetError(TCP_ABORT);
}
// Resend
CSupportLog::Write(INFO,_T("CHttpsConnection::Send - HttpSendRequest 2nd
try with cert"));
bRet = HttpSendRequest(m_hRequest, NULL, 0, (void*)i_pcBuffer,
i_uLength);
if (!bRet)
{
CSupportLog::Write(ERR,_T("CHttpsConnection::Send - HttpSendRequest
failed"));
CString strTmp;
rc = ::GetLastError();
strTmp.Format("CHttpsConnection::Send - Error code : %u",rc);
CSupportLog::Write(ERR,strTmp);
InternetCloseHandle(m_hRequest);
m_hRequest = NULL;
SetError(rc);
Abort();
return E_FAIL;
}
}
I will also add a bit from our logging so tht you can see the flow of the
comunication process:
11:26:20 CHttpsConnection::Connect - Entering Connect
11:26:20 CHttpsConnection::Connect - Calling InternetOpen
11:26:20 CHttpsConnection::Connect - Calling InternetConnect
11:26:20 CHttpsConnection::Connect - Internet Connection Session
created
11:26:29 CHttpsConnection::Connect - Calling CertOpenSystemStore
11:26:29 --------Starting to loop trough the certs------------
11:26:29 Looking for: SE, Helene Rosen...
11:26:29 CHttpsConnection::Connect - Loop untill we find our cert
11:26:29 Found: SE, Helene Rosen...
11:26:29 CHttpsConnection::Connect - Found Cert
11:26:29 ---------End loop trough the certs-------------------
11:26:29 --------------------------------------
11:26:29 CHttpsConnection::Connect
11:26:29 Cert info:
11:26:29 Name: SE, Helene Rosen...
11:26:29 --------------------------------------
11:26:29 CHttpsConnection::Connect - Calling SetPin
11:26:29 CHttpsConnection::SetPin - Entering
11:26:29 CHttpsConnection::SetPin -
CertGetCertificateContextProperty 1 Succeded
11:26:29 CHttpsConnection::SetPin -
CertGetCertificateContextProperty 2 Succeded
11:26:29 CHttpsConnection::SetPin - PP_KEYEXCHANGE_PIN
11:26:29 CHttpsConnection::SetPin - CryptAcquireContext Succeded
11:26:29 CHttpsConnection::SetPin - CryptSetProvParam Succeded
11:26:29 CHttpsConnection::Send - Calling CheckConnect
11:26:29 CHttpsConnection::Send - Calling HttpOpenRequest
11:26:29 CHttpsConnection::Send - Adding Headers
11:26:29 CHttpsConnection::Send - Headers added
11:26:29 --------------------------------------
11:26:29 CHttpsConnection::Send - Calling HttpSendRequest Size: 62
11:26:29 --------------------------------------
11:26:29 CHttpsConnection::Send - Calling HttpSendRequest 1st Try.
11:26:30 ERROR - CHttpsConnection::Send - HttpSendRequest failed
11:26:30 ERROR - CHttpsConnection::Send - HttpSendRequest failure =
ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED Continuing execution
11:26:30 --------------------------------------
11:26:30 Cert info:
11:26:30 Name: SE, Helene Rosen...
11:26:30 --------------------------------------
11:26:30 CHttpsConnection::Send - Calling InternetSetOption
11:26:30 CHttpsConnection::Send - HttpSendRequest 2nd try with cert
11:26:33 ERROR - CHttpsConnection::Send - HttpSendRequest failed
11:26:33 ERROR - CHttpsConnection::Send - Error code : 2148073488l
/Martin
"Michael Howard [MSFT]" <mik...@online.microsoft.com> skrev i meddelandet
news:e4rFEmII...@TK2MSFTNGP11.phx.gbl...
--
Cheers, Michael
Writing Secure Code 2nd Edition
(http://www.microsoft.com/MSPress/books/5957.asp)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Martin" <martin...@edicom.se> wrote in message
news:e$tBhSPID...@TK2MSFTNGP10.phx.gbl...