Method for dynamically managing client data transmission
Through dynamic management of client data transmission method, SSL certificate verification is processed separately for non-HTTPS and HTTPS applications, normal access to mobile applications without certificates is achieved, and the problem of difficult to ensure data transmission security in internal LAN is improved. Autonomous selectivity and efficiency of applications.
Patent Information
- Application Number
- CN202411233188.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-04
AI Technical Summary
When the existing technology is deployed in an internal LAN, users are reluctant to apply for domain names and HTTPS certificates, which makes it difficult to ensure the security of data transmission. Especially when the mobile side does not have HTTPS certificates, the application cannot access and run normally.
Through dynamic management of client data transfer methods, create an OkHttpClient client that does not verify SSL certificates for non-HTTPS applications, use custom cookieJar and TrustManager to trust all certificates, ignore SSL errors; create an OkHttpClient client that does not verify SSL certificates for HTTPS applications, load Apply built-in and external certificates, configure SSLContext and SSLSocketFactory, verify SSL certificates, and make secure requests based on this.
It realizes compatible operation of HTTPS applications and non-HTTPS applications, ensuring that mobile applications can still access normally without HTTPS certificates, improving user selectivity and usage satisfaction, saving implementation costs, and improving application efficiency and scope.
Smart Images

Figure CN119011559A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method for dynamically managing client data transmission, and relates to the field of information security. Background Art
[0002] Existing C / S architecture applications usually use HTTP and HTTPS protocols for data transmission.
[0003] HTTP (HyperText Transfer Protocol) is an application layer transmission protocol based on TCP. User data is encapsulated through the application layer, transport layer, network layer, and link layer, and then sent to the target machine through the physical layer. In these layers, the data is not encrypted, so sensitive data may cause data leakage, data tampering, data replay and other related security issues.
[0004] The current mainstream alternative technology is to use the HTTPS protocol to replace the HTTP protocol. The HTTPS protocol is an HTTP channel with security as its goal. It ensures the security of the transmission process through transmission encryption and identity authentication based on HTTP. HTTPS adds SSL to HTTP. The security foundation of HTTPS is SSL, so the detailed encryption content requires SSL. However, in actual deployment, it is often encountered that the application is deployed in the user's internal LAN, and the user does not want to apply for a domain name and the corresponding HTTPS certificate. In this case, other encryption solutions are needed to ensure the security of information transmission. Summary of the invention
[0005] In view of the problems of the prior art, the present invention provides a method for dynamically managing client data transmission, which dynamically manages the compatible operation of HTTPS applications and non-HTTPS applications, and ensures that the applications accessed on the mobile terminal can still be accessed and operated normally even if they do not have HTTPS certificates, thereby improving the user's independent selectivity and usage satisfaction, saving application implementation costs, and improving application efficiency and application scope.
[0006] The specific scheme proposed by the present invention is:
[0007] The present invention provides a method for dynamically managing client data transmission, comprising:
[0008] When accessing non-HTTPS applications, create an OkHttpClient client that does not verify the SSL certificate, set a custom CookieJar to manage cookies, use ArrayMap to store cookies for each domain name, and trust all certificates through TrustManager.
[0009] When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission.
[0010] When accessing an HTTPS application, create an OkHttpClient that verifies the SSL certificate, make a request based on the configured certificate, set a custom CookieJar for managing cookies, load the application's built-in certificate files, and the certificate files in the external storage, configure SSLContext and SSLSocketFactory, and build a TrustManager based on the loaded certificate, verify the SSL certificate, and make a secure HTTPS request based on this for data transmission.
[0011] Furthermore, in the method for dynamically managing client data transmission, when a non-HTTPS application is accessed, after creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null, and if so, create a new Builder;
[0012] Similarly, when accessing HTTPS applications, after creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null. If so, create a new Builder.
[0013] Furthermore, in the method for dynamically managing client data transmission, when accessing a non-HTTPS application, hostnameVerifier is set, true is returned, and hostname verification is ignored.
[0014] Similarly, when accessing HTTPS applications, set hostnameVerifier and return true to ignore hostname verification.
[0015] Furthermore, in the method for dynamically managing client data transmission, for non-HTTPS application access, a timeout period, DNS resolution, and event listener are configured, and an unsafe OkHttpClient instance is constructed and returned.
[0016] Similarly, when accessing HTTPS applications, configure the timeout, DNS resolution, and event listeners, and build and return a secure OkHttpClient instance.
[0017] The present invention also provides a device for dynamically managing client data transmission, including a non-HTTPS application access management module and a HTTPS application access management module.
[0018] When accessing non-HTTPS applications, the non-HTTPS application access management module creates an OkHttpClient client that does not verify the SSL certificate, sets a custom CookieJar for managing cookies, uses ArrayMap to store cookies for each domain name, and trusts all certificates through TrustManager.
[0019] When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission.
[0020] When the non-HTTPS application access management module accesses an HTTPS application, it creates an OkHttpClient that verifies the SSL certificate, makes requests based on the configured certificate, sets a custom CookieJar for managing cookies, loads the application's built-in certificate files, and the certificate files in the external storage, configures SSLContext and SSLSocketFactory, and builds a TrustManager based on the loaded certificate, verifies the SSL certificate, and makes secure HTTPS requests based on this for data transmission.
[0021] Further, when the non-HTTPS application access management module in the device for dynamically managing client data transmission accesses a non-HTTPS application, after creating an OkHttpClient client, it checks whether the passed-in OkHttpClient.Builder is null, and if so, creates a new Builder;
[0022] Similarly, when the HTTPS application access management module accesses the HTTPS application, after creating the OkHttpClient client, it checks whether the passed-in OkHttpClient.Builder is null. If so, it creates a new Builder.
[0023] Furthermore, when the non-HTTPS application access management module in the device for dynamically managing client data transmission accesses a non-HTTPS application, hostnameVerifier is set, true is returned, and hostname verification is ignored.
[0024] Similarly, when the HTTPS application access management module is accessing an HTTPS application, it sets the hostnameVerifier and returns true, ignoring the hostname verification.
[0025] Furthermore, the non-HTTPS application access management module in the device for dynamically managing client data transmission configures a timeout period, DNS resolution, and event listener for non-HTTPS application access, builds and returns an unsafe OkHttpClient instance,
[0026] Similarly, the HTTPS application access management module configures the timeout period, DNS resolution, and event listeners for HTTPS application access, and builds and returns a secure OkHttpClient instance.
[0027] The benefits of the present invention are:
[0028] Dynamic management enables compatible operation of HTTPS applications and non-HTTPS applications, ensuring that applications accessed on mobile terminals can still be accessed and run normally even if they do not have HTTPS certificates. This improves user autonomy and usage satisfaction, saves application implementation costs, and improves application efficiency and scope. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of the non-HTTPS application access process in the method of the present invention.
[0030] Figure 2 It is a schematic diagram of the HTTPS application access process in the method of the present invention. DETAILED DESCRIPTION
[0031] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0032] Example 1
[0033] The present invention provides a method for dynamically managing client data transmission, comprising:
[0034] When accessing non-HTTPS applications, create an OkHttpClient client that does not verify the SSL certificate. After creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null. If so, create a new Builder, set a custom CookieJar to manage cookies, use ArrayMap to store cookies for each domain name, and trust all certificates through TrustManager; set hostnameVerifier and return true to ignore hostname verification.
[0035] When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission. When accessing non-HTTPS applications, configure the timeout, DNS resolution, and event listener, and build and return an unsafe OkHttpClient instance.
[0036] When accessing HTTPS applications, create an OkHttpClient that verifies the SSL certificate. After creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null. If so, create a new Builder, make a request based on the configured certificate, set a custom CookieJar for managing cookies, load the application's built-in certificate files, and certificate files in external storage, set hostnameVerifier, return true, ignore hostname verification, configure SSLContext and SSLSocketFactory, and build a TrustManager based on the loaded certificate to verify the SSL certificate, and make a secure HTTPS request based on this for data transmission.
[0037] When accessing HTTPS applications, configure the timeout, DNS resolution, and event listeners, and build and return a secure OkHttpClient instance.
[0038] Example 2
[0039] The present invention also provides a device for dynamically managing client data transmission, including a non-HTTPS application access management module and a HTTPS application access management module.
[0040] When accessing non-HTTPS applications, the non-HTTPS application access management module creates an OkHttpClient client that does not verify the SSL certificate, sets a custom CookieJar for managing cookies, uses ArrayMap to store cookies for each domain name, and trusts all certificates through TrustManager.
[0041] When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission.
[0042] When the non-HTTPS application access management module accesses an HTTPS application, it creates an OkHttpClient that verifies the SSL certificate, makes requests based on the configured certificate, sets a custom CookieJar for managing cookies, loads the application's built-in certificate files, and the certificate files in the external storage, configures SSLContext and SSLSocketFactory, and builds a TrustManager based on the loaded certificate, verifies the SSL certificate, and makes secure HTTPS requests based on this for data transmission.
[0043] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0044] Similarly, the device of the present invention dynamically manages and realizes the compatible operation of HTTPS applications and non-HTTPS applications, ensuring that the applications accessed on the mobile terminal can still be accessed and operated normally even if they do not have HTTPS certificates, thereby improving the user's independent selection and usage satisfaction, saving application implementation costs, and improving application efficiency and application scope.
[0045] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0046] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for dynamically managing client data transmission, characterized in that include: When accessing non-HTTPS applications, create an OkHttpClient client that does not verify the SSL certificate, set a custom CookieJar to manage cookies, use ArrayMap to store cookies for each domain name, and trust all certificates through TrustManager. When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission. When accessing an HTTPS application, create an OkHttpClient that verifies the SSL certificate, make a request based on the configured certificate, set a custom CookieJar for managing cookies, load the application's built-in certificate files, and the certificate files in the external storage, configure SSLContext and SSLSocketFactory, and build a TrustManager based on the loaded certificate, verify the SSL certificate, and make a secure HTTPS request based on this for data transmission.
2. A method for dynamically managing client data transmission according to claim 1, characterized in that When accessing non-HTTPS applications, after creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null. If so, create a new Builder; Similarly, when accessing HTTPS applications, after creating the OkHttpClient client, check whether the passed-in OkHttpClient.Builder is null. If so, create a new Builder.
3. A method for dynamically managing client data transmission according to claim 1, characterized in that When accessing non-HTTPS applications, set hostnameVerifier and return true to ignore hostname verification. Similarly, when accessing HTTPS applications, set hostnameVerifier and return true to ignore hostname verification.
4. The method for dynamically managing client data transmission according to claim 1, characterized in that When accessing non-HTTPS applications, configure the timeout, DNS resolution, and event listeners, build and return an unsafe OkHttpClient instance. Similarly, when accessing HTTPS applications, configure the timeout, DNS resolution, and event listeners, and build and return a secure OkHttpClient instance.
5. A device for dynamically managing client data transmission, characterized in that Including non-HTTPS application access management module and HTTPS application access management module, When accessing non-HTTPS applications, the non-HTTPS application access management module creates an OkHttpClient client that does not verify the SSL certificate, sets a custom CookieJar for managing cookies, uses ArrayMap to store cookies for each domain name, and trusts all certificates through TrustManager. When an SSL error occurs in the URL loaded by WebView, check whether the issuer of the certificate is in the whitelist. If not, ignore the error and continue to load the page. According to the configured httpsInterceptControl value, determine whether to intercept the HTTPS request. If yes, call the parent class method to execute the default SSL error handling logic. Otherwise, ignore the certificate error and continue to load the page for data transmission. When the non-HTTPS application access management module accesses an HTTPS application, it creates an OkHttpClient that verifies the SSL certificate, makes requests based on the configured certificate, sets a custom CookieJar for managing cookies, loads the application's built-in certificate files, and the certificate files in the external storage, configures SSLContext and SSLSocketFactory, and builds a TrustManager based on the loaded certificate, verifies the SSL certificate, and makes secure HTTPS requests based on this for data transmission.
6. A device for dynamically managing client data transmission according to claim 5, Its characteristic is that when the non-HTTPS application access management module is used to access non-HTTPS applications, after creating the OkHttpClient client, it checks whether the passed-in OkHttpClient.Builder is null. If so, a new Builder is created; Similarly, when the HTTPS application access management module accesses the HTTPS application, after creating the OkHttpClient client, it checks whether the passed-in OkHttpClient.Builder is null. If so, it creates a new Builder.
7. The device for dynamically managing client data transmission according to claim 5, wherein the non-HTTPS application access management module sets hostnameVerifier and returns true to ignore hostname verification when accessing non-HTTPS applications. Similarly, when the HTTPS application access management module is accessing an HTTPS application, it sets the hostnameVerifier and returns true, ignoring the hostname verification.
8. A device for dynamically managing client data transmission according to claim 5, characterized in that the non-HTTPS application access management module configures a timeout, DNS resolution, and event listener for non-HTTPS application access, constructs and returns an unsafe OkHttpClient instance, Similarly, the HTTPS application access management module configures the timeout period, DNS resolution, and event listeners for HTTPS application access, and builds and returns a secure OkHttpClient instance.
Citation Information
Patent Citations
Method and system for dynamically binding website domain name
CN111866214A
Method and device for processing HTTPS (Hyper Text Transfer Protocol Secure Security) request based on national secret and international algorithms
CN114553476A
Multi-terminal data synchronization method and device for mixed development of clients and storage medium
CN118316945A
Cited By
Clientless SASE architecture with adaptive proxy policies enforcement based on certificate installation
US20260019811A1
