Esempio n. 1
0
 public static void DeleteSsl(IPEndPoint iPEndPoint)
 {
     if (iPEndPoint == null)
     {
         return;
     }
     using (HttpConfigSslEntryInterop interop = new HttpConfigSslEntryInterop(iPEndPoint))
     {
         HTTP_SERVICE_CONFIG_SSL_SET configInformation = interop.GetConfigInformation();
         ErrorCode errorCode = HttpDeleteServiceConfiguration(IntPtr.Zero, HTTP_SERVICE_CONFIG_ID.HttpServiceConfigSSLCertInfo, ref configInformation, Marshal.SizeOf(configInformation), IntPtr.Zero);
         if (errorCode != ErrorCode.ERROR_FILE_NOT_FOUND && errorCode != ErrorCode.ERROR_SUCCESS)
         {
             throw new Win32Exception((int)errorCode);
         }
     }
 }
Esempio n. 2
0
 public static void CreateSsl(HttpConfigSslEntry entry)
 {
     if (entry == null)
     {
         return;
     }
     using (HttpConfigSslEntryInterop interop = new HttpConfigSslEntryInterop(entry))
     {
         HTTP_SERVICE_CONFIG_SSL_SET configInformation = interop.GetConfigInformation();
         ErrorCode errorCode = HttpSetServiceConfiguration(IntPtr.Zero, HTTP_SERVICE_CONFIG_ID.HttpServiceConfigSSLCertInfo, ref configInformation, Marshal.SizeOf(configInformation), IntPtr.Zero);
         if (errorCode != ErrorCode.ERROR_SUCCESS)
         {
             throw new Win32Exception((int)errorCode);
         }
     }
 }