Discussion:
IE7 error getting server certificate
(too old to reply)
Jason
2006-11-17 21:33:13 UTC
Permalink
I have an application that uses Wininet to connect to other servers. For
one we need to get and check the server certificate and see if it is valid.
All works fine with IE6, but upgrading to IE7 and the program fails. When
checking trhe information manually using IE7 I can see the certificate and
everything looks fine. When using WININET to get the information I get an
errorcode 120 (INVALID BUFFER). I have tried increasing the buffer, but I
always get the error. I have checked the new settings in the Internet
Options to make sure that SSL is enabled and have checked the encryption of
the site to make sure it is 128-bit. I don't know what else to do. I am
using the following code:

IF
InternetQueryOption(hRequest,INTERNET_OPTION_SECURITY_CERTIFICATE,,dwBytesAvailable)

If there is anyone that can help point me in the right direction, I would
really appreciate it.
--
Jason Johnson
***@att.net
Vladimir Scherbina
2006-11-23 21:52:11 UTC
Permalink
Jason,

Can you please write the exact code you're using? Some public sever also
will be good to test it on my side.

--
Vladimir (Windows SDK MVP)
Post by Jason
I have an application that uses Wininet to connect to other servers. For
one we need to get and check the server certificate and see if it is valid.
All works fine with IE6, but upgrading to IE7 and the program fails. When
checking trhe information manually using IE7 I can see the certificate and
everything looks fine. When using WININET to get the information I get an
errorcode 120 (INVALID BUFFER). I have tried increasing the buffer, but I
always get the error. I have checked the new settings in the Internet
Options to make sure that SSL is enabled and have checked the encryption of
the site to make sure it is 128-bit. I don't know what else to do. I am
IF
InternetQueryOption(hRequest,INTERNET_OPTION_SECURITY_CERTIFICATE,,dwBytesAvailable)
If there is anyone that can help point me in the right direction, I would
really appreciate it.
--
Jason Johnson
Jason
2006-12-27 08:58:28 UTC
Permalink
Thanks for the reply. That's what I do now but I get the error afterwards.
I should have posted the code, so here it is.

lpBuffer &= NEW(CSTRING(1))
dwBytesAvailable = 0
IF ~InternetQueryOption(hRequest,INTERNET OPTION SECURITY
CERTIFICATE,,dwBytesAvailable)
LastError = GetLastError()
Case LastError
Of 122 ! This checks for
buffer size
DISPOSE(lpBuffer) ! This re-creates the
buffer in the right size
lpBuffer &= NEW(CSTRING(dwBytesAvailable + 1))
IF InternetQueryOption(hRequest,INTERNET OPTION SECURITY
CERTIFICATE,lpBuffer,dwBytesAvailable)
ReturnStr = Sub(ReturnStr,1,Len(ReturnStr)) & lpBuffer
Retcode = 1
ELSE
LastError = GetLastError() ! Here is where I get
the Error 122
MessageDisplay = 'Certificate Query Error: ' &
Clip(LastError); Display
End
Else
MessageDisplay = 'Certificate Query Error: ' &
Clip(LastError); Display
End
End
DISPOSE(lpBuffer)


This code works fine with IE6, but IE7 gives the error and no certificate
information is returned. Any thoughts?
Post by Vladimir Scherbina
Jason,
Can you please write the exact code you're using? Some public sever also
will be good to test it on my side.
--
Vladimir (Windows SDK MVP)
Post by Jason
I have an application that uses Wininet to connect to other servers. For
one we need to get and check the server certificate and see if it is
valid. All works fine with IE6, but upgrading to IE7 and the program
fails. When checking trhe information manually using IE7 I can see the
certificate and everything looks fine. When using WININET to get the
information I get an errorcode 120 (INVALID BUFFER). I have tried
increasing the buffer, but I always get the error. I have checked the new
settings in the Internet Options to make sure that SSL is enabled and have
checked the encryption of the site to make sure it is 128-bit. I don't
IF
InternetQueryOption(hRequest,INTERNET_OPTION_SECURITY_CERTIFICATE,,dwBytesAvailable)
If there is anyone that can help point me in the right direction, I would
really appreciate it.
--
Jason Johnson
Vladimir Scherbina
2006-11-23 21:57:05 UTC
Permalink
Just a hint. Did you tried getting the data using
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT flag?

--
Vladimir (Windows SDK MVP)
Post by Jason
I have an application that uses Wininet to connect to other servers. For
one we need to get and check the server certificate and see if it is valid.
All works fine with IE6, but upgrading to IE7 and the program fails. When
checking trhe information manually using IE7 I can see the certificate and
everything looks fine. When using WININET to get the information I get an
errorcode 120 (INVALID BUFFER). I have tried increasing the buffer, but I
always get the error. I have checked the new settings in the Internet
Options to make sure that SSL is enabled and have checked the encryption of
the site to make sure it is 128-bit. I don't know what else to do. I am
IF
InternetQueryOption(hRequest,INTERNET_OPTION_SECURITY_CERTIFICATE,,dwBytesAvailable)
If there is anyone that can help point me in the right direction, I would
really appreciate it.
--
Jason Johnson
Jason
2006-12-27 09:00:31 UTC
Permalink
I wanted to try to use the struct, but I do not know how to set this up in
my programming language. I am using Topspeed Clarion v5.0. Thanks again
for the help.

Sorry I haven;t replied, but I was in the hospital for a while and have just
now been able to get back to work.
Post by Vladimir Scherbina
Just a hint. Did you tried getting the data using
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT flag?
--
Vladimir (Windows SDK MVP)
Post by Jason
I have an application that uses Wininet to connect to other servers. For
one we need to get and check the server certificate and see if it is
valid. All works fine with IE6, but upgrading to IE7 and the program
fails. When checking trhe information manually using IE7 I can see the
certificate and everything looks fine. When using WININET to get the
information I get an errorcode 120 (INVALID BUFFER). I have tried
increasing the buffer, but I always get the error. I have checked the new
settings in the Internet Options to make sure that SSL is enabled and have
checked the encryption of the site to make sure it is 128-bit. I don't
IF
InternetQueryOption(hRequest,INTERNET_OPTION_SECURITY_CERTIFICATE,,dwBytesAvailable)
If there is anyone that can help point me in the right direction, I would
really appreciate it.
--
Jason Johnson
Continue reading on narkive:
Loading...