[NUI] Add WebView Certificate policy decision error get and suspend
authordongsug.song <dongsug.song@samsung.com>
Mon, 5 Aug 2024 12:58:58 +0000 (21:58 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Tue, 27 Aug 2024 07:35:19 +0000 (16:35 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.WebCertificate.cs
src/Tizen.NUI/src/internal/WebView/WebCertificate.cs

index b92c22bdf71e65d88b3f00f0b808e3a4e8b9935b..23e3965db12e6e289b2c2f846d24491ddf8a4d2e 100755 (executable)
@@ -37,6 +37,13 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_IsContextSecure")]
             [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
             public static extern bool IsContextSecure(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_GetPolicyDecisionError")]
+            public static extern int GetPolicyDecisionError(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebCertificate_SuspendPolicyDecision")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+            public static extern bool SuspendPolicyDecision(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
     }
 }
index 77670409b7ec1fdc9cf49e4962e6662709209df1..06451a371fc460a99238dcad141d790c22417221 100755 (executable)
@@ -90,5 +90,51 @@ namespace Tizen.NUI
             Interop.WebCertificate.Allow(SwigCPtr, allowed);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
+
+        /// <summary>
+        /// Get certificate policy decision error.
+        /// </summary>
+        /// <value>PolicyDecisionErrorType</value>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PolicyDecisionErrorType PolicyDecisionError
+        {
+            get
+            {
+                int result = Interop.WebCertificate.GetPolicyDecisionError(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) return PolicyDecisionErrorType.Unknown;
+                return (PolicyDecisionErrorType)result;
+            }
+        }
+
+        /// <summary>
+        /// Suspend certification policy decision.
+        /// </summary>
+        /// <returns></returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Suspend()
+        {
+            bool ret = Interop.WebCertificate.SuspendPolicyDecision(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum PolicyDecisionErrorType
+        {
+            CommonNameInvalid, //The server responded with a certificate whose common name did not match the host name.
+            DateInvalid, //The server responded with a certificate that by our clock, appears to either not yet be valid or to have expired.
+            AuthorityInvalid, // The server responded with a certificate that is signed by an authority we don't trust.
+            NoRevocationMechanism, // The certificate has no mechanism for determining if it is revoked. In effect, this certificate cannot be revoked.
+            UnableToCheckRevocation, // Revocation information for the security certificate for this site is not available.
+            Revoked, // The server responded with a certificate that has been revoked.
+            Invalid, // The server responded with a certificate that is invalid.
+            WeakAlgorithm, // The server responded with a certificate that is signed using a weak signature algorithm.
+            NonUniqueName, // The host name specified in the certificate is not unique.
+            WeakKey, // The server responded with a certificate that contains a weak key (e.g. a too-small RSA key).
+            PinnedKeyNotInChain, // The certificate didn't match the public key pins for the host name.
+            NameViolation, // The certificate claimed DNS names that are in violation of name constraints.
+            ValidityTooLong, // The certificate's validity period is too long.
+            Unknown = 1000 // Reported in case of wrong usage of ewk_certificate_policy_decision_error_get API.
+        }
     }
 }