A method and device for displaying a graphical interface of a dynamic library in a trusted computing environment

By creating a dynamic library in the information creation environment, starting the second process, judging and setting environment variables, and starting the third process to draw a graphical interface, it solves the problem that the graphical interface cannot be displayed when the dynamic library and information security equipment interact in the information creation operating system, and realizes the normal display of the graphical interface and the security of user data.

CN119473437BActive Publication Date: 2025-04-15FEITIAN TECHNOLOGIES CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510058951.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-04-15
Estimated Expiration
2045-01-15

AI Technical Summary

Technical Problem

On operating systems related to the Information Creation Environment, when the dynamic library interacts with the information security equipment, the graphical interface cannot be displayed normally, resulting in the user being unable to complete normal operations, affecting information security.

Method used

The dynamic library creates a thread, starts the second process through the thread, obtains the data obtained by the third process through the graphical interface, and performs corresponding processing based on the acquired data. The second process determines whether the environment variable is set. If it is set, start the third process. If it is not set, obtain the monitor number and user information, build the environment variable data and set the environment variables, and then start the third process. The third process obtains environment variables, organizes the interface to display parameters, draws and displays the graphical interface, waits for user input, and stores the information entered by the user.

Benefits of technology

It realizes that the graphical interface of the dynamic library is displayed normally in the information innovation environment, and users can complete the operation, improve the security of user data and avoid the problem that the graphical interface cannot be displayed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473437B_ABST
    Figure CN119473437B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for displaying a graphical interface in a credible innovation environment by a dynamic library, and belongs to the field of electronic information technology. The present invention creates a thread through a dynamic library, starts a second process by calling a system function through the thread, determines the environment variables required for displaying the graphical interface through the second process, and starts a third process through the second process to complete the drawing of the graphical interface, so that the dynamic library obtains the information input by the user and completes the interactive operation with the information security device, avoiding the problem that the graphical interface cannot be displayed normally when the dynamic library interacts with the information security device on the credible innovation related operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of electronic information technology, and in particular, relates to a method and device for displaying a graphical interface of a dynamic library in an information-based innovation environment. Background Art

[0002] With the rapid development of the digital age, information security is becoming increasingly important. In order to protect user information security, various information security devices, such as Bluetooth keys, etc., have been launched on the market. In the process of using information security devices, it is usually necessary to display a graphical interface to facilitate user operations. For example, the verification operation requires the user to enter a verification code on the display interface. In the prior art, when calling a dynamic library on operating systems such as Windows and Mac to interact with information security devices, the graphical interface can be displayed normally for user operation. With the trend of diversification of operating systems, the inventors found that when calling a dynamic library on an operating system related to the trust creation environment to interact with information security devices, the problem of the graphical interface not being displayed normally occurred, resulting in the user being unable to complete normal operations and the user's information security cannot be guaranteed. Therefore, how to display the graphical interface normally when calling a dynamic library on an operating system related to the trust creation environment to use an information security device is an urgent problem to be solved. Summary of the invention

[0003] In order to solve the above technical problems, the present invention provides a method and device for a dynamic library to display a graphical interface in a trusted computing environment.

[0004] To this end, according to a first aspect of the present invention, a method for a dynamic library to display a graphical interface in a trusted environment is provided, the method comprising:

[0005] The dynamic library creates a thread, starts the second process through the thread, obtains data obtained by the third process through the graphical interface, and performs corresponding processing according to the obtained data;

[0006] When the second process is started, the following steps are performed:

[0007] Step S1, determine whether the environment in which the second process runs has environment variables set, if so, execute step S3, otherwise execute step S2;

[0008] Step S2, obtaining the display number and the current logged-in user information, constructing environment variable data according to the obtained information, setting the environment variable according to the environment variable data, and executing step S3;

[0009] Step S3, starting the third process;

[0010] When the third process is started, the following steps are performed:

[0011] Step S4, obtaining the environment variables, organizing interface display parameters according to the environment variables, drawing and displaying a graphical interface according to the interface display parameters, waiting to receive information input by a user, and executing step S5 when receiving the information input by the user;

[0012] Step S5: Store the information input by the user in a predetermined manner.

[0013] According to a second aspect of the present invention, there is provided a device for displaying a graphical interface of a dynamic library in a trusted computing environment, wherein the device comprises:

[0014] Create a module to create threads;

[0015] A first starting module, used to start the second process through the thread;

[0016] A first acquisition module is used to acquire data acquired by the third process through the graphical interface, and perform corresponding processing according to the acquired data;

[0017] A first judging module is used to judge whether the environment in which the second process runs has environment variables set when the second process is started, and trigger the second starting module if it is judged that the environment variables are set, and trigger the second obtaining module if it is judged that the environment variables are not set;

[0018] The second starting module is used to start the third process and trigger the third obtaining module;

[0019] The second acquisition module is used to acquire the display number and the current logged-in user information, construct the environment variable data according to the acquired information, set the environment variable according to the environment variable data, and trigger the second startup module;

[0020] The third acquisition module is used to acquire environment variables when the third process is started;

[0021] A display module, used for organizing interface display parameters according to the environment variables acquired by the third acquisition module, and drawing and displaying a graphical interface according to the interface display parameters;

[0022] A receiving module, used for waiting to receive information input by a user, and triggering the storage module when receiving the information input by the user;

[0023] The storage module is used to store the information input by the user in a predetermined manner.

[0024] According to a third aspect of the present invention, a computer device, a memory, a processor and a computer program stored in the memory are provided, and the processor executes the computer program to implement the method of displaying a graphical interface of the dynamic library in a trusted computing environment as described in the first aspect above.

[0025] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program / instruction is stored, characterized in that when the computer program / instruction is executed by a processor, the method of displaying a graphical interface of the dynamic library in a trusted computing environment described in the first aspect is implemented.

[0026] According to a fifth aspect of the present invention, a computer program product is provided, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the method of displaying a graphical interface of the dynamic library in a trusted computing environment described in the first aspect is implemented.

[0027] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0028] The present invention provides a method and device for a dynamic library to display a graphical interface in a trusted computing environment. The dynamic library creates a thread, starts a second process by calling a system function through the thread, determines environment variables required for displaying the graphical interface through the second process, and completes the drawing of the graphical interface by starting a third process through the second process, thereby enabling the dynamic library to obtain information input by the user and complete the interactive operation with the information security device, thereby improving the security of user data. This solution can realize the display of the graphical interface by calling the dynamic library through a third-party control call under the trusted computing operating system, thereby avoiding the problem that the graphical interface cannot be displayed normally when the dynamic library interacts with the information security device on the trusted computing related operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] For a clearer explanation, the embodiments of the present invention or the prior art are briefly introduced below in conjunction with the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0030] Figure 1 It is a flowchart of a method for displaying a graphical interface in a trusted computing environment provided by a dynamic library in a first embodiment of the present invention;

[0031] Figure 2 It is a flowchart of a method for displaying a graphical interface of a dynamic library in a trusted computing environment provided by the second embodiment of the present invention;

[0032] Figure 3 It is a flowchart of a method for displaying a graphical interface in a trusted computing environment using a dynamic library provided in the third embodiment of the present invention. DETAILED DESCRIPTION

[0033] To make the objectives, technical solutions and advantages of the present invention more clear, embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0034] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are only examples of devices and methods consistent with some aspects of the present invention as detailed in the attached claims.

[0035] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0036] Embodiment 1

[0037] Embodiment 1 of the present invention provides a method for displaying a graphical interface of a dynamic library in an information security environment, which is applicable to an operating system related to the information security environment. Specifically, a third-party program or control, and a dynamic library are installed on the operating system, and the process in which the third-party program or control, and the dynamic library are run is a first process. The third-party program or control interacts with an information security device by loading or calling a dynamic library.

[0038] like Figure 1 As shown, a method for a dynamic library to display a graphical interface in a trusted environment specifically includes:

[0039] The dynamic library creates a thread, starts the second process by calling the first system function through the thread, obtains data obtained by the third process through the graphical interface, and performs corresponding processing according to the obtained data;

[0040] When the second process is started, step 101 is executed;

[0041] Step 101, the second process determines whether the environment in which the second process runs has environment variables set, if so, execute step 103, otherwise execute step 102;

[0042] Step 102, the second process obtains the display number and the current logged-in user information, constructs environment variable data according to the obtained information, sets the environment variable according to the environment variable data, and executes step 103;

[0043] Step 103: The second process starts the third process and ends;

[0044] When the third process is started, execute step 104;

[0045] Step 104, the third process obtains environment variables, organizes interface display parameters according to the environment variables, draws a graphical interface according to the interface display parameters, waits to receive information input by the user, and executes step 105 when receiving the information input by the user;

[0046] Step 105: The third process stores the information input by the user according to a predetermined data storage method and ends.

[0047] In one practicable manner, the predetermined manner is specifically through a named pipe;

[0048] Specifically, obtaining the data obtained by the third process through the graphical interface specifically includes: obtaining the data obtained by the third process through the graphical interface through a named pipe;

[0049] Specifically, storing the information input by the user in a predetermined manner specifically includes: storing the information input by the user in a named pipe.

[0050] Specifically, before obtaining the data obtained by the third process through the graphical interface through the named pipe, the following steps are included: the dynamic library determines whether the named pipe exists, if yes, opens the named pipe, otherwise, creates a named pipe and opens the named pipe.

[0051] In an implementable manner, the predetermined manner is specifically through shared memory;

[0052] Specifically, obtaining the data obtained by the third process through the graphical interface specifically includes: obtaining the data obtained by the third process through the graphical interface through the shared memory;

[0053] Specifically, storing the information input by the user in a predetermined manner specifically includes: storing the information input by the user in a shared memory.

[0054] Specifically, obtaining the data obtained by the third process through the graphical interface through the shared memory includes: creating a shared memory with a dynamic library and setting a shared memory access object.

[0055] In an practicable manner, the method further comprises: the dynamic library obtains a random number generated by the information security device, and stores the random number in a first storage area;

[0056] The storing of the information input by the user in a predetermined manner specifically comprises: obtaining a random number in the first storage area, encrypting the information input by the user by using the random number, and storing the encrypted data in a predetermined manner;

[0057] Among them, obtaining data obtained by the third process through the graphical interface and performing corresponding processing according to the obtained data are specifically: obtaining the encrypted data stored by the third process in a predetermined manner, decrypting the encrypted data through the random number in the first storage area, and performing subsequent operations with the information security device based on the data obtained after the decryption.

[0058] In one practicable manner, before executing step 102, the method further includes: determining whether the environment in which the second process runs supports setting environment variables, and if so, executing step 102, otherwise returning an error message.

[0059] Specifically, determining whether the environment in which the second process runs supports setting environment variables is as follows: determining whether the environment in which the second process runs supports the use of setting commands; if so, it indicates that the environment in which the second process runs supports setting environment variables; if not, it indicates that the environment in which the second process runs does not support setting environment variables.

[0060] Embodiment 2

[0061] Embodiment 2 of the present invention provides a method for displaying a graphical interface of a dynamic library in an information innovation environment, which is applicable to an operating system related to the information innovation environment. Specifically, a third-party program or control, and a dynamic library are installed on the operating system. The process running the third-party program or control, and the dynamic library is a first process. The third-party program or control interacts with an information security device by loading or calling a dynamic library. The information security device includes but is not limited to a UKEY, a dynamic token, and an encryption lock.

[0062] There may be multiple predetermined methods in the above-mentioned embodiment 1. In this embodiment, the method of obtaining data by the dynamic library and the method of storing data by the third process take the named channel as an example, and the method of displaying a graphical interface of the dynamic library in the information creation environment is described in detail;

[0063] like Figure 2 As shown, a method for a dynamic library to display a graphical interface in a trusted environment specifically includes:

[0064] Step 201: The dynamic library obtains a random number generated by an information security device and stores the random number in a first storage area;

[0065] In an practicable manner, the dynamic library obtains the random number generated by the information security device as follows: the dynamic library calls a random number generation function to request the information security device to generate a random number, and obtains the random number generated by the information security device;

[0066] For example, the random number generation function is GenRandom;

[0067] In this embodiment, the first storage area may be a shared memory, or may be implemented in other ways, which is not specifically limited here.

[0068] In one practicable manner, when the first storage area is a shared memory, storing the random number in the first storage area specifically comprises: creating a shared memory with a dynamic library, and storing the random number in the shared memory;

[0069] For example, shared memory is shareMemoryKey;

[0070] Specifically, the dynamic library creates a shared memory as follows: the dynamic library creates the shared memory by calling the system function shmget;

[0071] Step 202, the dynamic library determines whether the named pipe exists, if yes, open the named pipe and execute step 203, otherwise create the named pipe and open the named pipe and execute step 203;

[0072] In one practicable manner, the dynamic library determines whether the named pipe exists as follows: the dynamic library determines whether the named pipe FIFO exists by calling the access function;

[0073] An implementable way to open the named pipe is as follows: calling the system function open to open the named pipe FIFO;

[0074] One feasible way to create a named pipe is to call the system function mkfifo to create a named pipe (full name: First In First Out, abbreviated as FIFO). Specifically, a named pipe is a special file type used to exchange data between different processes. A named pipe allows one process to write data to the pipe and another process to read data from the pipe.

[0075] For example, to create a named pipe, the command is: mkfifo / pathname / fifo, where pathname is the path of the named pipe and fifo is the name of the named pipe.

[0076] Step 203: The dynamic library creates a thread, and starts the second process by calling the first system function through the thread. When the second process is started, step 301 is executed, and the dynamic library obtains the data in the named pipe, decrypts the obtained data through the random number in the first storage area, and performs subsequent operations with the information security device according to the data obtained after the decryption process;

[0077] For example, in this embodiment, the dynamic library creates a thread specifically as follows: the dynamic library calls the system function pthread_create to create the thread uithread_VerifyOTP;

[0078] In this embodiment, starting the second process by calling the system function through a thread specifically includes: the dynamic library starts the intermediate script by calling the first system function through a thread, and the process run by the intermediate script is the second process;

[0079] In an implementable manner, the second process is specifically a process run by the intermediate script showUI.sh, and the intermediate script showUI.sh is specifically used to process the UI display operation; the first system function is specifically system("showUI.sh 0 xxxx"), wherein the parameter xxxx indicates the type of graphical interface to be displayed;

[0080] For example, parameter 2052 represents the type of graphical interface displayed as PIN verification, 2053 represents the type of graphical interface displayed as PIN modification, and 2054 represents the type of graphical interface displayed as transaction confirmation;

[0081] Specifically, in this embodiment, data in the named pipe is obtained in a loop;

[0082] The data in the named pipe is specifically data acquired by the third process through the graphical display interface and written into the named pipe;

[0083] In an practicable manner, the subsequent operation performed with the information security device according to the acquired data is specifically as follows: determining the data type, returning an error message if the data type is a first type, and sending the data to the information security device for processing if the data type is a second type;

[0084] Specifically, the first type is cancel operation data, and the second type is input box data;

[0085] Further, if the data is of the second type, sending it to the information security device for processing specifically includes: parsing the data to obtain parsed data, organizing the parsed data and sending it to the information security device for processing;

[0086] For example, the data is: 123456654321, and the data is parsed to obtain the following data: the dynamic password is 123456, and the password is 654321;

[0087] In this embodiment, the subsequent operations performed with the information security device based on the acquired data specifically include but are not limited to verification operations, modification operations, and signature operations;

[0088] In one practicable manner, after the dynamic library obtains the data in the named pipe, it also includes calling the system function unlink to delete the named pipe;

[0089] When the second process is started, execute step 301;

[0090] Step 301, determine whether the environment in which the second process runs has environment variables set, if so, execute step 303, otherwise execute step 302;

[0091] Step 302, obtain the display number, obtain the current login user information by reading the system file, construct environment variable data according to the obtained information, set the environment variable according to the environment variable data, and execute step 303;

[0092] In an practicable manner, obtaining the display number is specifically as follows: obtaining the display number through a system command; specifically, the system command is specifically a who command;

[0093] In an practicable manner, obtaining the display number is specifically as follows: obtaining the display number through a second system function; obtaining the display number through the second system function is specifically as follows: calling a system function open to open a file / var / run / utmp that stores login information to obtain the display number;

[0094] An implementable method is to obtain the currently logged-in user information by reading the system file " / run / systemd / users";

[0095] An implementable method for constructing environment variable data according to the acquired information is as follows: obtaining the required environment variable data according to the display number and the currently logged-in user information;

[0096] For example, the display number is: 1, and the current logged-in user information is: user=1000; the environment variable data is: export DISPLAY=:1; export XDG_RUNTIME_DIR= / run / user / 1000; export LANGUAGE=zh_CN; export LANG=zh_CN.UTF-8;

[0097] In an practicable manner, before executing step 302, the method further includes: determining whether the environment in which the second process runs supports setting environment variables, if so, executing step 302, otherwise returning an error message;

[0098] Specifically, determining whether the environment in which the second process runs supports setting environment variables is specifically as follows: determining whether the environment in which the second process runs supports the use of setting commands, if the use of setting commands is supported, it indicates that the environment in which the second process runs supports setting environment variables, if the use of setting commands is not supported, it indicates that the environment in which the second process runs does not support setting environment variables;

[0099] The setting command is specifically a system command sudo. The sudo command is a tool that allows ordinary users to execute some or all root commands. If the second process returns a successful response when executing the sudo command, it indicates that the sudo command is supported. If the second process returns an error response when executing the sudo command, it indicates that the sudo command is not supported.

[0100] For example, sudo -i -u $showUser -- bash -c "ls / tmp / > / dev / null"

[0101] if [ $? -ne 0 ]; then

[0102] ${SHOWUI} $1 $2

[0103] else

[0104] if [ "$DISPLAY" == "" ];

[0105] An implementable way to set the environment variable is to use the system command export or the system function setenv to set it;

[0106] For example, sudo -i -u $showUser -- bash -c "${EXPORT} export DISPLAY=${display}; export LANGUAGE=zh_CN; export LANG=zh_CN.UTF-8; ${SHOWUI} $1 $2".

[0107] Step 303: The second process starts the third process and ends the second process;

[0108] In this embodiment, the third process is specifically a process of a drawing program, for example, the drawing program is showUI_R, and the drawing program is started as an application end Xclient;

[0109] In one practicable manner, the second process starts the third process by specifically starting the third process through a drawing command showUI, and the second process passes in environment variables and parameters when starting the third process, and the third process determines on which device to draw the interface and what kind of interface to draw through the environment variables and parameters;

[0110] For example, if the parameter is a pop-up window for verifying the PIN, the environment variable is user1, and device 1, then the third process draws an input box interface for verifying the PIN code on the screen of logged-in user 1 of device 1;

[0111] When the third process is started, execute step 304;

[0112] Step 304, obtaining environment variables and parameters, organizing interface display parameters according to the environment variables and parameters, drawing a graphical interface according to the interface display parameters, waiting to receive user input information, and executing step 305 when receiving user input information;

[0113] In one practicable manner, drawing the graphical interface according to the interface display parameters is specifically as follows: sending the interface display parameters to a drawing interface service of the system, and the drawing interface service draws the graphical interface according to the interface display parameters;

[0114] Specifically, the system's drawing interface service is Xserver;

[0115] In an implementable manner, drawing a graphical interface according to the interface display parameter is specifically as follows: a third process passes the parameter into a drawing interface service, and the drawing interface service determines the type of page to be displayed showType according to the passed-in parameter; if the parameter is a first preset value, the type of the page to be displayed is a first instantiation class, and the first instantiation class is specifically an interface for displaying a PIN verification; if the parameter is a second preset value, the type of the page to be displayed is a second instantiation class, and the second instantiation class is specifically an interface for displaying a PIN modification; if the parameter is a third preset value, the type of the page to be displayed is a third instantiation class, and the third instantiation class is specifically an interface for displaying an OTP verification;

[0116] For example, the first preset value is "verifyPIN", the first instantiation class is verifyPinUI, the second preset value is "changePIN", the second instantiation class is changePinUI, the third preset value is "verifyOTP", the third instantiation class is verifyOTPUI;

[0117] Step 305: Obtain a random number from the first storage area, encrypt the information input by the user using the random number, store the encrypted result data in a named pipe, and end the third process.

[0118] In an practicable manner, step 305 specifically includes: determining the type of information input by the user, if it is the first type, storing the cancellation data in the named pipe, and ending; if it is the second type, obtaining a random number in the first storage area, encrypting the information input by the user by using the random number, storing the result data obtained by the encryption processing in the named pipe, and ending;

[0119] Specifically, the first type is user cancellation; the second type is the user confirming that the input information has been completed;

[0120] In this embodiment, the information input by the user can be input in one input box or in multiple input boxes; for example, when the type of the graphical interface drawn is to verify the PIN, the graphical interface displays one input box; when the type of the graphical interface drawn is to modify the PIN, the graphical interface displays at least two input boxes;

[0121] In one practicable manner, when the information input by the user is input into multiple input boxes, the information input by the user is encrypted by a random number. Specifically, the information input by the user in the multiple input boxes is concatenated, and the concatenated data is encrypted by a random number.

[0122] In one practicable manner, when the information input by the user is input into multiple input boxes, the information input by the user is encrypted by using a random number, specifically: the information input by the user in each input box is encrypted by using a random number to obtain multiple encrypted data;

[0123] In an practicable manner, storing the result data obtained by the encryption process in the named pipe specifically includes: a third process opens the named pipe created by the first process, and stores the result data obtained by the encryption process in the named pipe;

[0124] For example, the third process opens a named pipe named fifo according to the named pipe path.

[0125] In this embodiment, step 305 further includes: closing the displayed graphical interface;

[0126] An implementable method is to obtain the random number in the first storage area by specifically obtaining the random number in the shared memory, and obtaining the random number in the shared memory is specifically calling the system processing function btnOkClick to obtain the random number in the shared memory. The third process obtains the random number in the shared memory by specifically obtaining the random number in the shared memory named shareMemoryKey created by the first process.

[0127] Embodiment 3

[0128] Embodiment 3 of the present invention provides a method for a dynamic library to display a graphical interface in an information innovation environment, which is applicable to an operating system related to the information innovation environment. Specifically, a third-party program or control, and a dynamic library are installed on the operating system. The process in which the third-party program or control, and the dynamic library are run is a first process. The third-party program or control interacts with an information security device by loading or calling a dynamic library. The information security device includes but is not limited to a UKEY, a dynamic token, and an encryption lock.

[0129] In this embodiment, the method of obtaining data by the dynamic library and the method of storing data by the third process take shared memory as an example, and the method of displaying a graphical interface of the dynamic library in the trust creation environment is described in detail;

[0130] like Figure 3 As shown, a method for a dynamic library to display a graphical interface in a trusted environment specifically includes:

[0131] Step 401: The dynamic library obtains a random number generated by an information security device and stores the random number in a first storage area;

[0132] In this embodiment, the first storage area may be a shared memory, or may be implemented in other ways, which is not specifically limited here.

[0133] Step 402: The dynamic library creates a shared memory and sets a shared memory access object;

[0134] In one feasible way, the dynamic library creates shared memory as follows: calling the system function shmget to create the shared memory shareMemoryData, calling the system function shmat to connect the variable shm_addr to the shared memory shareMemoryData;

[0135] Specifically, the shared memory shareMemoryData includes a 1-byte flag bit, and a flag bit of 1 indicates that the shared memory data has been written;

[0136] Step 403: The dynamic library creates a thread, and starts the second process by calling the system function through the thread. After the second process is started, step 501 is executed, the dynamic library obtains the data in the shared memory, decrypts the obtained data through the random number in the first storage area, and performs subsequent operations with the information security device according to the data obtained after the decryption process;

[0137] Specifically, in this embodiment, data in the shared memory is obtained cyclically;

[0138] The data in the shared memory is specifically data written by the third process;

[0139] In this embodiment, the subsequent operations performed with the information security device based on the acquired data specifically include but are not limited to verification operations, modification operations, and signature operations;

[0140] In an practicable manner, after the dynamic library obtains the data in the shared memory, the method further includes calling the system function shmdt to release the shared memory connection and calling the system function shmdt to delete the shared memory object;

[0141] For example, in this embodiment, the dynamic library creates a thread specifically as follows: the dynamic library calls the system function pthread_create to create the thread uithread_VerifyOTP;

[0142] In an implementable manner, the second process is specifically a process run by the intermediate script showUI.sh, and the intermediate script showUI.sh is specifically used to process the UI display operation; the system function is specifically system("showUI.sh 0 xxxx"), wherein the parameter xxxx indicates the type of graphical interface to be displayed;

[0143] When the second process is started, execute step 501;

[0144] Step 501, determine whether the environment in which the second process runs has environment variables set, if so, execute step 503, otherwise execute step 502;

[0145] Step 502, obtain the display number through the system command, obtain the current login user information by reading the system file, construct the environment variable data according to the obtained display number and the current login user information, set the environment variable according to the environment variable data, and execute step 503;

[0146] In this embodiment, the display number is obtained by the who system command; the current logged-in user information is obtained by reading the system file " / run / systemd / users";

[0147] An implementable method is to construct the environment variable data according to the acquired information, specifically to obtain the required environment variable data according to the display number and the currently logged-in user information;

[0148] For example, the display number is: 1, and the current logged-in user information is: user=1000; the environment variable data is: export DISPLAY=:1; export XDG_RUNTIME_DIR= / run / user / 1000; export LANGUAGE=zh_CN; export LANG=zh_CN.UTF-8;

[0149] In an practicable manner, before executing step 502, the method further includes: determining whether the environment in which the second process runs supports setting environment variables, if so, executing step 502, otherwise returning an error message;

[0150] Specifically, determining whether the environment in which the second process runs supports setting environment variables is specifically as follows: determining whether the environment in which the second process runs supports the use of setting commands, if the use of setting commands is supported, it indicates that the environment in which the second process runs supports setting environment variables, if the use of setting commands is not supported, it indicates that the environment in which the second process runs does not support setting environment variables;

[0151] One feasible way to set the environment variable is to use the system command export or the system function setenv to set it;

[0152] Step 503: Start the third process and end the second process;

[0153] In this embodiment, the third process is specifically a process in which a drawing program is running, for example, the drawing program is showUI_R, and the drawing program is started as an Xclient;

[0154] In an implementable manner, the second process passes in environment variables and parameters when starting the third process, and the third process determines on which device to draw the interface and what kind of interface to draw through the environment variables and parameters;

[0155] When the third process is started, step 504 is executed;

[0156] Step 504, obtaining environment variables and parameters, organizing interface display parameters according to the environment variables and parameters, drawing a graphical interface according to the interface display parameters through a drawing command, waiting to receive information input by the user, and executing step 505 when receiving the information input by the user;

[0157] In this embodiment, drawing a graphical interface according to the interface display parameters through a drawing command is specifically as follows: the third process sends the interface display parameters to the system's drawing interface service through a drawing command, and the drawing interface service draws the graphical interface according to the interface display parameters;

[0158] Specifically, the system's drawing interface service is Xserver;

[0159] In this embodiment, the graphical interface can also be drawn by a third system function, which will not be described in detail here;

[0160] Step 505: Obtain a random number from the first storage area, encrypt the information input by the user using the random number, store the encrypted result data in the shared memory, and end the third process.

[0161] In an practicable manner, step 505 specifically includes: determining the type of information input by the user, if it is the first type, storing the cancellation data in the shared memory, and ending; if it is the second type, obtaining a random number in the first storage area, encrypting the information input by the user by using the random number, storing the result data obtained by the encryption processing in the shared memory, and ending;

[0162] Specifically, the first type is user cancellation; the second type is confirmation that the input information has been completed;

[0163] In this embodiment, the information input by the user can be input in one input box or in multiple input boxes; for example, when the type of the graphical interface drawn is to verify the PIN, the graphical interface displays one input box; when the type of the graphical interface drawn is to modify the PIN, the graphical interface displays at least two input boxes;

[0164] In one practicable manner, when the information input by the user is input into multiple input boxes, the information input by the user is encrypted by a random number. Specifically, the information input by the user in the multiple input boxes is concatenated, and the concatenated data is encrypted by a random number.

[0165] In one practicable manner, when the information input by the user is input into multiple input boxes, the information input by the user is encrypted by using a random number, specifically: the information input by the user in each input box is encrypted by using a random number to obtain multiple encrypted data;

[0166] In this embodiment, step 505 further includes: closing the displayed graphical interface;

[0167] In one feasible manner, obtaining the random number in the shared memory is specifically to call the processing function btnOkClick to obtain the random number in the shared memory.

[0168] The present invention provides a method for a dynamic library to display a graphical interface in a trusted innovation environment. The dynamic library starts a second process by calling a first system function through a created thread, determines environment variables required for displaying the graphical interface through the second process, and starts a third process through the second process to complete drawing of the graphical interface, thereby enabling the dynamic library to obtain user input information obtained by the third process through the graphical interface, complete interactive operations with information security equipment, and avoid the problem that the dynamic library cannot display the graphical interface in the trusted innovation environment.

[0169] The following are embodiments of the apparatus of the present invention, which can be used to implement the embodiments of the method of the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, reference can be made to the embodiments of the method of the present invention.

[0170] An exemplary embodiment of the present invention provides a device for displaying a graphical interface of a dynamic library in a trusted environment, the device comprising:

[0171] Create a module to create threads;

[0172] A first starting module, used to start the second process through the thread;

[0173] A first acquisition module is used to acquire data acquired by the third process through the graphical interface, and perform corresponding processing according to the acquired data;

[0174] A first judgment module is used to judge whether the environment in which the second process runs has environment variables set, and if it is judged that the environment variables are set, the second startup module is triggered, and if it is judged that the environment variables are not set, the second acquisition module is triggered;

[0175] The second starting module is used to start the third process and trigger the third acquisition module;

[0176] The second acquisition module is used to acquire the display number and the current logged-in user information, construct the environment variable data according to the acquired information, set the environment variable according to the environment variable data, and trigger the second startup module;

[0177] The third acquisition module is used to acquire environment variables;

[0178] A display module, used for organizing interface display parameters according to the environment variables acquired by the third acquisition module, and drawing and displaying a graphical interface according to the interface display parameters;

[0179] A receiving module, used for waiting to receive information input by a user, and triggering the storage module when receiving the information input by the user;

[0180] The storage module is used to store the information input by the user in a predetermined manner;

[0181] In an practicable manner, the predetermined manner is specifically through a named pipe;

[0182] The first acquisition module is specifically used to acquire data acquired by the third process through the graphical interface through a named pipe; the storage module is specifically used to store the information input by the user into the named pipe.

[0183] Furthermore, the first acquisition module further includes a judgment unit, which is used to judge whether the named pipe exists, open the named pipe if it is judged that the named pipe exists, and create and open the named pipe if it is judged that the named pipe does not exist;

[0184] In an practicable manner, the predetermined manner is specifically through a shared memory;

[0185] The first acquisition module is specifically used to acquire data acquired by the third process through the graphical interface through the shared memory; the storage module is specifically used to store the information input by the user into the shared memory;

[0186] Furthermore, the first acquisition module also includes a creation unit, which is used to create a shared memory and set a shared memory access object.

[0187] In an practicable manner, the apparatus further comprises a fourth acquisition module, which is used to acquire a random number generated by the information security device and store the random number in the first storage area;

[0188] Specifically, the storage module is specifically used to obtain a random number in the first storage area, encrypt the information input by the user by using the random number, and store the encrypted data in a predetermined manner;

[0189] Specifically, the first acquisition module is used to acquire data acquired by the third process through the graphical interface, decrypt the acquired data using the random number in the first storage area, and perform subsequent operations with the information security device based on the data obtained after the decryption process.

[0190] In an practicable manner, the device further comprises a second determination module, which is used to determine whether the environment in which the second process runs supports setting environment variables, and if so, trigger the second acquisition module, otherwise, returns an error message;

[0191] Specifically, the second judgment module is used to determine whether the environment in which the second process runs supports the use of setting commands. If it supports the use of the setting commands, it indicates that the environment in which the second process runs supports setting environment variables. If it does not support the use of the setting commands, it indicates that the environment in which the second process runs does not support setting environment variables.

[0192] It should be noted that the device for displaying a graphical interface of a dynamic library in a trusted environment provided by the above-mentioned embodiment only uses the division of the above-mentioned functional modules as an example when executing the method for displaying a graphical interface of a dynamic library in a trusted environment. In actual applications, the above-mentioned functions can be allocated as needed and completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for displaying a graphical interface of a dynamic library in a trusted environment provided by the above-mentioned embodiment and the method embodiment for displaying a graphical interface of a dynamic library in a trusted environment belong to the same concept. The specific implementation process is shown in the method embodiment, which will not be repeated here.

[0193] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0194] An embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any of the aforementioned method embodiments.

[0195] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored, and when the program / instruction is executed by a processor, the steps of the method of any of the above embodiments are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0196] An embodiment of the present invention provides a computer program product, including a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of any of the methods of the aforementioned embodiments.

[0197] In the present invention, the terms "first", "second", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or order; the term "plurality" refers to two or more, unless otherwise clearly defined. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. Terms such as "install", "connect", "connect", and "fix" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; "connection" can be a direct connection or an indirect connection through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0198] In the description of the present invention, it is necessary to understand that the directions or positional relationships indicated by the terms "upper" and "lower" etc. are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or unit referred to must have a specific direction, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.

[0199] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope covered by the present invention.

Claims

1. A method for displaying a graphical interface of a dynamic library in a trusted environment, characterized in that: The method comprises: The dynamic library creates a thread, starts the second process through the thread, obtains data obtained by the third process through the graphical interface in a predetermined manner, and performs corresponding processing according to the obtained data; When the second process is started, the following steps are performed: Step S1, determine whether the environment in which the second process runs has environment variables set, if so, execute step S3, otherwise execute step S2; Step S2, obtaining the display number and the current logged-in user information, constructing environment variable data according to the obtained information, setting the environment variable according to the environment variable data, and executing step S3; Step S3, starting the third process; When the third process is started, the following steps are performed: Step S4, obtaining the environment variables, organizing interface display parameters according to the environment variables, drawing and displaying a graphical interface according to the interface display parameters, waiting to receive information input by a user, and executing step S5 when receiving the information input by the user; Step S5: storing the information input by the user in a predetermined manner; The step of constructing the environment variable data according to the acquired information specifically includes obtaining the required environment variable data according to the display number and the currently logged-in user information.

2. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 1, characterized in that: The predetermined method is specifically through a named pipe; The obtaining of data obtained by the third process through the graphical interface specifically includes: obtaining the data obtained by the third process through the graphical interface through a named pipe; The storing the information input by the user in a predetermined manner specifically includes: storing the information input by the user in the named pipe.

3. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 2, characterized in that: The method of obtaining data obtained by the third process through the graphical interface through the named pipe includes: The dynamic library determines whether the named pipe exists, and if so, opens the named pipe; otherwise, creates the named pipe and opens it.

4. The method for displaying a graphical interface of a dynamic library in a trusted environment as claimed in claim 1, characterized in that: The predetermined method is specifically through shared memory; The acquiring of data acquired by the third process through the graphical interface specifically includes: acquiring the data acquired by the third process through the graphical interface through the shared memory; The storing the information input by the user in a predetermined manner specifically includes: storing the information input by the user in the shared memory.

5. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 4, characterized in that: The method of obtaining data obtained by the third process through the graphical interface through the shared memory includes: The dynamic library creates the shared memory and sets a shared memory access object.

6. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 1, characterized in that: The method further comprises: the dynamic library acquires a random number generated by the information security device, and stores the random number in a first storage area; The storing of the information input by the user in a predetermined manner specifically comprises: obtaining a random number in the first storage area, encrypting the information input by the user by using the random number, and storing the encrypted data in a predetermined manner; The data obtained by the third process through the graphical interface and the corresponding processing performed according to the obtained data are specifically: obtaining the encrypted data stored by the third process in a predetermined manner, decrypting the encrypted data through the random number in the first storage area, and performing subsequent operations with the information security device based on the decrypted data.

7. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 1, characterized in that: Before executing step S2, the method also includes: determining whether the environment in which the second process runs supports setting environment variables, if so, executing step S2, otherwise returning an error message.

8. The method for displaying a graphical interface of a dynamic library in a trusted computing environment as claimed in claim 7, characterized in that: The determining whether the environment in which the second process runs supports setting environment variables is specifically as follows: determining whether the environment in which the second process runs supports the use of setting commands; if the setting commands are supported, it indicates that the environment in which the second process runs supports setting environment variables; if the setting commands are not supported, it indicates that the environment in which the second process runs does not support setting environment variables.

9. A device for displaying a graphical interface of a dynamic library in a trusted environment, characterized in that: The device is implemented by using the method for displaying a graphical interface in a trusted computing environment using a dynamic library as described in any one of claims 1 to 8, and the device comprises: Create a module to create threads; A first starting module, used to start the second process through the thread; A first acquisition module is used to acquire data acquired by the third process through the graphical interface, and perform corresponding processing according to the acquired data; A first judging module is used to judge whether the environment in which the second process runs has environment variables set when the second process is started, and trigger the second starting module if it is judged that the environment variables are set, and trigger the second obtaining module if it is judged that the environment variables are not set; The second starting module is used to start the third process and trigger the third obtaining module; The second acquisition module is used to acquire the display number and the current logged-in user information, construct the environment variable data according to the acquired information, set the environment variable according to the environment variable data, and trigger the second startup module; The third acquisition module is used to acquire environment variables when the third process is started; A display module, used for organizing interface display parameters according to the environment variables acquired by the third acquisition module, and drawing and displaying a graphical interface according to the interface display parameters; A receiving module, used for waiting to receive information input by a user, and triggering the storage module when receiving the information input by the user; The storage module is used to store the information input by the user in a predetermined manner.

10. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the method of any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method and device for realizing browser pop-up boxes

    CN111597491A

  • File permission control method and device

    CN116821968A

  • Office method and system based on safe USB flash disk

    CN117874808A