WO2019214028A1 - 数据传输方法、装置、设备及计算机可读存储介质 - Google Patents
数据传输方法、装置、设备及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2019214028A1 WO2019214028A1 PCT/CN2018/093729 CN2018093729W WO2019214028A1 WO 2019214028 A1 WO2019214028 A1 WO 2019214028A1 CN 2018093729 W CN2018093729 W CN 2018093729W WO 2019214028 A1 WO2019214028 A1 WO 2019214028A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- transmitted
- byte array
- byte
- length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/04—Protocols for data compression, e.g. ROHC
Definitions
- the present application relates to the field of communications technologies, and in particular, to a data transmission method, apparatus, device, and computer readable storage medium.
- the data transmitted by the sender and the receiver will be maliciously intercepted by the illegal molecule, resulting in loss of the sender and the receiver.
- the transmitting end encrypts the data to be sent, encrypts the data, and transmits the data to the receiving end.
- the encryption algorithm used is relatively simple, illegal molecules can easily crack the encrypted data, so that the data transmitted by the sender and the receiver is still easily cracked by illegal molecules, resulting in data transmission between the sender and the receiver. Low sex.
- the main purpose of the present application is to provide a data transmission method, apparatus, device and computer readable storage medium, which aim to solve the technical problem of low data security transmitted between the existing sender and the receiver.
- the present application provides a data transmission method, where the data transmission method includes the following steps:
- the data to be transmitted is initialized and assigned, and the data to be transmitted after the assignment is obtained;
- the processed data to be transmitted is sent to the receiving end, and the receiving end parses the processed data to be transmitted after receiving the processed data to be transmitted, to obtain the data to be transmitted.
- the step of compressing and encrypting the data to be transmitted after the step of obtaining the processed data to be transmitted further includes:
- the step of detecting whether the data to be transmitted meets a compression condition comprises:
- the method further includes:
- the prompt information is output to prompt the user that the data to be transmitted does not satisfy the compression condition according to the prompt information.
- the step of compressing and encrypting the data to be transmitted after the assignment is performed, and obtaining the processed data to be transmitted includes:
- the compressed data to be transmitted is encrypted by using a preset encryption algorithm to obtain the processed data to be transmitted.
- the step of encrypting the compressed data to be transmitted by using a preset encryption algorithm, and obtaining the processed data to be transmitted includes:
- the step of initializing the data to be transmitted after obtaining the data to be transmitted, and obtaining the data to be transmitted after the assignment includes:
- the target length is defined as the byte length of the byte array to obtain the assigned data to be transmitted.
- the present application further provides a data transmission apparatus, where the data transmission apparatus includes:
- An assignment module configured to perform initial value assignment on the data to be transmitted after obtaining the data to be transmitted, to obtain the data to be transmitted after the assignment;
- a processing module configured to perform compression and encryption processing on the data to be transmitted after the assignment, to obtain the processed data to be transmitted;
- a sending module configured to send the processed data to be transmitted to the receiving end, where the receiving end parses the processed data to be transmitted after receiving the processed data to be transmitted, and obtains a The data to be transmitted is mentioned.
- the present application further provides a data transmission device including a memory, a processor, and a data transmission program stored on the memory and operable on the processor, The steps of the data transfer method as described above are implemented when the data transfer program is executed by the processor.
- the present application further provides a computer readable storage medium having a data transfer program stored thereon, the data transfer program being executed by a processor to implement data transfer as described above The steps of the method.
- the data to be transmitted is encrypted and compressed, and the compressed and encrypted data is obtained, and the compressed and encrypted data is transmitted to the receiving end, and the transmitting end and the receiving end are used.
- the data to be transmitted is double-secured for compression and encryption, which improves the security of data transmitted between the sender and the receiver, and protects the data transmitted between the sender and the receiver from being stolen by illegal elements.
- FIG. 1 is a schematic flowchart of a first embodiment of a data transmission method according to the present application.
- FIG. 2 is a schematic flowchart of a second embodiment of a data transmission method according to the present application.
- FIG. 3 is a schematic flowchart of a third embodiment of a data transmission method according to the present application.
- FIG. 4 is a block diagram showing the function of a preferred embodiment of the data transmission apparatus of the present application.
- FIG. 5 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
- FIG. 1 is a schematic flowchart of a first embodiment of a data transmission method according to the present application.
- the embodiment of the present application provides an embodiment of a data transmission method. It should be noted that although the logical order is shown in the flowchart, in some cases, the illustrated or described may be performed in an order different from the sequence here. A step of.
- the data transmission method can be applied to the sender, and the sender can include, for example, a mobile phone, a tablet, a laptop, a palmtop, a personal digital assistant (Personal Digital) Assistant, PDA), Portable Media Player (Portable Media) Mobile terminals such as Players, PMPs, navigation devices, wearable devices, smart bracelets, pedometers, and fixed terminals such as digital TVs, desktop computers, and the like.
- a mobile phone a tablet, a laptop, a palmtop
- PDA Personal Digital Assistant
- Portable Media Player Portable Media Player
- Data transmission methods include:
- step S10 after the data to be transmitted is acquired, the data to be transmitted is initialized and assigned, and the data to be transmitted after the assignment is obtained.
- the transmitting end After the transmitting end acquires the data to be transmitted, the transmitting end performs an initialization operation on the data to be transmitted, and assigns the data to be transmitted to obtain the data to be transmitted after the assignment.
- the pre-defined JZlib Zstream object, the information corresponding to the byte array of the data to be transmitted can be stored in the member variable of the Zstream object.
- the data to be transmitted may be manually input by the user during the data transmission process between the transmitting end and the receiving end, or may be pre-stored in the database of the sending end.
- the transmitting end needs to perform data interaction with the receiving end, the sending end from the database thereof Obtained in .
- JZlib is the Java version of Zlib, which is a library for providing data compression. In the process of defining JZlib's Zstream object, you can use the new keyword in the Java syntax to call a Java class constructor to define an instantiated object of the class, that is, define ZZlib's Zstream object.
- the member variables in the Zstream object are: 1next_in: store in Bytes (input data) content; 2next_in_index: record the starting subscript of in Bytes; 3avail_in: record in Length of Bytes; 4next_out: store the contents of out Bytes; 5next_out_index: record out The starting subscript of Bytes (output data); 6avail_out: record out The length of the Bytes.
- the start bit of the content in the input data and the output data can be known by the corresponding of next_in_index and next_out_index. If the start bit of an input data is 3, it means that in the string of input data, the real content of the input data is from the third digit.
- step S10 includes:
- Step a after acquiring the data to be transmitted, converting the data type of the data to be transmitted into a byte array, and acquiring the length of the byte array.
- the transmitting end converts the data type of the data to be transmitted into a byte array, and obtains the byte length of the byte array.
- byte[] In Bytes represents a byte array. It can be understood that the byte array corresponding to the data to be transmitted is the input data in Bytes of the Zstream object.
- Step b Determine, according to a byte length of the byte array, a target length corresponding to the byte array according to a preset rule.
- the sender determines the target length corresponding to the byte array according to a preset rule. Specifically, the sender rounds the byte length of the byte array to obtain the processed byte length, and adds 13 to the processed byte length to obtain a target length corresponding to the byte array. 13 can be set to other prime numbers according to specific needs. In this embodiment, the prime number in the process is not specifically limited.
- the target length is defined as the byte length of the byte array to obtain the assigned data to be transmitted.
- the target length is defined as the byte length of the byte array to obtain the data to be transmitted after the assignment.
- the data to be transmitted after the assignment is the data to be transmitted after the length of the byte is changed.
- the data to be transmitted after the assignment is the output data out. Bytes.
- Step S20 Perform compression and encryption processing on the data to be transmitted after the assignment, to obtain the processed data to be transmitted.
- the sender After the sender receives the data to be transmitted, the data to be transmitted after the assignment is compressed and encrypted to obtain the processed data to be transmitted.
- step S20 includes:
- step d the initial data corresponding to the data to be transmitted after the assignment is obtained.
- the sending end acquires the starting data corresponding to the data to be transmitted after the assignment. Specifically, the sending end extracts the subscript bit next_out_index of the output data from the Zstream object to obtain the initial data corresponding to the data to be transmitted after the assignment, that is, the starting subscript of the output data is the starting data corresponding to the data to be transmitted.
- Step e according to the length value corresponding to the start data, establish a target array, perform a for loop according to the start data, to assign values to the byte array corresponding to the data to be transmitted after the assignment In the target array, the compressed data to be transmitted is obtained.
- step f the compressed data to be transmitted is encrypted by using a preset encryption algorithm, and the processed data to be transmitted is obtained.
- the sender uses a preset encryption algorithm to encrypt the compressed data to be transmitted, and obtains the data to be transmitted after the encryption, that is, the processed data to be transmitted.
- Pre-set encryption algorithms include but are not limited to 3DES, DES (Data Encryption Algorithm, Data Encryption Standard, SHA (Secure Hash Algorithm), AES (Advanced) Encryption Standard, Advanced Encryption Standard), ECC (Elliptic Curves) Cipher, elliptic curve cipher) and MD5 (Message-Digest Algorithm) 5, information - summary algorithm 5) and so on.
- 3DES Data Encryption Algorithm, Data Encryption Standard, SHA (Secure Hash Algorithm), AES (Advanced) Encryption Standard, Advanced Encryption Standard), ECC (Elliptic Curves) Cipher, elliptic curve cipher) and MD5 (Message-Digest Algorith
- 3DES is a triple data encryption algorithm (TDEA, Triple Data Encryption).
- Algorithm A general term for block ciphers, also known as Triple DES.
- the 3DES encryption algorithm is preferentially used, and the 3DES algorithm uses three different keys to encrypt the same packet data block three times to improve the strength of the encrypted data.
- step f includes:
- Step f1 Convert the compressed data to be transmitted into a string corresponding to a preset hexadecimal, and obtain a pre-stored key.
- the sender After the sender receives the compressed data to be transmitted, the sender converts the compressed data to be transmitted into a string corresponding to the preset hexadecimal number, and obtains the pre-stored key.
- the type of the key is determined according to a preset encryption algorithm.
- the preset encryption algorithm is a symmetric encryption algorithm
- the corresponding key is a symmetric key
- the sender can use the code of the org.apache.commons.codec.binary.Hex class in Java. Hex The String method converts the compressed data to be transmitted into a hexadecimal string.
- the sender can also convert the compressed data to be transmitted into an octal, or other string corresponding to the hexadecimal.
- Step f2 Encrypt the character string by using a preset encryption algorithm according to the key, to obtain the processed data to be transmitted.
- the string is encrypted by a preset encryption algorithm to obtain the processed data to be transmitted.
- the encryption algorithm uses the Cipher class in the javax.crypto package in the JDK, and the declared Cipher object encrypts the compressed data to be transmitted and returns the corresponding byte data, thereby obtaining the processed to be transmitted. data.
- JDK is The Java language software development kit is mainly used for Java applications on mobile devices and embedded devices.
- the Cipher class provides password functions for encryption and decryption.
- Step S30 the processed data to be transmitted is sent to the receiving end, and the receiving end parses the processed data to be transmitted after receiving the processed data to be transmitted, to obtain the to-be-transmitted data. transfer data.
- the processed data to be transmitted is sent to the receiving end.
- the receiving end parses the processed data to be transmitted, and obtains the data to be transmitted that is not encrypted and uncompressed, that is, the original data to be transmitted is obtained.
- the receiving end parses the processed data to be transmitted as follows: the receiving end acquires the key required for decryption, and acquires the Cipher object, and decrypts the processed data to be transmitted through the Cipher object and the key, and obtains the processed to be transmitted.
- the byte data corresponding to the data and convert the byte data into a string. It should be noted that the string is the compressed data to be transmitted.
- the name of the encryption algorithm, the mode of packet encryption, and the message of the filling method of the last packet are included. Therefore, the processed data to be transmitted can be decrypted by using the Cipher object and the key, and the compressed data to be transmitted is obtained.
- the encryption algorithm used by the transmitting end is a symmetric encryption algorithm
- the key used for the encryption of the transmitting end is the same as the key used for decryption by the receiving end;
- the encryption algorithm used by the transmitting end is an asymmetric encryption algorithm
- the sender uses the private key for encryption, and the receiver uses the corresponding public key for decryption. If the sender uses the public key for encryption, the receiver uses the corresponding private key for decryption.
- the receiving end After the receiving end obtains the compressed data to be transmitted, the receiving end acquires the JStream object of the ZZlib, initializes the ZStream object according to the compressed data to be transmitted, and then defines a List object of the Byte, and decompresses and compresses the compressed object through the for loop. Transmitting data, obtaining corresponding byte data, and storing the obtained byte data into the List object, and assigning the byte data in the List object to the byte array to obtain the decompressed data to be transmitted, that is, obtaining The original data to be transmitted.
- the specific process of the ZStream object being initialized by the receiving end according to the compressed data to be transmitted is: converting the compressed data to be transmitted into a byte array byte[] In Bytes, rounded up according to the length of in Bytes, plus 13 to get the output data out Bytes byte array length out Length, then define the length as out The byte array out Bytes of Length.
- the element stored in the List object is byte bytes, and the receiving end will get the out of the ZStream object during the decompression process.
- Bytes byte array then for the length of ZStream.next_out_index for the loop traversal operation, will out
- the bytes in the Bytes byte array are added to the list object one by one.
- the data in the list object is the character of the plaintext data that has been decrypted and decompressed.
- a new length is listed.
- the byte array byte[] assigns the byte data in the list object to the newly created byte array one by one, and finally uses new String(byte[]) gets the complete plaintext string.
- the data to be transmitted is subjected to encryption processing and compression processing, and the compressed and encrypted data is obtained, and the compressed and encrypted data is transmitted to the receiving end, and the transmitting end and the receiving end are transmitted to the receiving end and the receiving end.
- the dual security processing of the data to be transmitted between the transmission and the encryption improves the security of the data transmitted between the sender and the receiver, and protects the data transmitted between the sender and the receiver from being stolen by illegal elements.
- the second embodiment of the data transmission method differs from the first embodiment of the data transmission method in that, referring to FIG. 2, the data transmission method further includes:
- Step S40 detecting whether the data to be transmitted meets a compression condition.
- the transmitting end After the transmitting end acquires the data to be transmitted, the transmitting end detects whether the data to be transmitted satisfies the compression condition.
- step S40
- Step g Convert the byte array corresponding to the data to be transmitted into a target byte array according to a left shift or a right shift algorithm in a bit operation.
- the sender invokes a DEFLATE method, and takes the ZStream object as an input parameter of the DEFLATE method, and the byte array is in Bytes generates a new byte array according to the left shift algorithm or the right shift algorithm in the bit operation, that is, the byte array corresponding to the data to be transmitted is converted into the target byte array according to the left shift algorithm or the right shift algorithm in the bit operation.
- the number of bits corresponding to the left or right shift can be set according to specific needs, and is not specifically limited in this embodiment.
- DEFLATE uses both the LZ77 algorithm and Huffman coding (Huffman) Coding) A lossless data compression algorithm.
- LZ77 coding is a dictionary-based, "sliding window" lossless compression algorithm. It can be understood that, in this embodiment, the sending end may also invoke other compression algorithms, and use the ZStream object as an input parameter of other compression algorithms.
- Step h assigning the target byte array to an output data member variable of the preset object, and checking whether the data in the preset object satisfies a preset condition.
- the sender After the sender obtains the target byte array, the sender fills the target byte array into the next_out member variable of the ZStream object, that is, assigns the target byte array to the output data member variable of the preset object, and the content and length of the next_out. Checking, and returning a value of type int according to the check result, and determining whether the data in the ZStream object satisfies the preset condition according to the value of the int type.
- the preset object is a ZStream object.
- the next_out member variable stores the data to be transmitted after the assignment.
- the transmitting end When it is detected that the content of the data to be transmitted after the assignment is consistent with the original data to be transmitted, and the length of the data to be transmitted after the assignment is correct with the original data to be transmitted, the transmitting end is to be transmitted.
- the data meets the preset condition check result, that is, it is determined that the output data member variable in the preset object satisfies the preset condition; if the content of the data to be transmitted after the assignment is detected is inconsistent with the original data content to be transmitted, and/or after the assignment
- the correspondence between the length of the data to be transmitted and the original data to be transmitted is incorrect, and the transmitting end obtains that the data to be transmitted does not satisfy the preset condition verification result, that is, determines that the output data member variable in the preset object does not satisfy the preset condition.
- the length of the data to be transmitted after the assignment is determined by the preset rule according to the length of the original data to be transmitted. Therefore, the length of the data to be transmitted after the assignment and the length of the original data to be transmitted are certain. Corresponding relationship.
- step i if the output data member variable satisfies a preset condition, it is determined that the data to be transmitted satisfies the compression condition.
- the sending end determines that the data to be transmitted satisfies the compression condition, and may perform compression processing on the data to be transmitted.
- the transmitting end may determine, according to the value of the int type, whether the data in the preset object satisfies a preset condition. For example, when the sender determines that the data in the preset object satisfies the preset condition, it returns a value of type int, such as returning “0”, and displaying the value in its display screen to prompt the user that the data to be transmitted satisfies the compression condition. . At this time, the user can determine that the data to be transmitted satisfies the compression condition according to “0” in the display screen of the transmitting end.
- step j if the output data member variable does not meet the preset condition, it is determined that the data to be transmitted does not satisfy the compression condition.
- the transmitting end determines that the data to be transmitted does not satisfy the compression condition, and may not compress the data to be transmitted. Specifically, the transmitting end may determine, according to the value of the int type, whether the data in the preset object satisfies a preset condition. For example, when the sender determines that the data in the preset object satisfies the preset condition, it returns a value of type int, such as returning "1", and displaying the value in its display, the user can be based on the display in the sender's display. "1" determines that the data to be transmitted does not satisfy the compression condition.
- step S20 is performed.
- the transmitting end determines that the data to be transmitted satisfies the compression condition, the transmitting end compresses and encrypts the data to be transmitted after the assignment, and obtains the processed data to be transmitted.
- the transmitting end determines that the data to be transmitted does not satisfy the compression condition, the transmitting end does not perform a compression operation of compressing the data to be transmitted.
- the compression operation is performed only when the data to be transmitted satisfies the compression condition, and the transmission end does not know that the data to be transmitted cannot be compressed when the data to be transmitted is unsuccessful in the process of compressing the data to be transmitted, and the compression is improved.
- the success rate of transmitting data is performed only when the data to be transmitted satisfies the compression condition, and the transmission end does not know that the data to be transmitted cannot be compressed when the data to be transmitted is unsuccessful in the process of compressing the data to be transmitted, and the compression is improved.
- the third embodiment of the data transmission method differs from the second embodiment of the data transmission method in that, referring to FIG. 3, the data transmission method further includes:
- Step S50 If the data to be transmitted does not meet the compression condition, output prompt information to prompt the user that the data to be transmitted does not satisfy the compression condition according to the prompt information.
- the sending end After the transmitting end determines that the data to be transmitted does not satisfy the compression condition, the sending end outputs a prompt message in its display screen to prompt the user that the data to be transmitted does not satisfy the compression condition according to the prompt information.
- the prompt information may be output in the form of text or voice.
- the output form of the prompt information is not limited.
- the sender can prompt the user with a text message that “data does not satisfy the compression condition” in its display.
- the sending end may carry information indicating whether the user sends the data to be transmitted in the prompt information.
- the sending end After the sending end receives the confirmation instruction that the user confirms that the data to be transmitted is sent, the sending end directly sends the acquired data to be transmitted to the receiving end, that is, the data to be transmitted that has not been compressed and encrypted is sent to the receiving end; After receiving the acknowledgment command from the user that the user does not send the data to be transmitted to the receiving end, the transmitting end does not send the data to be transmitted to the receiving end.
- the sending end after determining that the data to be transmitted does not satisfy the compression condition, the sending end outputs the prompting information, and prompts the user that the data to be transmitted does not satisfy the compression condition according to the prompting information, so that the user can know in time that the data to be transmitted does not satisfy the compression condition.
- the present application further provides a data transmission apparatus, where the data transmission apparatus includes:
- the assignment module 10 is configured to perform initial value assignment on the data to be transmitted after obtaining the data to be transmitted, and obtain the data to be transmitted after the assignment;
- the processing module 20 is configured to perform compression and encryption processing on the data to be transmitted after the assignment, to obtain the processed data to be transmitted;
- the sending module 30 is configured to send the processed data to be transmitted to the receiving end, so that the receiving end parses the processed data to be transmitted after receiving the processed data to be transmitted, and obtains The data to be transmitted.
- the processing module 20 performs encryption processing and compression processing on the data to be transmitted to obtain compressed and encrypted data
- the transmitting module 30 transmits the compressed and encrypted data to the data.
- the receiving end performs double security processing of compressing and encrypting data to be transmitted between the transmitting end and the receiving end, improves the security of data transmitted between the transmitting end and the receiving end, and protects the transmission between the transmitting end and the receiving end. The data is not stolen by illegal elements.
- the data transmission device further includes:
- a detecting module configured to detect whether the data to be transmitted meets a compression condition
- the processing module 20 is further configured to: after the data to be transmitted meets the compression condition, compress and encrypt the assigned data to be transmitted to obtain the processed data to be transmitted.
- the detecting module includes:
- a first conversion unit configured to convert a byte array corresponding to the data to be transmitted into a target byte array according to a left shift or a right shift algorithm in a bit operation
- An assignment unit configured to assign the target byte array to an output data member variable of the preset object
- a verification unit configured to check whether data in the preset object meets a preset condition
- a first determining unit configured to determine that the data to be transmitted meets the compression condition if the output data member variable satisfies a preset condition; and if the output data member variable does not satisfy the preset condition, determine It is stated that the transmission data does not satisfy the compression condition.
- the data transmission device further includes:
- an output module configured to: if the data to be transmitted does not meet the compression condition, output prompt information, to prompt the user that the data to be transmitted does not satisfy the compression condition according to the prompt information.
- processing module 20 includes:
- a first acquiring unit configured to acquire initial data corresponding to the to-be-transmitted data after the assignment
- a processing unit configured to establish a target array according to the length value corresponding to the start data; perform a for loop according to the start data, to assign values of the assigned byte array corresponding to the data to be transferred one by one And the compressed target data to be transmitted is obtained in the target array;
- the encryption unit is configured to encrypt the compressed data to be transmitted by using a preset encryption algorithm to obtain the processed data to be transmitted.
- the encryption unit includes:
- a conversion subunit configured to convert the compressed data to be transmitted into a string corresponding to a preset hexadecimal, and obtain a pre-stored key
- an encryption subunit configured to encrypt the character string by using a preset encryption algorithm according to the key, to obtain the processed data to be transmitted.
- evaluation module 10 includes:
- a second converting unit configured to convert the data type of the data to be transmitted into a byte array after acquiring the data to be transmitted;
- a second obtaining unit configured to acquire a length of the byte array
- a second determining unit configured to determine, according to a byte length of the byte array, a target length corresponding to the byte array according to a preset rule
- a defining unit configured to define the target length as a byte length of the byte array to obtain the data to be transmitted after the assignment.
- each embodiment of the data transmission device is substantially the same as the foregoing embodiments of the data transmission method, and details are not described herein again.
- FIG. 5 is a schematic structural diagram of a hardware operating environment involved in an embodiment of the present application.
- FIG. 5 can be a schematic structural diagram of a hardware operating environment of the data transmission device.
- the data transmission device of the embodiment of the present application may be a terminal device such as a PC or a portable computer.
- the data transmission device may include a processor 1001, such as a CPU, a network interface 1004, a memory 1005, a user interface 1003, and a communication bus 1002.
- the communication bus 1002 is used to implement connection communication between these components.
- the user interface 1003 can include a display, an input unit such as a keyboard, and the optional user interface 1003 can also include a standard wired interface, a wireless interface.
- the network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface).
- the memory 1005 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage.
- the memory 1005 can also optionally be a storage device independent of the aforementioned processor 1001.
- the data transmission device may further include a camera, RF (Radio) Frequency, RF) circuits, sensors, audio circuits, WiFi modules, and more.
- RF Radio
- RF Radio Frequency
- FIG. 5 does not constitute a limitation of the data transmission device, and may include more or less components than those illustrated, or combine some components or different components. Arrangement.
- an operating system As shown in FIG. 5, an operating system, a network communication module, a user interface module, and a data transmission program may be included in the memory 1005 as a computer storage medium.
- the operating system is a program that manages and controls the hardware and software resources of the data transmission device, and supports the operation of the data transmission program and other software or programs.
- the user interface 1003 is mainly used to acquire data to be transmitted, and output prompt information, etc.
- the network interface 1004 is mainly used to connect to the receiving end and perform data communication with the receiving end; the processor 1001 can use
- the data transfer program stored in the memory 1005 is called and the steps of the data transfer method as described above are performed.
- the embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a data transmission program, and the data transmission program is executed by the processor to implement the steps of the data transmission method as described above. .
- the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
- Implementation Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
- the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本申请公开了一种数据传输方法、装置、设备及计算机可读存储介质,该方法包括步骤:当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。本申请通过对发送端和接收端之间需要传输的数据进行压缩加密的双重安全处理,提高了发送端和接收端之间所传输数据的安全性,保护发送端和接收端之间所传输的数据不为非法分子所窃取。
Description
本申请要求于2018年5月10日提交中国专利局、申请号为201810446354.7、发明名称为“数据传输方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种数据传输方法、装置、设备及计算机可读存储介质。
背景技术
在即时网络通信过程中,发送端和接收端所传输的数据会被非法分子恶意截取,导致发送端和接收端的损失。为了避免所传输的数据被非法分子截取,发送端会将需要发送的数据进行加密处理,将数据加密后再传输给接收端。但是由于所使用的加密算法较为简单,非法分子容易破解加密后的数据,从而导致发送端和接收端所传输的数据还是容易被非法分子破解,导致发送端和接收端之间所传输的数据安全性低。
发明内容
本申请的主要目的在于提供一种数据传输方法、装置、设备及计算机可读存储介质,旨在解决现有的发送端和接收端之间所传输的数据安全性低的技术问题。
为实现上述目的,本申请提供一种数据传输方法,所述数据传输方法包括步骤:
当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;
对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;
将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
优选地,所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤之前,还包括:
检测所述待传输数据是否满足压缩条件;
若所述待传输数据满足所述压缩条件,则执行所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤。
优选地,所述检测所述待传输数据是否满足压缩条件的步骤包括:
将所述待传输数据对应的字节数组按照位运算中的左移或者右移算法转换成目标字节数组;
将所述目标字节数组赋值到预置对象的输出数据成员变量中,并检验所述预置对象中的数据是否满足预设条件;
若所述输出数据成员变量满足预设条件,则确定所述待传输数据满足所述压缩条件;
若所述输出数据成员变量未满足所述预设条件,则确定所述待传输数据未满足所述压缩条件。
优选地,所述检测所述待传输数据是否满足压缩条件的步骤之后,还包括:
若所述待传输数据未满足所述压缩条件,则输出提示信息,以根据所述提示信息提示用户所述待传输数据未满足所述压缩条件。
优选地,所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤包括:
获取赋值后的所述待传输数据对应的起始数据;
根据所述起始数据对应的长度值,建立一个目标数组;
根据所述起始数据进行for循环,以将赋值后的所述待传输数据对应字节数组中的值逐一赋值待所述目标数组中,得到压缩后的所述待传输数据;
采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据。
优选地,所述采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据的步骤包括:
将压缩后的所述待传输数据转换成预设进制对应的字符串,并获取预存的密钥;
根据所述密钥,通过预设的加密算法对所述字符串进行加密,得到处理后的所述待传输数据。
优选地,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:
当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;
根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;
将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
此外,为实现上述目的,本申请还提供一种数据传输装置,所述数据传输装置包括:
赋值模块,用于当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;
处理模块,用于对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;
发送模块,用于将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
此外,为实现上述目的,本申请还提供一种数据传输设备,所述数据传输设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的数据传输程序,所述数据传输程序被所述处理器执行时实现如上所述的数据传输方法的步骤。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据传输程序,所述数据传输程序被处理器执行时实现如上所述的数据传输方法的步骤。
本申请通过发送端对需要传输的数据赋值后,对需要传输的数据进行加密处理以及压缩处理,得到压缩加密后的数据,将压缩加密后的数据传输给接收端,对发送端和接收端之间需要传输的数据进行压缩加密的双重安全处理,提高了发送端和接收端之间所传输数据的安全性,保护发送端和接收端之间所传输的数据不为非法分子所窃取。
附图说明
图1为本申请数据传输方法第一实施例的流程示意图;
图2为本申请数据传输方法第二实施例的流程示意图;
图3为本申请数据传输方法第三实施例的流程示意图;
图4为本申请数据传输装置较佳实施例的功能示意图模块图;
图5是本申请实施例方案涉及的硬件运行环境的结构示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供一种数据传输方法,参照图1,图1为本申请数据传输方法第一实施例的流程示意图。
本申请实施例提供了数据传输方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
数据传输方法可应用于发送端中,发送端可以包括诸如手机、平板电脑、笔记本电脑、掌上电脑、个人数字助理(Personal Digital
Assistant,PDA)、便捷式媒体播放器(Portable Media
Player,PMP)、导航装置、可穿戴设备、智能手环、计步器等移动终端,以及诸如数字TV、台式计算机等固定终端。
数据传输方法包括:
步骤S10,当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据。
当发送端获取到待传输数据后,发送端对待传输数据进行初始化操作,对待传输数据进行赋值,以得到赋值后的待传输数据。其中,预先定义好的JZlib的Zstream对象,待传输数据对应字节数组的信息可存储在Zstream对象的成员变量中。该待传输数据可为发送端需要与接收端进行数据传输过程中,用户手动输入的;或者是预先存储在发送端的数据库中,当发送端需要与接收端进行数据交互时,发送端从其数据库中获取的。JZlib是Zlib的Java版本,Zlib是提供数据压缩用的函式库。在定义JZlib的Zstream对象过程中,可在Java语法中使用new关键字调用一个Java类的构造方法定义该类的一个实例化对象,即定义JZlib的Zstream对象。
在Zstream对象中,设置了几个成员变量用于存储对应的字节数组的信息。Zstream对象中的成员变量分别为:①next_in:存储in
Bytes(输入数据)的内容; ②next_in_index:记录in Bytes的起始下标;③avail_in:记录in
Bytes的长度;④next_out:存储out Bytes的内容;⑤next_out_index:记录out
Bytes(输出数据)的起始下标;⑥avail_out:记录out
Bytes的长度。需要说明的是,通过next_in_index和next_out_index对应可以知道输入数据和输出数据中其内容的起始位。如某个输入数据的起始位为3时,表明在输入数据的字符串中,从第3位开始才是该输入数据的真实内容。
进一步地,步骤S10包括:
步骤a,当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度。
进一步地,当发送端获取到待传输数据后,发送端将待传输数据的数据类型转换成字节数组,获取该字节数组的字节长度。在本实施例中,用byte[]
in Bytes表示字节数组。可以理解的是,待传输数据对应的字节数组即为Zstream对象的输入数据in Bytes。
步骤b,根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度。
当发送端获取到字节数组的字节长度后,发送端按照预设规则确定与该字节数组对应的目标长度。具体地,发送端将字节数组的字节长度进行四舍五入的处理,得到处理后的字节长度,并在处理后的字节长度中加13,得到与该字节数组对应的目标长度。其中,13可根据具体需要设置为其它质数,在本实施例中对该过程中的质数不做具体限制。
步骤c,将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
当发送端得到字节数组对应的目标长度后,将该目标长度定义为字节数组的字节长度,以得到赋值后的待传输数据。需要说明的是,赋值后的待传输数据为更改字节长度后的待传输数据。在Zstream对象中,赋值后的待传输数据即为输出数据out
Bytes。
步骤S20,对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据。
当发送端得到赋值后的待传输数据后,对赋值后的待传输数据进行压缩以及加密处理,得到处理后的待传输数据。
进一步地,步骤S20包括:
步骤d,获取赋值后的所述待传输数据对应的起始数据。
进一步地,发送端获取赋值后的待传输数据对应的起始数据。具体地,发送端从Zstream对象中取出输出数据的下标位next_out_index,以得到赋值后的待传输数据对应的起始数据,即输出数据的起始下标为待传输数据对应的起始数据。
步骤e,根据所述起始数据对应的长度值,建立一个目标数组,根据所述起始数据进行for循环,以将赋值后的所述待传输数据对应字节数组中的值逐一赋值待所述目标数组中,得到压缩后的所述待传输数据。
当发送端得到赋值后的待传输数据对应的起始数据后,将该起始数据作为长度值,建立一个目标数组byte[]
return Bytes,作为最后的返回值,并根据起始数据进行for循环,将赋值后的待传输数据对应字节数组中的值逐一赋值到return
Bytes中,即return Bytes[i]=out Bytes[i],得到压缩后的待传输数据。
步骤f,采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据。
当发送端得到压缩后的待传输数据后,发送端采用预设的加密算法,对压缩后的待传输数据进行加密,得到加密后的待传输数据,即得到处理后的待传输数据。预设的加密算法包括但不限于3DES,DES(Data
Encryption Algorithm,数据加密标准)、SHA(Secure Hash Algorithm,安全散列算法)、AES(Advanced
Encryption Standard,高级加密标准)、ECC(Elliptic Curves
Cipher,椭圆曲线密码)和MD5(Message-Digest Algorithm
5,信息-摘要算法5)等。其中,3DES是三重数据加密算法(TDEA,Triple Data Encryption
Algorithm)块密码的通称,又称Triple
DES。在本实施例中,优先采用3DES加密算法,3DES算法采用3个不同密钥对同一个分组数据块进行3次加密,以提高加密后数据的强度。
进一步地,步骤f包括:
步骤f1,将压缩后的所述待传输数据转换成预设进制对应的字符串,并获取预存的密钥。
当发送端得到压缩后的待传输数据后,发送端将压缩后的待传输数据转换预设进制对应的字符串,并获取预存的密钥。在本实施例中,根据预设加密算法来确定密钥的种类。当预设加密算法为对称加密算法时,对应的密钥为对称密钥;当预设加密算法为非对称加密算法时,对应的密钥为非对称密钥。在本实施例中,发送端可通过使用Java中org.apache.commons.codec.binary.Hex类的encode
Hex
String方法将压缩后的待传输数据转换成16进制的字符串。需要说明的是,由于一个16进制字符占用4bit(比特),一个byte占用8bit(字节),Java中一个String字符是16bit,因此使用16进制字符串可节省发送端内存空间,另外一个方面16进制字符串使用0-9,a-f表示的,不会存在发送端编码与源程序编码格式不一致导致编码无法识别,而出现乱码的情况。
可以理解的是,在其它实施例中,发送端也可将压缩后的待传输数据转换成8进制,或者其它进制对应的字符串。
步骤f2,根据所述密钥,通过预设的加密算法对所述字符串进行加密,得到处理后的所述待传输数据。
当发送端获取待密钥后,根据该密钥,通过预设的加密算法对应该字符串进行加密,以得到处理后的待传输数据。在本实施例中,加密算法用到JDK中javax.crypto包下面的Cipher类,声明出来的Cipher对象将压缩后的待传输数据进行加密并返回对应的字节数据,从而得到处理后的待传输数据。其中,JDK是
Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序,Cipher类为加密和解密提供密码功能。
步骤S30,将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
当发送端得到处理后的待传输数据后,将处理后的待传输数据发送给接收端。当接收端接收到处理后的待传输数据后,解析处理后的待传输数据,得到未经加密以及未经压缩处理的待传输数据,即得到原始的待传输数据。
接收端解析处理后的待传输数据的过程为:接收端获取解密所需的密钥,并获取Cipher对象,通过该Cipher对象和密钥解密处理后的待传输数据,得到与处理后的待传输数据对应的字节数据,并将该字节数据转换成字符串。需要说明的是,该字符串即为压缩后的待传输数据。在Cipher对象中,包括了加密算法的名称、分组加密的模式以及最后一个分组的填充方法的消息。因此,通过Cipher对象和密钥即可解密处理后的待传输数据,得到压缩后的待传输数据。可以理解的是,当发送端采用的加密算法为对称加密算法时,发送端加密所用密钥与接收端解密所用密钥是相同的;当发送端采用的加密算法为非对称加密算法时,若发送端采用私钥进行加密,接收端则采用对应的公钥进行解密;若发送端采用公钥进行加密,接收端则采用对应的私钥进行解密。
当接收端得到压缩后的待传输数据后,接收端获取JZlib的ZStream对象,根据压缩后的待传输数据对ZStream对象进行初始化,然后定义一个Byte的List对象,通过for循环解压缩压缩后的待传输数据,得到对应的字节数据,并将所得的字节数据存储至该List对象中,将List对象中的字节数据赋值到字节数组中,以得到解压后的待传输数据,即得到原始的待传输数据。接收端根据压缩后的待传输数据对ZStream对象进行初始化的具体过程为:将压缩后的待传输数据转为字节数组byte[]
in Bytes,根据in Bytes的长度四舍五入后,再加13得到输出数据out Bytes的字节数组长度out Length,然后定义长度为out
Length的字节数组out Bytes。
需要说明的是,List对象中存储的元素是byte字节,接收端在解压缩的过程中会得到ZStream对象中的out
Bytes字节数组,然后以ZStream.next_out_index为长度进行for循环遍历操作,将out
Bytes字节数组中的字节逐一添加到list对象中,循环结束添加完毕后,此时list对象中的数据是已解密解压缩后的明文数据的字符,最后需要新建一个长度为list.size()的字节数组byte[],将list对象中的byte数据逐一赋值到新建的字节数组中,最后用new
String(byte[])获取完整的明文字符串。
本实施例通过发送端对需要传输的数据赋值后,对需要传输的数据进行加密处理以及压缩处理,得到压缩加密后的数据,将压缩加密后的数据传输给接收端,对发送端和接收端之间需要传输的数据进行压缩加密的双重安全处理,提高了发送端和接收端之间所传输数据的安全性,保护发送端和接收端之间所传输的数据不为非法分子所窃取。
进一步地,提出本申请数据传输方法第二实施例。
所述数据传输方法第二实施例与所述数据传输方法第一实施例的区别在于,参照图2,数据传输方法还包括:
步骤S40,检测所述待传输数据是否满足压缩条件。
当发送端获取到待传输数据后,发送端检测待传输数据是否满足压缩条件。
进一步地,步骤S40:
步骤g,将所述待传输数据对应的字节数组按照位运算中的左移或者右移算法转换成目标字节数组。
当发送端获取到待传输数据后,发送端调用一个DEFLATE方法,将ZStream对象作为DEFLATE方法的输入参数,将字节数组in
Bytes按照位运算中的左移算法或者右移算法生成一个新的字节数组,即将待传输数据对应的字节数组按照位运算中的左移算法或者右移算法转换成目标字节数组。其中,左移或者右移对应的位数可根据具体需要而设置,在本实施例中不做具体限制。DEFLATE是同时使用了LZ77算法与哈夫曼编码(Huffman
Coding)的一个无损数据压缩算法。LZ77编码是一种基于字典的、“滑动窗”的无损压缩算法。可以理解的是,在本实施例中,发送端也可调用其它压缩算法,将ZStream对象作为其它压缩算法的输入参数。
步骤h,将所述目标字节数组赋值到预置对象的输出数据成员变量中,并检验所述预置对象中的数据是否满足预设条件。
当发送端得到目标字节数组后,发送端将目标字节数组填充到ZStream对象的next_out成员变量中,即将目标字节数组赋值到预置对象的输出数据成员变量中,对next_out的内容和长度进行校验,并根据校验结果返回一个int类型的值,根据该int类型的值确定ZStream对象中的数据是否满足预设条件。在本实施例中,预置对象为ZStream对象。其中,next_out成员变量中所存储的是赋值后的待传输数据。当检测到赋值后的待传输数据的内容与初始化之前,即原始的待传输数据内容一致,且赋值后的待传输数据的长度与原始的待传输数据对应关系正确时,发送端则得到待传输数据满足预设条件校验结果,即确定预置对象中的输出数据成员变量满足预设条件;若检测到赋值后的待传输数据的内容与原始的待传输数据内容不一致,和/或赋值后的待传输数据的长度与原始的待传输数据对应关系错误,发送端则得到待传输数据未满足预设条件校验结果,即确定预置对象中的输出数据成员变量未满足预设条件。
可以理解的是,赋值后的待传输数据的长度是由原始待传输数据的长度经过预设规则所确定的,因此,赋值后的待传输数据的长度和原始待传输数据的长度是存在一定的对应关系的。
步骤i,若所述输出数据成员变量满足预设条件,则确定所述待传输数据满足所述压缩条件。
若发送端确定预置对象中的输出数据成员变量满足预设条件,发送端则确定待传输数据满足压缩条件,可以对该待传输数据进行压缩处理。具体地,发送端可根据int类型的值来确定预置对象中的数据是否满足预设条件。如当发送端确定预置对象中的数据满足预设条件,会返回一个int类型的值,如返回“0”,并将该值显示在其显示屏中,以提示用户待传输数据满足压缩条件。此时,用户可根据发送端显示屏中的“0”确定待传输数据满足压缩条件。
步骤j,若所述输出数据成员变量未满足所述预设条件,则确定所述待传输数据未满足所述压缩条件。
若发送端确定预置对象中的输出数据成员变量未满足预设条件,发送端则确定待传输数据未满足压缩条件,不可以对该待传输数据进行压缩处理。具体地,发送端可根据int类型的值来确定预置对象中的数据是否满足预设条件。如当发送端确定预置对象中的数据满足预设条件,会返回一个int类型的值,如返回“1”,并将该值显示在其显示屏中,用户可根据发送端显示屏中的“1”确定待传输数据未满足压缩条件。
若所述待传输数据满足所述压缩条件,则执行步骤S20。
若发送端确定待传输数据满足压缩条件,发送端则对赋值后的待传输数据进行压缩以及加密处理,得到处理后的待传输数据。
进一步地,若发送端确定待传输数据未满足压缩条件,发送端则不执行压缩待传输数据的压缩操作。
本实施例通过在对待传输数据进行压缩处理之前,检测待传输数据是否满足压缩条件。只有当待传输数据满足压缩条件时,才执行压缩操作,避免了在压缩待传输数据过程中,压缩待传输数据不成功时,发送端才知道待传输数据不可以进行压缩处理,提高了压缩待传输数据的成功率。
进一步地,提出本申请数据传输方法第三实施例。
所述数据传输方法第三实施例与所述数据传输方法第二实施例的区别在于,参照图3,数据传输方法还包括:
步骤S50,若所述待传输数据未满足所述压缩条件,则输出提示信息,以根据所述提示信息提示用户所述待传输数据未满足所述压缩条件。
当发送端确定待传输数据未满足压缩条件后,发送端在其显示屏中输出提示信息,以根据该提示信息提示用户待传输数据未满足压缩条件。其中,提示信息可以以文字或者语音等形式输出,在本实施例中对提示信息的输出形式不做限制。如发送端可在其显示屏中输出“数据不满足压缩条件”的文字信息提示用户。
进一步地,当发送端在输出提示信息提示用户待传输数据未满足压缩条件时,发送端可在提示信息中携带提示用户是否发送该待传输数据的信息。当发送端接收到用户确认发送待传输数据的确认指令后,发送端直接将所获取的待传输数据发送给接收端,即将未经压缩处理和加密处理的待传输数据发送给接收端;当发送端接收到用户确认不发送待传输数据给接收端的确认指令后,发送端不将待传输数据发送给接收端。
本实施例通过当确定待传输数据未满足压缩条件后,发送端输出提示信息,根据该提示信息提示用户待传输数据未满足压缩条件,以供用户可以及时知道待传输数据未满足压缩条件。
此外,参照图4,本申请还提供一种数据传输装置,所述数据传输装置包括:
赋值模块10,用于当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;
处理模块20,用于对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;
发送模块30,用于将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
本实施例通过发送端的赋值模块10对需要传输的数据赋值后,处理模块20对需要传输的数据进行加密处理以及压缩处理,得到压缩加密后的数据,发送模块30将压缩加密后的数据传输给接收端,对发送端和接收端之间需要传输的数据进行压缩加密的双重安全处理,提高了发送端和接收端之间所传输数据的安全性,保护发送端和接收端之间所传输的数据不为非法分子所窃取。
进一步地,所述数据传输装置还包括:
检测模块,用于检测所述待传输数据是否满足压缩条件;
所述处理模块20还用于若所述待传输数据满足所述压缩条件,则对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据。
进一步地,所述检测模块包括:
第一转换单元,用于将所述待传输数据对应的字节数组按照位运算中的左移或者右移算法转换成目标字节数组;
赋值单元,用于将所述目标字节数组赋值到预置对象的输出数据成员变量中;
检验单元,用于检验所述预置对象中的数据是否满足预设条件;
第一确定单元,用于若所述输出数据成员变量满足预设条件,则确定所述待传输数据满足所述压缩条件;若所述输出数据成员变量未满足所述预设条件,则确定所述待传输数据未满足所述压缩条件。
进一步地,所述数据传输装置还包括:
输出模块,用于若所述待传输数据未满足所述压缩条件,则输出提示信息,以根据所述提示信息提示用户所述待传输数据未满足所述压缩条件。
进一步地,所述处理模块20包括:
第一获取单元,用于获取赋值后的所述待传输数据对应的起始数据;
处理单元,用于根据所述起始数据对应的长度值,建立一个目标数组;根据所述起始数据进行for循环,以将赋值后的所述待传输数据对应字节数组中的值逐一赋值待所述目标数组中,得到压缩后的所述待传输数据;
加密单元,用于采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据。
进一步地,所述加密单元包括:
转换子单元,用于将压缩后的所述待传输数据转换成预设进制对应的字符串,并获取预存的密钥;
加密子单元,用于根据所述密钥,通过预设的加密算法对所述字符串进行加密,得到处理后的所述待传输数据。
进一步地,所述赋值模块10包括:
第二转换单元,用于当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组;
第二获取单元,用于获取所述字节数组的长度;
第二确定单元,用于根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;
定义单元,用于将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
需要说明的是,数据传输装置的各个实施例与上述数据传输方法的各实施例基本相同,在此不再详细赘述。
此外,本申请还提供一种数据传输设备。如图5所示,图5是本申请实施例方案涉及的硬件运行环境的结构示意图。
需要说明的是,图5即可为数据传输设备的硬件运行环境的结构示意图。本申请实施例数据传输设备可以是PC,便携计算机等终端设备。
如图5所示,该数据传输设备可以包括:处理器1001,例如CPU,网络接口1004,存储器1005,用户接口1003,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile
memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
可选地,数据传输设备还可以包括摄像头、RF(Radio
Frequency,射频)电路,传感器、音频电路、WiFi模块等等。
本领域技术人员可以理解,图5中示出的数据传输设备结构并不构成对数据传输设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图5所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及数据传输程序。其中,操作系统是管理和控制数据传输设备硬件和软件资源的程序,支持数据传输程序以及其它软件或程序的运行。
在图5所示的数据传输设备中,用户接口1003主要用于获取待传输数据,以及输出提示信息等,网络接口1004主要用于连接接收端,与接收端进行数据通信;处理器1001可以用于调用存储器1005中存储的数据传输程序,并执行如上所述的数据传输方法的步骤。
本申请数据传输设备具体实施方式与上述数据传输方法各实施例基本相同,在此不再赘述。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有数据传输程序,所述数据传输程序被处理器执行时实现如上所述的数据传输方法的步骤。
本申请计算机可读存储介质具体实施方式与上述数据传输方法各实施例基本相同,在此不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (20)
- 一种数据传输方法,其特征在于,所述数据传输方法包括以下步骤:当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
- 如权利要求1所述的数据传输方法,其特征在于,所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤之前,还包括:检测所述待传输数据是否满足压缩条件;若所述待传输数据满足所述压缩条件,则执行所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤。
- 如权利要求2所述的数据传输方法,其特征在于,所述检测所述待传输数据是否满足压缩条件的步骤包括:将所述待传输数据对应的字节数组按照位运算中的左移或者右移算法转换成目标字节数组;将所述目标字节数组赋值到预置对象的输出数据成员变量中,并检验所述预置对象中的数据是否满足预设条件;若所述输出数据成员变量满足预设条件,则确定所述待传输数据满足所述压缩条件;若所述输出数据成员变量未满足所述预设条件,则确定所述待传输数据未满足所述压缩条件。
- 如权利要求2所述的数据传输方法,其特征在于,所述检测所述待传输数据是否满足压缩条件的步骤之后,还包括:若所述待传输数据未满足所述压缩条件,则输出提示信息,以根据所述提示信息提示用户所述待传输数据未满足所述压缩条件。
- 如权利要求1所述的数据传输方法,其特征在于,所述对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据的步骤包括:获取赋值后的所述待传输数据对应的起始数据;根据所述起始数据对应的长度值,建立一个目标数组;根据所述起始数据进行for循环,以将赋值后的所述待传输数据对应字节数组中的值逐一赋值待所述目标数组中,得到压缩后的所述待传输数据;采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据。
- 如权利要求5所述的数据传输方法,其特征在于,所述采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据的步骤包括:将压缩后的所述待传输数据转换成预设进制对应的字符串,并获取预存的密钥;根据所述密钥,通过预设的加密算法对所述字符串进行加密,得到处理后的所述待传输数据。
- 如权利要求1所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 如权利要求2所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 如权利要求3所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 如权利要求4所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 如权利要求5所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 如权利要求6所述的数据传输方法,其特征在于,所述当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据的步骤包括:当获取到待传输数据后,将所述待传输数据的数据类型转换成字节数组,并获取所述字节数组的长度;根据所述字节数组的字节长度,按照预设规则确定与所述字节数组对应的目标长度;将所述目标长度定义为所述字节数组的字节长度,以得到赋值后的所述待传输数据。
- 一种数据传输装置,其特征在于,所述数据传输装置包括:赋值模块,用于当获取到待传输数据后,对所述待传输数据进行初始化赋值,得到赋值后的所述待传输数据;处理模块,用于对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据;发送模块,用于将处理后的所述待传输数据发送给接收端,以供所述接收端在接收到处理后的所述待传输数据后,解析处理后的所述待传输数据,得到所述待传输数据。
- 如权利要求13所述的数据传输装置,其特征在于,所述数据传输装置还包括:检测模块,用于检测所述待传输数据是否满足压缩条件;处理模块还用于若所述待传输数据满足所述压缩条件,则对赋值后的所述待传输数据进行压缩以及加密处理,得到处理后的所述待传输数据。
- 如权利要求14所述的数据传输装置,其特征在于,所述检测模块包括:第一转换单元,用于将所述待传输数据对应的字节数组按照位运算中的左移或者右移算法转换成目标字节数组;赋值单元,用于将所述目标字节数组赋值到预置对象的输出数据成员变量中;检验单元,用于检验所述预置对象中的数据是否满足预设条件;第一确定单元,用于若所述输出数据成员变量满足预设条件,则确定所述待传输数据满足所述压缩条件;若所述输出数据成员变量未满足所述预设条件,则确定所述待传输数据未满足所述压缩条件。
- 如权利要求14所述的数据传输装置,其特征在于,所述数据传输装置还包括:输出模块,用于若所述待传输数据未满足所述压缩条件,则输出提示信息,以根据所述提示信息提示用户所述待传输数据未满足所述压缩条件。
- 如权利要求13所述的数据传输装置,其特征在于,所述处理模块包括:第一获取单元,用于获取赋值后的所述待传输数据对应的起始数据;处理单元,用于根据所述起始数据对应的长度值,建立一个目标数组;根据所述起始数据进行for循环,以将赋值后的所述待传输数据对应字节数组中的值逐一赋值待所述目标数组中,得到压缩后的所述待传输数据;加密单元,用于采用预设的加密算法,对压缩后的所述待传输数据进行加密,得到处理后的所述待传输数据。
- 如权利要求17所述的数据传输装置,其特征在于,所述加密单元包括:转换子单元,用于将压缩后的所述待传输数据转换成预设进制对应的字符串,并获取预存的密钥;加密子单元,用于根据所述密钥,通过预设的加密算法对所述字符串进行加密,得到处理后的所述待传输数据。
- 一种数据传输设备,其特征在于,所述数据传输设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的数据传输程序,所述已接入数据传输程序被所述处理器执行时实现如权利要求1所述的数据传输方法的步骤。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数据传输程序,所述已接入数据传输程序被处理器执行时实现如权利要求1所述的数据传输方法的步骤。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810446354.7A CN108650264B (zh) | 2018-05-10 | 2018-05-10 | 数据传输方法、装置、设备及计算机可读存储介质 |
| CN201810446354.7 | 2018-05-10 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019214028A1 true WO2019214028A1 (zh) | 2019-11-14 |
Family
ID=63754487
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/093729 Ceased WO2019214028A1 (zh) | 2018-05-10 | 2018-06-29 | 数据传输方法、装置、设备及计算机可读存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN108650264B (zh) |
| WO (1) | WO2019214028A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117041358A (zh) * | 2023-08-11 | 2023-11-10 | 中电信智能网络科技有限公司 | 数据传输开销的优化方法、系统、存储介质及电子设备 |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113360923B (zh) * | 2021-06-03 | 2024-12-06 | 北京融数联智科技有限公司 | 一种数据交互方法、装置、系统及电子设备 |
| CN114721982B (zh) * | 2022-03-22 | 2024-06-18 | 潍柴动力股份有限公司 | 一种可配置存储数据类型的读写处理方法及系统 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170338902A1 (en) * | 2016-05-17 | 2017-11-23 | SpectraRep, LLC | Method and system for datacasting and content management |
| CN107426046A (zh) * | 2016-05-24 | 2017-12-01 | 深圳市信锐网科技术有限公司 | 用户上网数据采集分析方法及系统 |
| CN107786331A (zh) * | 2017-09-28 | 2018-03-09 | 平安普惠企业管理有限公司 | 数据处理方法、装置、系统及计算机可读存储介质 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5473691A (en) * | 1993-11-05 | 1995-12-05 | Microsoft Corporation | System and method for computer data transmission |
| CN1913531B (zh) * | 2006-08-25 | 2012-03-21 | 华为技术有限公司 | 一种tcp/ip包头的传输方法、压缩方法和装置 |
| CN101345902A (zh) * | 2007-07-13 | 2009-01-14 | 上海东登视讯科技有限公司 | 手机多媒体视频短信的群发方法 |
| US9244779B2 (en) * | 2010-09-30 | 2016-01-26 | Commvault Systems, Inc. | Data recovery operations, such as recovery from modified network data management protocol data |
-
2018
- 2018-05-10 CN CN201810446354.7A patent/CN108650264B/zh active Active
- 2018-06-29 WO PCT/CN2018/093729 patent/WO2019214028A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170338902A1 (en) * | 2016-05-17 | 2017-11-23 | SpectraRep, LLC | Method and system for datacasting and content management |
| CN107426046A (zh) * | 2016-05-24 | 2017-12-01 | 深圳市信锐网科技术有限公司 | 用户上网数据采集分析方法及系统 |
| CN107786331A (zh) * | 2017-09-28 | 2018-03-09 | 平安普惠企业管理有限公司 | 数据处理方法、装置、系统及计算机可读存储介质 |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117041358A (zh) * | 2023-08-11 | 2023-11-10 | 中电信智能网络科技有限公司 | 数据传输开销的优化方法、系统、存储介质及电子设备 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN108650264A (zh) | 2018-10-12 |
| CN108650264B (zh) | 2020-12-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2019196213A1 (zh) | 接口测试方法、装置、设备及计算机可读存储介质 | |
| WO2019001110A1 (zh) | 权限认证方法、系统、设备及计算机可读存储介质 | |
| WO2019205280A1 (zh) | 服务器的测试方法、装置、设备及计算机可读存储介质 | |
| WO2019100531A1 (zh) | 数字签名生成、验证方法及其设备和存储介质 | |
| WO2019037395A1 (zh) | 密钥管理方法、装置及可读存储介质 | |
| WO2019019374A1 (zh) | 智能语音设备控制家电的方法、装置及系统 | |
| WO2018058919A1 (zh) | 标识信息生成方法、装置、设备和计算机可读存储介质 | |
| WO2016178548A1 (ko) | 프로파일 제공 방법 및 장치 | |
| WO2020117015A1 (ko) | 다변수 패킹을 이용하는 연산 장치 및 방법 | |
| WO2020197221A1 (ko) | 통신 방법 및 통신 디바이스 | |
| WO2017035695A1 (zh) | 信息传输方法及移动设备 | |
| WO2018120457A1 (zh) | 数据处理方法、装置、设备及计算机可读存储介质 | |
| WO2015172684A1 (en) | Ap connection method, terminal, and server | |
| WO2019214028A1 (zh) | 数据传输方法、装置、设备及计算机可读存储介质 | |
| WO2018023924A1 (zh) | 电视播放控制方法及系统 | |
| WO2015061941A1 (zh) | 一种密钥配置方法和装置 | |
| WO2018223607A1 (zh) | 电视终端及hdr图像转为sdr的方法和计算机可读存储介质 | |
| WO2018120429A1 (zh) | 一种资源更新的方法、终端、计算机可读存储介质及资源更新设备 | |
| WO2019024336A1 (zh) | 数据查询方法、装置及计算机可读存储介质 | |
| WO2017054481A1 (zh) | 一种信息验证和处理方法、装置、以及信息处理系统 | |
| WO2016186241A1 (ko) | 데이터 암호화 장치 및 방법과 및 데이터 복호화 장치 및 방법 | |
| WO2019041851A1 (zh) | 家电售后咨询方法、电子设备和计算机可读存储介质 | |
| WO2015139594A1 (en) | Security verification method, apparatus, and system | |
| WO2019161599A1 (zh) | Im信息保护方法、装置、设备和计算机存储介质 | |
| WO2017071352A1 (zh) | 密码的推送方法、推送系统及终端设备 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18917929 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 23.03.2021.) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 18917929 Country of ref document: EP Kind code of ref document: A1 |