Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
To facilitate a better understanding of the embodiments of the present application by those skilled in the art, the technical terms or partial terms that may be referred to in the present application are now explained as follows:
and (4) zero terminal: the zero terminal is an exquisite and unique network computer without a CPU, a memory and a hard disk zero terminal, can be used as a mini PC to independently operate and browse a webpage, can construct a shared computing network, and develops a business operation network with innovative cost advantage. The computer host is divided into thirty or more users to use simultaneously, each user only needs to be provided with a keyboard, a mouse, a display and a zero terminal machine, and other users do not need a mini host of the host (a single machine and multiple users) except a host manager.
MD5 Message Digest Algorithm (english: MD5 Message-Digest Algorithm), a widely used cryptographic hash function, can generate a 128-bit (16-byte) hash value (hash value) to ensure the integrity of the Message transmission.
HMAC is an abbreviation of Hash-based Message Authentication Code (Hash-based Message Authentication Code), a method for performing Message Authentication based on a Hash function and a key, proposed by h.krawezyk, m.bellare, r.canetti in 1996, published as RFC2104 in 1997, and widely used in IPSec and other network protocols (such as SSL), and now becomes a de facto Internet security standard. It can be used in conjunction with any iterative hash function.
Secure Hash algorithms (english: Secure Hash Algorithm, abbreviated SHA) are a family of cryptographic Hash functions, which are FIPS certified Secure Hash algorithms. An algorithm for calculating a fixed-length character string (also called a message digest) corresponding to a digital message. And if the input messages are different, the probability that the input messages correspond to different character strings is high.
The irreversible encryption algorithm is characterized in that a secret key is not needed in the encryption process, the system directly processes the input plaintext into a ciphertext through the encryption algorithm, the encrypted data cannot be decrypted, and the data can be really decrypted only by re-inputting the plaintext and re-processing the plaintext through the same irreversible encryption algorithm to obtain the same encrypted ciphertext which is re-identified by the system.
Virtual Desktop Infrastructure (VDI) is a virtualization solution that provides and manages virtual desktops using virtual machines. VDI hosts the desktop environment on a centralized server and deploys it to end users upon request. Access may be made over a network using endpoint devices (notebook, tablet, etc.). After deploying the VDI solution, the enterprise can obtain many advantages. Desktop computing is performed on the host server, not the endpoint device, and therefore the hardware requirements for the endpoint are low. This may reduce the investment in end point equipment and may make it easier to support a variety of remote and mobile devices. As the hardware requirements of the desktop software change, it may be easier to reallocate CPU and memory from the server side than from the endpoint device. Security and configuration management are additional advantages of VDI solutions. Since all data is located in the data center, the loss of any endpoint device can limit the exposure of data not stored in the device. In an environment employing a standardized desktop configuration that does not require customization for each user, the VDI instance can provide tight control to eliminate deviations from organizational standards. When the virtual desktop is used, the PC operating system runs at a background server end, and the local terminal is only used for connecting and displaying; the user can use the virtual desktop at any place and in any connectable network environment by using any terminal.
VDI, in brief, virtualizes your desktop by running various operating systems, such as the Windows system, on the cluster servers of the data center. Users are connected with a virtual desktop (generally, a virtual machine) through a client computing protocol from a client device (zero terminal), the users can access the desktops of the users through the zero terminal just like accessing a traditional locally installed desktop, the users can be connected to the desktops which the users want to be connected at any time and any place as long as a network exists, IT personnel can manage desktop users and data more easily, and the data of the users are safer because all the data are in a service provider. A user can access the virtual machine distributed to the cluster server through the zero terminal, so that a desktop image is obtained, and the obtained virtual desktop is controlled in a reverse control mode. Fig. 1 is a schematic architecture diagram of an alternative VDI system in the related art, as shown in fig. 1, all virtual machines are placed in a cluster server, and each virtual machine corresponds to a zero terminal.
For better understanding of the related embodiments of the present application, first, a brief description is made on USB redirection, and fig. 2 is a schematic diagram of a conventional mode, i.e., a PC mode USB peripheral, as shown in fig. 2: all USB peripherals work normally and rely on USB bus drivers at the software level. An application needs to use a USB peripheral to interact with a USB device driver, the device driver completely depends on a USB bus driver to interact with USB device data, and the interaction with hardware is completed by a proxy of the bus driver.
It should be noted that, in the VDI scenario, USB redirection is divided into two types: USB port redirection and USB device redirection;
the USB port is redirected, the data of the USB equipment inserted in the zero terminal is submitted to a virtual USB driver through a USB bus of the zero terminal, the virtual USB driver is responsible for bidirectionally transmitting data between the zero terminal bus and a USB client, all details of USB hardware are transmitted really, and for a virtual machine, the virtual USB driver is equivalent to inserting one USB hardware on the virtual USB bus;
USB device redirection is implemented at the application layer, and enables an application program to obtain data by creating a virtual USB peripheral driver (for an operating system, one driver means one device), on a virtual machine, and for the whole system, the virtual USB peripheral driver and the USB device driver on the zero terminal are essentially two different USB devices, and the device redirection function maintains a data channel between the two drivers (similar to copying data between two USB disks).
In accordance with an embodiment of the present application, there is provided a method embodiment for data encryption, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 3 is a data encryption method according to an embodiment of the present application, as shown in fig. 3, the method includes the following steps:
step S102, starting a USB transmission channel, wherein the USB transmission channel is used for transmitting a file to be transmitted in a host to a terminal;
step S104, under the condition that the physical environment of the target object is detected to meet the preset condition, starting a safety mode of a USB transmission channel, and monitoring a current cache region, wherein the current cache region is used for caching a file to be transmitted;
step S106, determining the type of the file to be transmitted under the condition that the monitoring result indicates that the file to be transmitted to the terminal exists in the current cache region through the USB transmission channel, wherein the type of the file at least comprises: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained;
step S108, determining an encryption strategy according to the type of the file, wherein the encryption strategy is used for encrypting the file;
and step S110, after the file is encrypted, transmitting the file to the terminal through the USB transmission channel.
In the data encryption method, a USB transmission channel is started, wherein the USB transmission channel is used for transmitting a file to be transmitted in a host to a terminal; starting a safety mode of a USB transmission channel and monitoring a current cache region under the condition that the physical environment of a target object meets a preset condition, wherein the current cache region is used for caching a file to be transmitted; and determining the type of the file to be transmitted under the condition that the monitoring result indicates that the file to be transmitted to the terminal exists in the current cache region through the USB transmission channel, wherein the type of the file at least comprises the following steps: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained; determining an encryption strategy according to the type of the file, wherein the encryption strategy is used for encrypting the file; after the files are encrypted, the files are transmitted to the terminal through the USB transmission channel, and the purpose of transmitting the encrypted files to the terminal through the USB channel is achieved, so that the technical effects of flexibly executing different encryption strategies to encrypt the files to be transmitted based on different types of the files to be transmitted and preventing the files from being leaked are achieved, and the technical problems that file data possibly existing in the files transmitted from a host to a zero terminal based on the USB channel are easily leaked and the safety is poor in a VDI application scene after the USB channel is opened are solved.
It should be noted that the host may be a virtual machine in a cluster server, and the terminal includes but is not limited to: the zero terminal, the preset conditions include: the method includes that an instruction input to a zero terminal by a current user is wrong, namely, a desktop unlocking instruction input to the zero terminal by the current user is detected, if the unlocking instruction is inconsistent with a preset unlocking instruction, a preset condition is determined to be met, the preset condition can be an image of the current user, if the image of the current user is inconsistent with an image of an administrator corresponding to the zero terminal, the preset condition is determined to be met, and the preset condition further comprises the following steps: by collecting the sound size of the current environment, if the sound size is larger than a preset size, the preset condition is determined to be met.
In some embodiments of the present application, the first type of document includes: pictures and words, therefore, the encryption strategy is determined according to the type of the file, and the method comprises the following steps: determining a picture encryption strategy corresponding to the picture under the condition that the first type file is detected to be the picture; determining a character encryption strategy corresponding to characters under the condition that the first type file is detected to be the characters; in the case that the type of the detected file is the second type file, determining an encryption policy corresponding to the second type file, where the pictures and characters in the specification refer to characters or images that can be directly copied and pasted in a state that the file or software is opened, for example, characters or images copied in a word document, or characters or images copied from a software display page, such as a chat record in chat software.
Specifically, when it is detected that the first type file is a picture, determining a picture encryption policy corresponding to the picture includes: acquiring the file size of the picture; comparing the file size of the picture with a preset threshold, wherein the preset threshold comprises: the device comprises a first preset threshold and a second preset threshold, wherein the first preset threshold is smaller than the second preset threshold; under the condition that the file size of the picture is smaller than a first preset threshold value, encrypting all contents corresponding to the picture; encrypting the head data of the first preset size before and the tail data of the second preset size after the picture under the condition that the file size of the picture is larger than a first preset threshold and smaller than a second preset threshold; and under the condition that the file size of the picture is larger than a second preset threshold value, encrypting the picture at an interval of a third preset size. For example, when a picture is less than 1kb fully encrypted, 1kb-1Mb are encrypted head-to-tail, and 1Mb or more is encrypted every 500kb, i.e., encrypted according to the picture size.
Optionally, when it is detected that the first type file is a picture, a picture encryption policy corresponding to the picture may be determined in the following manner, and specifically, content of the picture is obtained; determining a security level of the picture based on the content of the picture; the picture is encrypted based on the security level, wherein the security level corresponds to different picture encryption strategies, for example, when the obtained picture content is the content disclosed by the network, for example, the picture content is the address of a company, a legal person, and the like, the picture may not be encrypted, and when the obtained content is the core technology of the company, the picture is completely encrypted, for example, the picture is encrypted in a full-screen mosaic manner.
In some optional embodiments of the present application, in a case that it is detected that the first type file is a text, determining a text encryption policy corresponding to the text includes: and encrypting the characters based on an irreversible encryption algorithm. The irreversible encryption algorithm includes, but is not limited to: MD5, SHA, HMAC algorithm.
In some optional embodiments of the present application, in a case that the type of the detected file is a second type of file, determining an encryption policy corresponding to the second type of file includes: acquiring the transmission rate of a USB channel; dividing the file size of the second type of file based on the transmission rate and the preset transmission time length; obtaining a plurality of data blocks corresponding to the second class of files based on the division result; sequencing the data blocks according to a preset rule to obtain a sequencing sequence number; whether each data block is encrypted is determined based on the sequencing sequence number, namely, the second type file is divided according to the attribute of the USB channel, and the second type file is encrypted based on the division result, obviously, the second type file is the whole file which cannot be copied and pasted at one time, such as pictures, documents, videos, software installation packages, folders and the like in various formats.
Specifically, determining whether to encrypt each data block based on the sorting sequence number includes: judging whether the sequencing serial number is an odd number or an even number; under the condition that the sequencing serial number is odd, encrypting the data block with the odd sequencing serial number; in the case where the sort number is even, the data block with the even sort number is not encrypted, for example, 1 to 9 data blocks, 1/3/5/7/9 is encrypted.
In addition, when the sort number is even, the data block with the even sort number may be encrypted, and when the sort number is odd, the data block with the odd sort number may not be encrypted.
In another optional embodiment of the present application, in a case that the type of the detected file is the second type of file, the encryption policy corresponding to the second type of file may be further determined in the following manner, and specifically, a file handle corresponding to the second type of file is obtained; acquiring a file body of the second type of file based on the file handle; and performing segmented reading and writing on the file body, and encrypting the second type of file based on the segmented reading and writing result.
Optionally, the data encryption method may include the following steps:
1. establishing connection and establishing a USB channel;
2. when detecting that the current client environment is unsafe, the system starts a USB transmission channel safety mode and starts to monitor all buffer zone operations;
3. if the current buffer zone has the operation of transmitting the file or the content to the mobile equipment through the USB channel, immediately intercepting;
specifically, the content refers to characters or images directly pasted in a file or software open state; for example, text or images are copied in a word document, or from a software display box, such as a WeChat chat log.
A file refers to the whole file, including pictures, documents, videos, software installation packages, folders, and the like in various formats.
Specifically, before the file or the content is transmitted to the USB device, the file or the content to be transmitted is intercepted.
4. After interception, encrypting the file or the content;
specifically, the content includes characters, images, and the like directly copied by a copy manner; files include, but are not limited to, pictures, documents, videos, software installation packages, folders, etc. files in various formats.
Respectively carrying out different processing on the copy of the picture content, the character content and the file; when the picture content to be copied is detected, encrypting the picture content, wherein the encryption strategy can be referred to; when the text content is detected, completely encrypting the whole text content; when the file is detected, encrypting part of the file, referring to the encryption strategy, recording the current file, and referring to the encryption strategy if the same file is encrypted for multiple times;
5. replacing the encrypted piece of data with the ciphertext;
6. copying the whole file to the mobile equipment through a USB transmission channel;
7. and when the current client environment is detected to be restored to be safe, the USB transmission channel safety mode is exited.
Fig. 4 is an alternative data encryption apparatus according to an embodiment of the present application, as shown in fig. 4, the apparatus including:
the starting module 40 is configured to start a USB transmission channel, where the USB transmission channel is used to transmit a file to be transmitted in a host to a terminal;
the monitoring module 42 is configured to start a security mode of the USB transmission channel and monitor a current cache region when detecting that a physical environment of the target object meets a preset condition, where the current cache region is used to cache a file to be transmitted;
a first determining module 44, configured to determine a type of a file to be transmitted when the monitoring result indicates that the file to be transmitted to the terminal through the USB transmission channel exists in the current cache region, where the type of the file at least includes: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained;
a second determining module 46, configured to determine an encryption policy according to the type of the file, where the encryption policy is used for encrypting the file;
and the transmission module 48 is used for transmitting the file to the terminal through the USB transmission channel after the encryption of the file is completed.
In the data encryption device, a starting module 40 is used for starting a USB transmission channel, wherein the USB transmission channel is used for transmitting a file to be transmitted in a host to a terminal; the monitoring module 42 is configured to start a security mode of the USB transmission channel and monitor a current cache region when detecting that a physical environment of the target object meets a preset condition, where the current cache region is used to cache a file to be transmitted; a first determining module 44, configured to determine a type of a file to be transmitted when the monitoring result indicates that the file to be transmitted to the terminal through the USB transmission channel exists in the current cache region, where the type of the file at least includes: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained; a second determining module 46, configured to determine an encryption policy according to the type of the file, where the encryption policy is used for encrypting the file; the transmission module 48 is configured to transmit the file to the terminal through the USB transmission channel after the file is encrypted, so as to achieve a purpose of transmitting the encrypted file to the terminal through the USB channel, thereby implementing a technical effect of flexibly executing different encryption strategies to encrypt the file to be transmitted based on different types of the file to be transmitted, and preventing the file from being leaked, and further solving technical problems that file data is easily leaked and the security is poor when the file is transmitted from the host to the zero terminal based on the USB channel after the USB channel is opened in a VDI application scenario.
According to another aspect of the embodiments of the present application, there is also provided a non-volatile storage medium, which includes a stored program, wherein a device in which the non-volatile storage medium is located is controlled to execute any one of the data encryption methods when the program is executed.
Specifically, the storage medium is used for storing program instructions for executing the following functions, and the following functions are realized:
starting a USB transmission channel, wherein the USB transmission channel is used for transmitting a file to be transmitted in a host to a terminal; under the condition that the physical environment of the target object is detected not to meet the preset condition, starting a safety mode of a USB transmission channel, and monitoring a current cache region, wherein the current cache region is used for caching a file to be transmitted; and determining the type of the file to be transmitted under the condition that the monitoring result indicates that the file to be transmitted to the terminal exists in the current cache region through the USB transmission channel, wherein the type of the file at least comprises the following steps: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained; determining an encryption strategy according to the type of the file, wherein the encryption strategy is used for encrypting the file; and after the encryption of the file is finished, transmitting the file to the terminal through the USB transmission channel.
According to another aspect of the embodiments of the present application, there is also provided a processor, configured to execute a program, where the program executes any one of the data encryption methods.
Specifically, the processor is configured to call a program instruction in the memory, and implement the following functions:
starting a USB transmission channel, wherein the USB transmission channel is used for transmitting a file to be transmitted in a host to a terminal; under the condition that the physical environment of the target object is detected not to meet the preset condition, starting a safety mode of a USB transmission channel, and monitoring a current cache region, wherein the current cache region is used for caching a file to be transmitted; and determining the type of the file to be transmitted under the condition that the monitoring result indicates that the file to be transmitted to the terminal exists in the current cache region through the USB transmission channel, wherein the type of the file at least comprises the following steps: the method comprises the following steps that a first type file which can be copied and pasted at one time and a second type file which cannot be copied and pasted at one time are obtained; determining an encryption strategy according to the type of the file, wherein the encryption strategy is used for encrypting the file; and after the encryption of the file is finished, transmitting the file to the terminal through the USB transmission channel.
In the embodiment of the application, a mode that a file is encrypted in a USB file transmission process when the current environment is detected to be in an unsafe scene is adopted, the purpose of transmitting the encrypted file to a terminal through a USB channel is achieved by determining the type of the file transmitted to the terminal through the USB channel and executing different encryption strategies based on the type of the file, so that the technical effects of flexibly executing different encryption strategies to encrypt the file to be transmitted and preventing the file from being leaked based on different types of the file to be transmitted are achieved, and the technical problems that file data possibly existing in the file transmission from a host to a zero terminal based on the USB channel is easily leaked and the safety is poor in a VDI application scene after the USB channel is opened are solved.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.