ksachdeva
2008-10-13 20:21:41 UTC
Hi,
This is what I am trying to achieve in a nutshell:
- have a scriptable browser plugin (activex)
- when it is instantiated before it does his work I would like to
verify if the user is on an https site [not a problem, i could do
this]
- validate if the ssl handshake succeeded [the place where I am having
problems]
On this group and elsewhere I saw the reference to two APIs which
_may_ help me but not able to work with them.
First one is InternetQueryOption
I invoke it like this -
char szBuf[4096] = { 0 };
DWORD nsize = 4096;
BOOL success =
InternetQueryOption(NULL,INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,szBuf,&nsize);
if (success) {
// certificate information is now in certInfo
}else{
DWORD errorCode = GetLastError();
}
but the result is always FALSE. When I use GetLastError() I get 0x2ef2
which means invalid internet handle. I passing NULL as HINTERNET
parameter. This implies I have to pass a handle but from where do I
get it for a given browser sessions ?
Second is : InternetGetCertByURL
This is an undocumented API of wininet as mentioned here
http://groups.google.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/browse_frm/thread/3cca033353a0d02b
but I always get FALSE and on top of that GetLastError() also return
zero which does not help
Would appreciate if some one could help.
Regards & thanks
Kapil
This is what I am trying to achieve in a nutshell:
- have a scriptable browser plugin (activex)
- when it is instantiated before it does his work I would like to
verify if the user is on an https site [not a problem, i could do
this]
- validate if the ssl handshake succeeded [the place where I am having
problems]
On this group and elsewhere I saw the reference to two APIs which
_may_ help me but not able to work with them.
First one is InternetQueryOption
I invoke it like this -
char szBuf[4096] = { 0 };
DWORD nsize = 4096;
BOOL success =
InternetQueryOption(NULL,INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,szBuf,&nsize);
if (success) {
// certificate information is now in certInfo
}else{
DWORD errorCode = GetLastError();
}
but the result is always FALSE. When I use GetLastError() I get 0x2ef2
which means invalid internet handle. I passing NULL as HINTERNET
parameter. This implies I have to pass a handle but from where do I
get it for a given browser sessions ?
Second is : InternetGetCertByURL
This is an undocumented API of wininet as mentioned here
http://groups.google.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/browse_frm/thread/3cca033353a0d02b
but I always get FALSE and on top of that GetLastError() also return
zero which does not help
Would appreciate if some one could help.
Regards & thanks
Kapil