Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NTE_PERM

157 views
Skip to first unread message

Martin

unread,
May 19, 2003, 9:11:02 AM5/19/03
to
I keep getting NTE_PERM when calling HttpSendRequest on one computer. I have
never heard of anybody getting this error before and I have no idea why it
happens.

Any help or just info about NTE_PERM would be much appreciated.

/Martin


Michael Howard [MSFT]

unread,
May 19, 2003, 12:39:48 PM5/19/03
to
i bet you're using the French locale, read this:

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

unread,
May 20, 2003, 3:21:16 AM5/20/03
to
At first I thought so to but that is not the case since the Computer where I
get the problem is running a Windows 2000 OS.

/Martin


"Michael Howard [MSFT]" <mik...@online.microsoft.com> skrev i meddelandet
news:uhKeEViH...@TK2MSFTNGP10.phx.gbl...

Michael Howard [MSFT]

unread,
May 20, 2003, 1:34:22 PM5/20/03
to
i looked into this further - every instance of this error in Windows is
crypto-related, basically indicating crypto is disabled. which begs the
following questions:

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...

John Banes [MS]

unread,
May 20, 2003, 11:06:46 PM5/20/03
to
I believe the issue described in the following link causes the NTE_PERM
error to be returned sometimes. It's worth a try...

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...

Martin

unread,
May 21, 2003, 10:04:55 AM5/21/03
to
I am doing a HttpSendReques in a https enviroment. So I guess there are som
crypto related stuff involved.There are also som smart cards and stuff
involved with certificates and public/private keys. So yes there are crypto
stuff involved in some way. The HEX I'm getting is : 80090010 which as far
as I can find out only corresponds to NTE_PERM.

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

unread,
May 22, 2003, 2:32:38 AM5/22/03
to
That wasn't the case either.

/Martin

"John Banes [MS]" <jba...@online.microsoft.com> skrev i meddelandet
news:OoweFY0H...@TK2MSFTNGP10.phx.gbl...

Michael Howard [MSFT]

unread,
May 22, 2003, 1:42:26 PM5/22/03
to
can you pls send a small snippet of the code?

--

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...

Martin

unread,
May 23, 2003, 2:29:11 AM5/23/03
to
First I'd like to thank you for you taking time to look at my problem.

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...

Michael Howard [MSFT]

unread,
May 27, 2003, 12:30:15 PM5/27/03
to
the code looks kinda ok - but i wasn't aware you meant client auth certs
however!! ok, here's another test - can you use this same client auth cert
with an SSL connection from inside IE? if yes, then there's probably a bug
in your code, of no, then there's something wrong with the installation of
the cert and private key.

--

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...

0 new messages