Message encryption authentication method based on Wayland protocol
By extending the Wayland library's connection module and defining its working mode, and utilizing advanced encryption standards to encrypt and decrypt messages, the problems of message hijacking and compromised access control in the Wayland protocol are solved, achieving highly secure message encryption and authentication.
Patent Information
- Application Number
- CN202511461307.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-14
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-10-14
AI Technical Summary
In scenarios with high security requirements, the existing Wayland protocol is vulnerable to man-in-the-middle interception and eavesdropping during message transmission. Furthermore, when the access control system is compromised, it cannot effectively achieve data-level encryption and isolation, allowing malicious programs to obtain data by deceiving the synthesizer.
By extending the Wayland library's connection module, it adds fields for encrypted data ring buffer, ciphertext to be decrypted, encrypted ciphertext, and key information. It also overloads the communication write and read data function interfaces, defines different working modes, uses advanced encryption standards to encrypt and decrypt messages, and only allows clients carrying legitimate keys to initiate communication.
In the event of a compromised access control system, attackers are unable to decrypt transmitted data, enabling encrypted authentication of messages. This enhances the security and flexibility of the Wayland protocol, allowing only trusted programs to communicate.
Smart Images

Figure CN120956525A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of message encryption and authentication technology, and particularly relates to a message encryption and authentication method based on the Wayland protocol. Background Technology
[0002] The Wayland protocol is a next-generation display graphics protocol for Unix-like operating systems. It uses a client / server architecture to replace the traditional end-to-end data transmission channel from image data to the display screen. By taking over event messages from the mouse, keyboard, and graphics card, it provides a transmission framework for message passing between these hardware components, thereby enabling human-computer interaction.
[0003] The classic workflow is as follows: When a password is entered on the keyboard, the keyboard transmits the event to user space via the Linux kernel driver. User space has a dedicated Libinput library for mouse and keyboard that encapsulates the keyboard electrical signals into programmable code. The Libinput library then notifies the Wayland synthesizer, which identifies which Wayland client application the keyboard event belongs to. The synthesizer then encapsulates the keyboard content into a message packet and sends it to the corresponding Wayland client. The Wayland client's graphical application then decapsulates the message packet and passes it to its own background thread for data business logic processing. At this point, the graphical application can directly use the input string content. After data verification and corresponding business logic processing, the background thread writes the data to disk. The graphical application then makes corresponding changes to its image data and renders the new content on the screen.
[0004] In scenarios with high security requirements, the message transmission process described above is at risk of being eavesdropped on. If the keystrokes are intercepted and eavesdropped on during the message transmission process of the Wayland protocol before the keyboard data reaches the graphical application, the typed content can be continuously captured.
[0005] In the current Wayland protocol transmission design, security protection mainly relies on the permission management of the Linux system. After receiving message data from the kernel, the Wayland server mainly communicates with the Wayland client application via Unix Socket to transmit keyboard data. When the synthesizer starts in the Linux system, it creates a Socket file with permissions 0755, meaning that the ordinary user who created the file can read, write, and execute, while other users can read, execute, but not write. This way, only the user who created the file can initiate communication with the Wayland server to transmit data. However, the current design only isolates the usage permissions between multiple users under normal permission system operation, but does not achieve data-level message encryption isolation. Furthermore, in extreme cases, if the permission system is compromised, or if the Socket file permissions are set incorrectly by human error, the Unix Socket file can be monitored through side-channel attacks. Attackers can then listen to the data communication between any client and the server.
[0006] In existing technology, after receiving keyboard messages from the kernel on the Wayland protocol server, the window manager searches for the application to which the message belongs before distributing the message to ensure data isolation between each client. However, malicious programs can construct existing client IDs to deceive the synthesizer and illegally obtain data. Summary of the Invention
[0007] To address the aforementioned shortcomings in existing technologies, this invention provides a message encryption and authentication method based on the Wayland protocol. This method solves the problem that attackers can hijack and listen to transmitted data when the permission system is compromised. It also implements a client whitelist function, preventing unauthorized applications not on the whitelist from initiating connection requests.
[0008] To achieve the above objectives, the technical solution adopted by this invention is: a message encryption and authentication method based on the Wayland protocol, comprising the following steps: S1. Based on the Wayland library, the connection module in the Wayland library is extended, and the communication write data function interface and communication read data function interface are overloaded according to the encryption and decryption process of Advanced Encryption Standard, so as to obtain the overloaded communication write data function interface and the overloaded communication read data function interface. S2. By adding key judgment logic, the client connection request function interface is reloaded. By adding encryption algorithm enable judgment logic, the server communication channel creation function interface is reloaded. The reloaded client connection request function interface and the reloaded server communication channel creation function interface are obtained, and a Unix Socket channel is established. S3. Define the working mode, determine the current communication working mode, and based on the overloaded communication write data function interface, the overloaded communication read data function interface, the overloaded client connection request function interface, and the overloaded server communication channel creation function interface, communicate through the Unix Socket channel and complete message encryption authentication.
[0009] The beneficial effects of this invention are as follows: By extending the connection module in the Wayland library, this invention non-intrusively extends the security and flexibility of Wayland without breaking the original Wayland protocol. This enables the Wayland protocol communication framework to have the ability to encrypt and decrypt communication data. At the same time, it realizes the function of whitelisting through key control, so that the Wayland protocol only allows requests from trusted programs. This solves the problem that attackers cannot decrypt encrypted transmitted data without obtaining the encryption key when the permission system is compromised, thus providing more secure protection for input content such as mouse and keyboard.
[0010] Further, S1 includes the following steps: S101. Based on the Wayland library, the connection module in the Wayland library is extended by adding a preset encrypted data ring buffer field, a ciphertext field to be decrypted, an encrypted ciphertext field, a raw data field, and a key information field to the connection module resource structure, resulting in an updated resource structure. S102. Based on the updated resource structure, the communication write data function interface is overloaded by adding initialization and data encryption calculation logic of advanced encryption standard encryption to obtain the overloaded communication write data function. S103. By adding initialization and data encryption calculation logic for advanced encryption standard decryption, the communication read data function interface is overloaded to obtain the overloaded communication read data function.
[0011] Furthermore, the encrypted data circular buffer field is used to store all encrypted message frames in a sequential manner using a circular buffer, and to transmit the encrypted message frames on the Unix Socket inter-process communication channel. The ciphertext field to be decrypted is used to store a frame of ciphertext data to be decrypted; The encrypted ciphertext field is used to store a frame of encrypted ciphertext data; The original data field is used to store a frame of original data. In the encryption operation, the original data field stores the original input data to be encrypted, and in the decryption operation, the original data field stores the original data output after decryption. The key information field is used to store key-related context information. In response to a single load, the key-related context information is continuously stored in memory.
[0012] The beneficial effects of the above-mentioned further solutions are as follows: By setting extended fields, the present invention improves the security and flexibility of the Wayland protocol without intrusion, and enables the encryption and decryption of communication data.
[0013] Furthermore, the key determination logic is as follows: if a key is detected, the key is used to encrypt the data to be transmitted; otherwise, the data to be transmitted is sent to the Wayland server using the Wayland raw message frame data format and via the UnixSocket channel.
[0014] Furthermore, the logic for determining whether to enable the encryption algorithm is as follows: if the Wayland server starts with a first startup parameter and a second startup parameter, the corresponding working mode is enabled according to the value of the first startup parameter, and the contents of the file carried in the second startup parameter are read and stored as key information in the key information field; otherwise, the encryption algorithm is not enabled.
[0015] Furthermore, step S3 includes the following steps: S301. Define a first working mode that only allows encrypted data communication, a second working mode that only allows ordinary data communication, and a third working mode that simultaneously allows encrypted data and ordinary data to establish communication. S302. Based on the working mode established by S301, obtain the Wayland server working mode that the current communication conforms to. S303. Based on the current Wayland server's working mode, and using the overloaded communication write data function interface, the overloaded communication read data function interface, the overloaded client connection request function interface, and the overloaded server communication channel creation function interface, communication is conducted through the Unix Socket channel to complete message encryption and authentication.
[0016] Furthermore, the Wayland server's working mode is specifically as follows: First working mode: Based on the Wayland protocol, the message is decrypted using a key. The key verification is checked. If not, all subsequent requests from the client are rejected. If yes, the data in the subsequent session is encrypted using the key to obtain encrypted messages. Second working mode: disable the Wayland protocol encryption algorithm, reject encrypted messages initiated by the client, revert the Wayland protocol architecture to normal mode and communicate, and only receive Wayland raw message frame requests to obtain normal messages; The third working mode: Utilizes the Wayland protocol framework to simultaneously receive encrypted and unencrypted message requests, performs decryption operations using the key, and determines whether the key verification passes. If yes, the key is used to encrypt the data in the current session to obtain an encrypted message. If no, it reverts to the Wayland protocol framework, parses the Wayland raw message frame, and transmits the unencrypted message in normal mode to obtain a normal message.
[0017] The beneficial effects of the above-mentioned further solutions are as follows: By defining the Wayland server working mode and determining the current Wayland server working mode, the present invention implements encrypted communication using various overloaded function interfaces, thereby achieving independent and non-interfering channel logic, improving the high security of encrypted messages, while unencrypted messages are transmitted in normal mode, thus improving the applicability of the present invention.
[0018] Furthermore, step S303 includes the following steps: S3031. Load the server key information using the Wayland server, initialize the global key information field using the Advanced Encryption Standard (AES) encryption algorithm through the overloaded communication write data function interface, create a function interface through the overloaded server communication channel, and receive connection requests from Wayland clients using the Unix Socket channel. S3032. Obtain the key content through a trusted third-party channel. In response to the client sending a connection request using the key through the overloaded client connection request function interface, calculate the content of the client key information field using the Advanced Encryption Standard (AES) encryption algorithm, obtain the key content, and store the key content in the connection resource instance. S3033. Use the key content to perform encryption calculation on the plaintext message, store the encrypted plaintext message in the encrypted data ring buffer field, and send the encrypted plaintext message using the Unix Socket channel; S3034. In response to the Wayland server receiving an encrypted plaintext message, based on the current Wayland server working mode, the encrypted plaintext message is decrypted using the initialized global key information field through the overloaded communication read data function interface. S3035. Determine whether decryption was successful. If not, discard or revert the Wayland protocol framework to the Wayland original frame parsing mode, perform normal communication between the Wayland client and the Wayland server, and obtain normal information. If yes, use the initialized global key information field to create a private connection resource instance for the Wayland client. S3036. Transmit subsequent Unix Socket channel communication requests to the private connection resource instance. Use the private connection resource instance to perform point-to-point encrypted communication between the Wayland client and the Wayland server, obtain encrypted information, and complete message encryption authentication.
[0019] The beneficial effects of the above-mentioned further solutions are as follows: By combining extended fields and overloaded function interfaces, the present invention realizes message encryption and authentication, and improves the accuracy and efficiency of message encryption by judging the global key information field and the client key information field, so that the Wayland protocol only allows requests through trusted programs. Attached Figure Description
[0020] Figure 1 This is a flowchart of the method of the present invention.
[0021] Figure 2 This is a timing diagram of the message encryption and authentication process in this embodiment.
[0022] Figure 3 This is a schematic diagram of the communication process after the encryption algorithm is applied in this embodiment. Detailed Implementation
[0023] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0024] Before describing this embodiment, the following terms will be explained: Wayland Protocol: A modern display server protocol; Libinput library: A library for handling events from common input devices; Socket files: a special file type used for inter-process network communication; Connection module: The module that connects to the network. AES algorithm: Advanced Encryption Standard (AES) encryption algorithm; IPC: Inter-process communication.
[0025] Example In this embodiment, a data transmission encryption implementation that is outside the scope of the existing technology security framework is proposed. The AES symmetric encryption algorithm is used to encrypt and encapsulate the data before the Wayland server and Wayland client actually communicate. Even if the permission system is compromised, attackers will still be unable to decrypt the encrypted data without obtaining the encryption key, thus providing more secure protection for input content such as mouse and keyboard. Encryption keys can be generated and distributed through trusted third-party channels. The Wayland server can use the keys for authentication, and only client applications carrying legitimate keys can initiate communication requests. This design can completely block all requests from maliciously constructed illegal applications, achieving the effect of a whitelist.
[0026] like Figure 1 As shown, this invention provides a message encryption and authentication method based on the Wayland protocol, the implementation of which is as follows: S1. Based on the Wayland library, the connection module in the Wayland library is extended, and the communication write data function interface and communication read data function interface are overloaded according to the encryption and decryption process of Advanced Encryption Standard, resulting in overloaded communication write data function interface and overloaded communication read data function interface. The specific steps are as follows: S101. Based on the Wayland library, the connection module in the Wayland library is extended by adding a preset encrypted data ring buffer field, a ciphertext field to be decrypted field, an encrypted ciphertext field, a raw data field, and a key information field to the connection module resource structure, resulting in an updated resource structure.
[0027] In this embodiment, the existing Wayland library's connection module is extended by adding the following preset fields to the wl_connection resource structure: struct wl_ring_buffer incrypt (encrypted data ring buffer field), unsignedchar indecrypt
[4096] (ciphertext to be decrypted field), unsignedchar outencrypt
[4096] (encrypted ciphertext field), and unsignedchar plaintext
[4096] (original data field). From the key information field, obtain the updated resource structure; The struct wl_ring_buffer incrypt field is mainly used to store a frame of ciphertext data to be decrypted; The unsigned char indecrypt
[4096] field is mainly used to store a frame of encrypted ciphertext data; The unsigned char outencrypt
[4096] field is mainly used to store a frame of original data. In the encryption operation, it stores the original input data to be encrypted. In the decryption operation, this field stores the original data output after decryption. The The field is mainly used to store context information related to the key. Once loaded, it is continuously stored in memory for subsequent encryption and decryption operations.
[0028] S102. Based on the updated resource structure, the communication write data function interface is overloaded by adding initialization and data encryption calculation logic of advanced encryption standard encryption to obtain the overloaded communication write data function. S103. By adding initialization and data encryption calculation logic for advanced encryption standard decryption, the communication read data function interface is overloaded to obtain the overloaded communication read data function.
[0029] In this embodiment, the wl_connection_write communication write data function interface is overridden, and AES encryption initialization and data encryption calculation logic are added to obtain the overridden communication write data function. The wl_connection_read communication data reading function interface is overridden, and AES decryption initialization and data decryption calculation logic are added to obtain the overridden communication data reading function.
[0030] S2. By adding key judgment logic, the client connection request function interface is reloaded. By adding encryption algorithm enable judgment logic, the server communication channel creation function interface is reloaded. The reloaded client connection request function interface and the reloaded server communication channel creation function interface are obtained, and a Unix Socket channel is established.
[0031] In this embodiment, the wl_display_connect_to_fd client connection request function interface is overridden. This function interface is a Wayland client-specific interface. A key judgment logic is added to this interface. If a key is detected, the key is used to encrypt the data to be transmitted. If no key is detected, the data to be transmitted is in the Wayland raw message frame data format, and then the data to be transmitted is sent to the client through the Unix Socket channel. The `wl_display_create` function interface for creating a server communication channel is overridden. This function interface is dedicated to the Wayland server and can establish a Unix Socket IPC channel. A new logic for determining whether to enable encryption algorithms is added to this interface. When the Wayland server starts, it carries the command-line startup first enabling parameter `enable-encrypt [1 / 2 / 3]` and second enabling parameter `aes-key [filename.txt]`. The server enables the corresponding first, second, or third working mode based on the value of the first enabling parameter, and reads the contents of the file carried by the second enabling parameter as key information and stores it in the global `digest` field. Simultaneously, it uses the Unix Socket channel to listen for connection requests initiated by clients.
[0032] S3. Define the working mode, determine the current communication working mode, and based on the overloaded communication write data function interface, overloaded communication read data function interface, overloaded client connection request function interface, and overloaded server communication channel creation function interface, communicate through the Unix Socket channel and complete message encryption authentication. The specific steps are as follows: S301. Define a first working mode that only allows encrypted data communication, a second working mode that only allows ordinary data communication, and a third working mode that simultaneously allows encrypted data and ordinary data to establish communication. S302, Based on the working mode established by S301, obtain the Wayland server working mode that the current communication conforms to.
[0033] In this embodiment, Wayland server working modes are defined as follows: first working mode: only encrypted data communication is allowed; second working mode: only normal data communication is allowed; third working mode: both encrypted data and normal data communication are allowed. Based on the defined Wayland server working modes, the system retrieves the Wayland server working mode that the current communication conforms to. When the first working mode is met, the Wayland protocol first attempts to decrypt the message using its own key. If the key verification passes, the key is used to continue encrypting data in subsequent sessions. If the key verification fails, all subsequent requests from the client are rejected. When the second working mode is met, the Wayland protocol encryption algorithm fails, the encrypted message initiated by the client is rejected, the Wayland protocol architecture falls back to the normal mode for communication, and only the Wayland raw message frame request is allowed thereafter. When the third working mode is met, the Wayland protocol framework allows both encrypted and unencrypted message requests. It will first attempt to use the key for decryption. If the decryption operation fails, it will fall back to parsing the original Wayland message frame. The logic of each channel is independent and does not interfere with each other. In this case, encrypted messages have high security, while unencrypted messages are transmitted in normal mode, which has lower security.
[0034] S303. Based on the current Wayland server's communication working mode, and using the overloaded communication write data function interface, overloaded communication read data function interface, overloaded client connection request function interface, and overloaded server communication channel creation function interface, communication is conducted through a Unix Socket channel to complete message encryption and authentication. The specific steps are as follows: S3031. Load the server key information using the Wayland server, initialize the global key information field using the Advanced Encryption Standard (AES) encryption algorithm through the overloaded communication write data function interface, create a function interface through the overloaded server communication channel, and receive connection requests from Wayland clients using the Unix Socket channel. S3032. Obtain the key content through a trusted third-party channel. In response to the client sending a connection request using the key through the overloaded client connection request function interface, calculate the content of the client key information field using the Advanced Encryption Standard (AES) encryption algorithm, obtain the key content, and store the key content in the connection resource instance. S3033. Use the key content to perform encryption calculation on the plaintext message, store the encrypted plaintext message in the encrypted data ring buffer field, and send the encrypted plaintext message using the Unix Socket channel.
[0035] In this embodiment, as Figure 2 As shown, the overall working sequence in message encryption authentication mode is as follows: communication mainly involves information exchange between the client and the server. First, the Wayland server loads its own key information and initializes the global key according to the AES algorithm through the wl_connection_write function interface. Fields, storing key context, will be based on global settings in the future. The information stored in the field is encrypted and decrypted, and then an actual Unix Socket public communication channel is established to wait for connection requests from Wayland clients; When a client needs to use a key to make a connection request, the key content must first be obtained from a trusted third-party source, and the client's key must be calculated using the AES algorithm. The content is stored in its own wl_connection resource instance and used by the client when initiating communication. The field performs encrypted calculations on plaintext messages and stores the encrypted data in the struct wl_ring_buffer incrypt field, which is then sent via a Unix Socket channel.
[0036] S3034. In response to the Wayland server receiving an encrypted plaintext message, based on the current Wayland server working mode, the encrypted plaintext message is decrypted using the initialized global key information field through the overloaded communication read data function interface. S3035. Determine whether decryption was successful. If not, discard or revert the Wayland protocol framework to the Wayland raw frame parsing mode, and perform normal communication between the Wayland client and the Wayland server to obtain normal information. If yes, use the initialized global key information field to create a private connection resource instance for the Wayland client.
[0037] In this embodiment, the Wayland server receives messages from the Wayland client by monitoring the read / write status of the Unix socket file. Based on the current Wayland server's operating mode, it adjusts the subsequent communication encryption process, using the wl_connection_read function interface and the initialized global... The field content attempts to decrypt the message. If decryption is successful, a private wl_connection resource instance is created for the current Wayland client, and the initialized global... The field content is copied to the private wl_connection resource instance, and subsequent Unix Socket communication requests are made through the private wl_connection resource instance; if decryption fails, it is discarded or reverted to the Wayland raw frame parsing mode.
[0038] S3036. Transmit subsequent Unix Socket channel communication requests to the private connection resource instance. Use the private connection resource instance to perform point-to-point encrypted communication between the Wayland client and the Wayland server, obtain encrypted information, and complete message encryption authentication.
[0039] If the encryption / decryption verification is successful, both the client and the server will use their own private wl_connection instance to conduct point-to-point encrypted communication and complete message encryption authentication. Among them, the three fields unsigned char indecrypt
[4096] , unsigned char outencrypt
[4096] , and unsigned char plaintext
[4096] are only used internally for temporary conversion between plaintext data and encrypted data during the communication encryption and decryption process.
[0040] In this embodiment, the following is achieved: Figure 3 The communication process shown improves communication security.
Claims
1. A message encryption and authentication method for the Wayland protocol, characterized in that, Includes the following steps: S1. Based on the Wayland library, the connection module in the Wayland library is extended, and the communication write data function interface and communication read data function interface are overloaded according to the encryption and decryption process of Advanced Encryption Standard, so as to obtain the overloaded communication write data function interface and the overloaded communication read data function interface. S2. By adding key judgment logic, the client connection request function interface is reloaded. By adding encryption algorithm enable judgment logic, the server communication channel creation function interface is reloaded. The reloaded client connection request function interface and the reloaded server communication channel creation function interface are obtained, and a Unix Socket channel is established. S3. Define the working mode, determine the current communication working mode, and based on the overloaded communication write data function interface, the overloaded communication read data function interface, the overloaded client connection request function interface, and the overloaded server communication channel creation function interface, communicate through the Unix Socket channel and complete message encryption authentication.
2. The Wayland protocol message encryption and authentication method according to claim 1, characterized in that, S1 includes the following steps: S101. Based on the Wayland library, the connection module in the Wayland library is extended by adding a preset encrypted data ring buffer field, a ciphertext field to be decrypted, an encrypted ciphertext field, a raw data field, and a key information field to the connection module resource structure, resulting in an updated resource structure. S102. Based on the updated resource structure, the communication write data function interface is overloaded by adding initialization and data encryption calculation logic of advanced encryption standard encryption to obtain the overloaded communication write data function. S103. By adding initialization and data encryption calculation logic for advanced encryption standard decryption, the communication read data function interface is overloaded to obtain the overloaded communication read data function.
3. The Wayland protocol message encryption and authentication method according to claim 2, characterized in that, The encrypted data ring buffer field is used to store all encrypted message frames in a sequential manner using a ring buffer, and to transmit the encrypted message frames on the Unix Socket inter-process communication channel. The ciphertext field to be decrypted is used to store a frame of ciphertext data to be decrypted; The encrypted ciphertext field is used to store a frame of encrypted ciphertext data; The original data field is used to store a frame of original data. In the encryption operation, the original data field stores the original input data to be encrypted, and in the decryption operation, the original data field stores the original data output after decryption. The key information field is used to store key-related context information. In response to a single load, the key-related context information is continuously stored in memory.
4. The Wayland protocol message encryption and authentication method according to claim 1, characterized in that, The key determination logic is as follows: if a key is detected, the key is used to encrypt the data to be transmitted; otherwise, the data to be transmitted is sent to the Wayland server using the Wayland raw message frame data format and through the Unix Socket channel.
5. The Wayland protocol message encryption and authentication method according to claim 1, characterized in that, The specific logic for determining whether to enable the encryption algorithm is as follows: if the Wayland server starts with a first startup parameter and a second startup parameter, the corresponding working mode is enabled according to the value of the first startup parameter, and the contents of the file carried in the second startup parameter are read and stored as key information in the key information field; otherwise, the encryption algorithm is not enabled.
6. The Wayland protocol message encryption and authentication method according to claim 3, characterized in that, S3 includes the following steps: S301, Define a first working mode that only allows encrypted data communication, a second working mode that only allows ordinary data communication, and a third working mode that simultaneously allows encrypted data and ordinary data to establish communication. S302. Based on the working mode established by S301, obtain the Wayland server working mode that the current communication conforms to. S303. Based on the current Wayland server's working mode, and using the overloaded communication write data function interface, the overloaded communication read data function interface, the overloaded client connection request function interface, and the overloaded server communication channel creation function interface, communication is conducted through the Unix Socket channel to complete message encryption and authentication.
7. The Wayland protocol message encryption and authentication method according to claim 6, characterized in that, The Wayland server's working mode is specifically as follows: First working mode: Based on the Wayland protocol, the message is decrypted using a key. The key verification is checked. If not, all subsequent requests from the client are rejected. If yes, the data in the subsequent session is encrypted using the key to obtain encrypted messages. Second working mode: disable the Wayland protocol encryption algorithm, reject encrypted messages initiated by the client, revert the Wayland protocol architecture to normal mode and communicate, and only receive Wayland raw message frame requests to obtain normal messages; The third working mode: Utilizes the Wayland protocol framework to simultaneously receive encrypted and unencrypted message requests, performs decryption operations using the key, and determines whether the key verification passes. If yes, the key is used to encrypt the data in the current session to obtain an encrypted message. If no, it reverts to the Wayland protocol framework, parses the Wayland raw message frame, and transmits the unencrypted message in normal mode to obtain a normal message.
8. The Wayland protocol message encryption and authentication method according to claim 6, characterized in that, S303 includes the following steps: S3031. Load the server key information using the Wayland server, initialize the global key information field using the Advanced Encryption Standard (AES) encryption algorithm through the overloaded communication write data function interface, create a function interface through the overloaded server communication channel, and receive connection requests from Wayland clients using the Unix Socket channel. S3032. Obtain the key content through a trusted third-party channel. In response to the client sending a connection request using the key through the overloaded client connection request function interface, calculate the content of the client key information field using the Advanced Encryption Standard (AES) encryption algorithm, obtain the key content, and store the key content in the connection resource instance. S3033. Use the key content to perform encryption calculation on the plaintext message, store the encrypted plaintext message in the encrypted data ring buffer field, and send the encrypted plaintext message using the Unix Socket channel; S3034. In response to the Wayland server receiving an encrypted plaintext message, based on the current Wayland server working mode, the encrypted plaintext message is decrypted using the initialized global key information field through the overloaded communication read data function interface. S3035. Determine whether decryption was successful. If not, discard or revert the Wayland protocol framework to the Wayland original frame parsing mode, perform normal communication between the Wayland client and the Wayland server, and obtain normal information. If yes, use the initialized global key information field to create a private connection resource instance for the Wayland client. S3036. Transmit subsequent Unix Socket channel communication requests to the private connection resource instance. Use the private connection resource instance to perform point-to-point encrypted communication between the Wayland client and the Wayland server, obtain encrypted information, and complete message encryption authentication.
Citation Information
Patent Citations
Multi-protocol communication method
CN118400446A
System supporting qt4 to adapt to wayland and wayland interaction method
CN119248268A
Methods and Apparatus for Dynamic Class Reloading and Versioning
US20100199259A1
Graphics acceleration for applications executing on mobile devices with multi-operating system environment
US20150193904A1
Communicating with a Constrained Internet Device
US20150229726A1