internetsetoption is not working with INTERNET_OPTION_SECURITY_FLAGS

This is a discussion on internetsetoption is not working with INTERNET_OPTION_SECURITY_FLAGS within the Windows Programming forums, part of the Platform Specific Boards category; I am using below code in my program. Initial query function returns flags value as 256(unknown CA) error. I have ...

  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    12

    internetsetoption is not working with INTERNET_OPTION_SECURITY_FLAGS

    I am using below code in my program. Initial query function returns flags value as 256(unknown CA) error. I have used this line "Flags &= ~SECURITY_FLAG_IGNORE_UNKNOWN_CA;" to remove the unknown CA value from flag and passed the value to internetsetoption function. This internetsetoption function doesnt throw any error and also fuction also not successful. Final query function also returns same value 256 instead of giving value as 0
    Can you please clarify why the flag value is not set when is used set function?

    Code:
    uint32 Flags=0;
    
    uint32 Flags_test=0;
    
    uint32 Length = sizeof(Flags);
    
    if (!InternetQueryOption(Handle, INTERNET_OPTION_SECURITY_FLAGS, &Flags,&Length))
    {
    if any erro logged here
    }
    
    Flags &= ~SECURITY_FLAG_IGNORE_UNKNOWN_CA;
    
    if (!InternetSetOption(Handle, INTERNET_OPTION_SECURITY_FLAGS, &Flags, sizeof(uint32))) 
    {
    
    if any erro logged here
    }
    
    if (!InternetQueryOption(Handle, INTERNET_OPTION_SECURITY_FLAGS, &Flags,&Length))
    {
    if any erro logged here
    }

  2. #2

  3. #3
    Registered User
    Join Date
    Jun 2013
    Posts
    12
    Hi, The above one points to set the unknown CA flag. My goal is to remove already stored flag "Security_flag_ignore_unknown_ca" in the handle.

    In detail, I have set the flag case 1 and case 2 based on my configuration value in my product for HTTPS self signed certificate communication. Suppose if i use the case 1 flag, then i am getting the security warning pop up continuously for subsequent https connection without any issues.If i use the case 2 flag, then i am getting the security warning only one time for HTTPS connection.It is not showing security warning for susbsequent Https connection. Is this expected one? Is there any cache value stored if i press yes in the security warning pop up?
    Suppose if i use case 2 flag and then case 1 flag after changing the configured value, then i am not at all getting security warning pop up. How to get the security warning pop up in this case? if cache value is stored, then how to clean up the cache by using any fucntion? In this case, if i restart the product, then i am getting security warning pop up.
    case 1:
    Flags |= SECURITY_FLAG_IGNORE_REVOCATION;
    case 2:
    Flags &= ~SECURITY_FLAG_IGNORE_REVOCATION;
    Security WARNING POP UP:
    This page requires a secure connection which includes server authentication. The certifcate Issuer for this site is untrusted or unknown. Do you wish to proceed?

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    >> It is not showing security warning for susbsequent Https connection. Is this expected one?
    InternetErrorDlg function (Windows)
    Are you using FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS? If so, remove that flag and see if the popup occurs on each connect.

    >> SECURITY_FLAG_IGNORE_REVOCATION
    That is different from "Unknown CA".

    gg

  5. #5
    Registered User
    Join Date
    Jun 2013
    Posts
    12
    Thanks for you guidance.


    I have tried by removing "FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS" in the InternetErrorDlg function, then also i am facing the same issues.


    I understand that "SECURITY_FLAG_IGNORE_REVOCATION" is different from unknow CA. In my case, when i set the flag "SECURITY_FLAG_IGNORE_REVOCATION", then i am getting continuous security warning popup and there is no flag set at the time of Httpopenrequest handle.


    when there is no "SECURITY_FLAG_IGNORE_REVOCATION" flag, then i am not getting continuous security warning only two times recived that warning and there is some flag set 0x20000101 (SECURITY_FLAG_STRENGTH_STRONG,SECURITY_FLAG_SECUR E and SECURITY_FLAG_IGNORE_UNKNOWN_CA) by default when i troublshooting the code. I havent set those 3 flags in my code explicitly. I feel that i may get security warning pop up continuously when i removed those 3 flags. but inetnetset option failed to remove those 3 flags. Whether wininet API set those 3 flags. How to remove those 3 flags to show security warning pop up.

  6. #6
    Registered User
    Join Date
    Jun 2013
    Posts
    12
    Can you please have any update for this?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why is this not working?
    By PYROMANIAC702 in forum C Programming
    Replies: 9
    Last Post: 07-25-2011, 10:56 PM
  2. Replies: 9
    Last Post: 03-30-2009, 05:09 AM
  3. how this C working?
    By nebrom in forum C Programming
    Replies: 3
    Last Post: 05-27-2007, 02:27 AM
  4. how to use internetsetoption?
    By orcher in forum C++ Programming
    Replies: 2
    Last Post: 06-22-2004, 01:10 AM
  5. do-while isn't working help
    By student2005 in forum C++ Programming
    Replies: 2
    Last Post: 01-19-2004, 06:29 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21