WO2018170963A1 - 一种文件的加密、解密方法和装置 - Google Patents
一种文件的加密、解密方法和装置 Download PDFInfo
- Publication number
- WO2018170963A1 WO2018170963A1 PCT/CN2017/080198 CN2017080198W WO2018170963A1 WO 2018170963 A1 WO2018170963 A1 WO 2018170963A1 CN 2017080198 W CN2017080198 W CN 2017080198W WO 2018170963 A1 WO2018170963 A1 WO 2018170963A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- encrypted
- data
- password
- file
- decrypted
- 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
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/065—Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0863—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6209—Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2107—File encryption
Definitions
- the present invention relates to the field of data security technologies, and in particular, to a file encryption and decryption method and apparatus.
- Data encryption also known as cryptography, refers to the conversion of plaintext into ciphertext through an encryption algorithm and an encryption key, while decryption restores the ciphertext to plaintext through a decryption algorithm and a decryption key.
- Data encryption is still the most reliable way for computer systems to protect information. It uses cryptography to encrypt information and achieve information concealment, thus protecting the security of information.
- the embodiments of the present invention provide a method and an apparatus for encrypting and decrypting files.
- the technical solution is as follows:
- a method of encrypting a file includes the following steps:
- Reading data to be encrypted in the file
- the encrypted password is calculated by substituting the initial password, the initial password length, and the encrypted data length into a preset function.
- the encrypted password calculated by the preset function is decentralized.
- the preset function is a hash function.
- the length of the encrypted password is the same as the length of the initial password.
- the step of generating an initial password includes: generating the initial password by using a random function.
- the initial password is an array.
- each byte of the data to be encrypted is encrypted.
- the encrypted data is obtained by performing a logical exclusive OR operation on the encrypted password and the data to be encrypted.
- the file is a streaming media.
- the segments are read in order.
- the method further includes the step of: saving the initial password.
- the present invention also provides a method for decrypting an encrypted file, including:
- the decryption password is calculated by substituting the initial password, the initial password length, and the encrypted data length into a preset function.
- the preset function is the same as the function used when the file is encrypted.
- the initial password is an initial password used when the file is encrypted.
- each byte of the data to be decrypted is decrypted.
- the decrypted data is obtained by performing a logical exclusive OR operation on the decrypted password and the data to be decrypted.
- the file is a streaming media.
- the manner of reading the data to be decrypted is the same as the manner of reading the data to be encrypted when the file is encrypted.
- the present invention provides a file encryption device, characterized in that include:
- An initial password generating unit configured to generate an initial password, and save the initial password to the storage unit;
- An encrypted data reading unit configured to read data to be encrypted in the file
- An encrypted password generating unit configured to acquire an encrypted data length in the file, and calculate an encrypted password based on the initial password and the encrypted data length;
- a data encryption unit that encrypts the data to be encrypted using the encrypted password to obtain encrypted data, and saves the encrypted data to the storage unit.
- the encrypted password generating unit calculates the encrypted password by substituting the initial password, the initial password length, and the encrypted data length into a preset function.
- the encrypted password calculated by the preset function is decentralized.
- the preset function is a hash function.
- the length of the encrypted password is the same as the length of the initial password.
- the initial password generating unit generates the initial password by using a random function.
- each byte of the data to be encrypted is encrypted.
- the data encryption unit obtains the encrypted data by performing an exclusive OR operation on the encrypted password and the data to be encrypted.
- the file is a streaming media.
- the encrypted data reading unit reads the data to be encrypted, it reads in stages.
- the present invention provides a decryption device for an encrypted file, characterized in that the decryption device comprises:
- the decryption password generating unit acquires an initial password from the storage unit, acquires a decrypted data length in the file, and calculates a decrypted password based on the initial password and the decrypted data length;
- Decrypting data reading unit configured to read data to be decrypted in the encrypted file
- the data decryption unit decrypts the data to be decrypted using the decryption password to obtain decrypted data.
- the decryption password generating unit calculates the decryption password by substituting the initial password, the initial password length, and the encrypted data length into a preset function.
- the preset function is the same as the function used when the file is encrypted.
- the initial password is an initial password used when the file is encrypted.
- the data decryption unit decrypts each byte of the data to be decrypted when the data to be decrypted is decrypted by using the decryption password.
- the data decryption unit performs a logical exclusive OR operation with the data to be decrypted by using the decryption password to obtain the decrypted data.
- the file is a streaming media.
- the manner in which the decryption reading unit reads the data to be decrypted is the same as the manner in which the data to be encrypted is read when the file is encrypted.
- introducing a random function, a preset function, and a data reading manner to generate an encrypted password greatly improves the difficulty of being maliciously cracked.
- the encryption technology provided by the present invention is directed to each file. Encryption of bytes can be applied to various types of files, especially streaming media files, and the traditional data encryption technology has been improved to a large extent to better meet the needs of current technological development.
- FIG. 1 is a flowchart of a method for encrypting a file according to Embodiment 1 of the present invention
- FIG. 2 is a flowchart of a method for decrypting an encrypted file according to Embodiment 2 of the present invention
- FIG. 3 is a schematic structural diagram of a file encryption apparatus according to Embodiment 3 of the present invention.
- FIG. 4 is a schematic structural diagram of an apparatus for decrypting an encrypted file according to Embodiment 4 of the present invention.
- a first embodiment of the present invention provides a method for encrypting a file, including steps 101 to 104, which are described in detail below.
- Step 101 Generate an initial password.
- the initial password is used to generate an encrypted password.
- the initial password may be a single number or an array, and may be random or fixed. In some preferred embodiments, security is improved.
- the initial password can be generated by means of a random function. Further, in order to improve the difficulty of password cracking, the initial password is an array containing a plurality of elements generated by means of a random function.
- the initial password needs to be saved.
- Step 102 Read data to be encrypted in the file.
- all the data to be encrypted may be read at one time, or may be read in sequence, and the so-called sequential segmentation refers to setting a fixed value.
- the unit of data length reads the data to be encrypted according to the unit length according to the order in which the file is read. Therefore, when the data to be encrypted is read by using the segment reading method, it may need to be read multiple times, after each reading. After the segment is encrypted, the next segment data is read until the data to be encrypted is encrypted.
- Step 103 Acquire a length of the encrypted data in the file, and calculate an encrypted password based on the initial password and the length of the encrypted data.
- the length of the encrypted data in the file refers to the length of the data that the file has been encrypted at the moment.
- the encrypted password When calculating the encrypted password, it is calculated by substituting the initial password, the initial password length, and the length of the encrypted data into a preset function.
- the type of the preset function is not limited.
- the preset function may be a hash function, and the result calculated by the scatter function has no regularity, and It is assumed that the encrypted password obtained by the function is decentralized and can be found without rules, which further increases the difficulty of the password being cracked.
- the initial password in order to increase the difficulty of cracking, may be set to a random array containing a plurality of elements, and an encrypted password array having the same length as the initial password is calculated by a preset function, and thus, The initial password has a long length and a large data range, and the calculated data range of the encrypted password array also expands.
- Each byte in the encrypted password array is an encrypted password used to encrypt each byte in the file, and the encrypted password belongs to a larger data range.
- the calculated encryption passwords of each group are also irregularly searchable, which greatly increases the difficulty of password cracking and improves data security.
- Step 104 Encrypt the encrypted data using the encrypted password to obtain encrypted data.
- the encrypted password is logically ORed with the corresponding byte to obtain encrypted data of the byte data.
- the encryption operation when the file is encrypted, the encryption operation is performed in units of bytes according to the file reading order, that is, each constituent byte in the file has a corresponding encrypted password, and each Each byte will logically operate with its corresponding encrypted password to obtain the corresponding ciphertext. Therefore, in the process of file encryption, the encryption operation is performed one byte by one byte according to the file reading order.
- Step 1 Read a data of length data_len from the file to be encrypted in, and record the data length offset that has been encrypted.
- the length of the file in is in_len. If the length of the read data is 0, the end of the file jumps out of the encryption process, closes the file in and the file out, and deletes the in file, and the file out is renamed to in. It should be noted that, in this embodiment, whether the file encryption is completed is determined according to the read data length to be encrypted. In other embodiments of the present invention, the judgment may be performed by other means, such as determining the encrypted data. Whether the length is equal to the file length or the like, the present invention is not limited thereto.
- crc64 Cyclic Redundancy Check
- Hash Hash Function
- Step 3 Encrypt the byte data data[data_i] in the data data and the encryption password new_K n [key_i] in the encryption password group new_K n , and the operation rule is data[data_i] ⁇ new_K n [key_i], and then Add data_i and key_i ie data_i++ and key_i++.
- the file encryption method calculates an encrypted password by using an initial password and a length of the encrypted data, and then encrypts the file by using an encrypted password.
- each byte in the file is encrypted.
- the data has a corresponding encrypted password. Therefore, if you want to crack the encrypted file, you need to obtain the initial password, calculation rules, and the way to obtain the encrypted data length when encrypting, in order to correctly obtain the decryption password.
- the file encryption method provided by the implementation of the present invention generates an initial password by using a random function, and calculates an encrypted password by substituting the initial password, the initial password length, and the encrypted data length into a hash function, so that the encrypted password is irregular. It can be followed, so that the encrypted data after encryption can be ruled out. Compared with the traditional encryption method, the difficulty of cracking the password is greatly improved, and the data security is improved.
- the initial password may be an array
- the result calculated by the preset function is an encrypted password array having the same length as the initial password, because the data range of the array is larger than a single character. Therefore, the value range of the encrypted password is greatly expanded, which further improves the difficulty of the password being cracked.
- the method of segmentally reading in sequence is used, and each time the data to be encrypted is read, the length of the encrypted data is substituted for the encrypted password.
- the calculation therefore, when the data is read by different segment lengths, the calculated encryption password is also different, thereby further increasing the difficulty of the password being cracked.
- the encryption method provided by the embodiment of the present invention encrypts each byte in the file, and the decryption is also performed for a single byte, so that it can be decrypted at any node of the file, thereby being suitable for convection.
- the encryption of the media satisfies the need for the user to drag and play when playing video and audio files on the client.
- a second embodiment of the present invention provides a method for decrypting an encrypted file, including steps 201 to 204, which are described in detail below.
- Step 201 Acquire an initial password.
- the same initial password used for encryption is used for decryption.
- the initial password can be read by the path of the initial password during encryption.
- the initial password can be obtained by other means.
- the technical means used is It is known to those skilled in the art and will not be described again.
- Step 202 Read the data to be decrypted in the encrypted file.
- the manner of reading the data to be decrypted affects the generation of the decrypted password, in this embodiment, the manner of reading the data to be decrypted is the same as the manner of reading the data to be encrypted when the file is encrypted.
- Step 203 Acquire the decrypted data length, and calculate a decrypted password based on the initial password and the decrypted data length.
- the length of the decrypted data in the file refers to the length of the data that the file has already decrypted.
- the decryption password it is calculated by substituting the initial password, the initial password length, and the length of the decrypted data into a preset function, wherein the preset function used is the same as the function used for encryption.
- Step 204 Decrypt the data to be decrypted by using the decryption password to obtain decrypted data.
- the decrypted password When the decrypted password is used to decrypt the data to be decrypted in the file, the decrypted password is logically XORed with the corresponding byte to obtain the decrypted data of the byte data.
- the operation method corresponds to the encryption method
- the initial password, the calculation rule, and the file reading method used should be the same.
- the calculation logic of the decryption password is the same as the logic of the program in the above embodiment, and therefore will not be described again.
- the encrypted file decryption method in the embodiment of the present invention is also used for decryption operation for each byte, so it can be applied to decryption of streaming media.
- a third embodiment of the present invention provides a file encryption apparatus, which corresponds to the file encryption method shown in FIG. 1, and can implement the details of the file encryption method in the first embodiment, and achieve the same effect.
- the file encryption apparatus 10 includes an initial password generation unit 11, a storage unit 12, an encrypted data reading unit 13, an encryption password generation unit 14, and a data encryption unit 15, wherein the initial password generation unit 11 is connected to the storage unit 12, and the encryption password is generated.
- the unit 14 is connected to the data encryption unit 15, and the data encryption unit 15 is connected to the storage unit 12 and the encrypted data reading unit 13.
- the initial password generating unit 11 is configured to generate an initial password and save the initial password to the storage unit 12.
- the initial password may be a single number or an array, and may be random or fixed.
- the initial password may be generated by means of a random function in order to improve security.
- the initial password is an array containing multiple elements generated by means of a random function.
- the encrypted data reading unit 13 is configured to read data to be encrypted in the file, and provide data to be encrypted to the data encryption unit 15 for performing an encryption operation.
- all the data to be encrypted may be read at one time, or may be read in sequence, and the so-called sequential segmentation refers to setting a fixed value.
- the unit of data length reads the data to be encrypted according to the unit length according to the order in which the file is read. Therefore, when the data to be encrypted is read by using the segment reading method, it may need to be read multiple times, after each reading. After the segment is encrypted, the next segment data is read until the data to be encrypted is encrypted.
- the encrypted password generating unit 14 can obtain the encrypted data length in the file, and calculate the encrypted password based on the initial password and the encrypted data length, wherein the encrypted password generating unit 14 can obtain the initial password from the initial password generating unit 11, or The initial password is read from the storage unit 12, and the present invention is not limited thereto.
- the length of the encrypted data in the file refers to the length of the data that the file has been encrypted at the moment.
- the encrypted password When calculating the encrypted password, it is calculated by substituting the initial password, the initial password length, and the length of the encrypted data into a preset function.
- the type of the preset function is not limited.
- the preset function may be a hash function, and the result calculated by the scatter function has no regularity, and It is assumed that the encrypted password obtained by the function is decentralized and can be found without rules, which further increases the difficulty of the password being cracked.
- the initial password in order to increase the difficulty of cracking, may be set to a random array containing a plurality of elements, and an encrypted password array having the same length as the initial password is calculated by a preset function, and thus, The initial password has a long length, a large data range, and the calculated encryption key.
- the data range of the code array also expands.
- Each byte in the encrypted password array is an encrypted password used to encrypt each byte in the file, and the encrypted password belongs to a larger data range, and has a decentralized feature, and each calculated
- the group encryption passwords are also irregularly searchable, which greatly increases the difficulty of password cracking and improves data security.
- the data encryption unit 15 encrypts the encrypted data using the encrypted password to obtain encrypted data, and saves the encrypted data to the storage unit 12, wherein the encrypted password is obtained from the encrypted password generating unit 14, and the encrypted data is obtained from the encrypted data. Obtained in the reading unit 13.
- the encrypted password is logically ORed with the corresponding byte to obtain encrypted data of the byte data.
- the encryption operation when the file is encrypted, the encryption operation is performed in units of bytes according to the file reading order, that is, each constituent byte in the file has a corresponding encrypted password, and each Each byte will logically operate with its corresponding encrypted password to obtain the corresponding ciphertext. Therefore, in the process of file encryption, the encryption operation is performed one byte by one byte according to the file reading order.
- the file encryption device provided by the embodiment of the present invention encrypts the file
- the encrypted password is calculated by using the initial password and the length of the encrypted data, and then the file is encrypted by the encrypted password.
- Each byte of data has a corresponding encrypted password. Therefore, if you want to crack the encrypted file, you need to obtain the initial password, calculation rules, and the way to obtain the encrypted data length when encrypting, in order to correctly obtain the decryption password.
- the file encryption apparatus encrypts the file
- the initial password is generated by a random function
- the encrypted password is calculated by substituting the initial password, the initial password length, and the encrypted data length into a hash function.
- the encryption password is irregular, so that the encrypted data can be circulated irregularly. Compared with the traditional encryption method, the difficulty of cracking the password is greatly improved, and the data security is improved.
- the initial password may be an array
- the result calculated by the preset function is an encrypted password array having the same length as the initial password, due to the data range of the array. It is larger than a single character, so the value range of the encrypted password is greatly expanded, which further improves the difficulty of the password being cracked.
- the file encryption device provided by the embodiment of the present invention encrypts the file
- the data to be encrypted is read in a sequential manner, and the encrypted data is required to be substituted each time the data to be encrypted is read.
- the length is used to calculate the encrypted password. Therefore, when the data is read with different segment lengths, the calculated encrypted password is also different, which further increases the difficulty of the password being cracked.
- each byte in the file is encrypted, and the decryption is also performed for a single byte, so that the file can be decrypted at any node of the file. Therefore, it is suitable for encrypting streaming media, and satisfies the requirement of the user to drag and play when playing video and audio files on the client.
- a fourth embodiment of the present invention provides a file decryption apparatus, which corresponds to the file decryption method shown in FIG. 2, and can implement the details of the file decryption method in the first embodiment, and achieve the same effect.
- the encrypted file decryption apparatus 20 includes a decryption password generation unit 21, a storage unit 22, a decryption data reading unit 23, and a data decryption unit 24, wherein the decryption password generation unit 21 is connected to the storage unit 22 and the data decryption unit 24, and the data is decrypted.
- Units 24 are connected to the other three units, respectively.
- the decryption password generating unit 21 acquires the initial password used in the file encryption from the storage unit 22, and acquires the decrypted data length in the file, and calculates the decrypted password based on the initial password and the decrypted data length.
- the initial password may be obtained by reading the path of the initial password during encryption, and the initial password may be obtained by other means, and the technical means used by the method is known to those skilled in the art. Know, so no longer repeat them.
- the length of the decrypted data in the file refers to the length of the data that the file has already decrypted.
- the decryption password it is calculated by substituting the initial password, the initial password length, and the length of the decrypted data into a preset function, wherein the preset function used is the same as the function used for encryption.
- the decryption data reading unit 23 reads the data to be decrypted in the encrypted file.
- the manner of reading the data to be decrypted affects the generation of the decrypted password. Therefore, in this embodiment, the manner of reading the data to be decrypted is The way to read data to be encrypted is the same when encrypting files.
- the data decryption unit 24 decrypts the data to be decrypted using the decryption password to obtain decrypted data.
- the operation method corresponds to the encryption method
- the initial password, the calculation rule, and the file reading method used should be the same.
- the calculation logic of the decryption password is the same as the logic of the program in the above embodiment, and therefore will not be described again.
- the encrypted file decryption apparatus in the embodiment of the present invention performs decryption operation for each byte, and thus can be applied to decryption of streaming media.
- the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Bioethics (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Power Engineering (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种文件加密方法,所述方法包括:生成初始密码;读取所述文件中待加密数据;获取所述文件中已加密数据长度,基于所述初始密码和所述已加密数据长度计算得到加密密码;使用所述加密密码对所述待加密数据进行加密,得到加密数据,通过加密密码对文件中的每个字节进行加密,较于传统的加密方法而言,很大程度的提升了密码被破解的难度,提升了数据安全性。
Description
本发明涉及数据安全技术领域,尤其涉及一种文件的加密、解密方法和装置。
数据加密又称密码学,它是指通过加密算法和加密密钥将明文转变为密文,而解密则是通过解密算法和解密密钥将密文恢复为明文。数据加密目前仍是计算机系统对信息进行保护的一种最可靠的办法。它利用密码技术对信息进行加密,实现信息隐蔽,从而起到保护信息的安全的作用。加密类型主要分为两种:私钥加密技术和公钥加密技术。
随着计算机互联网技术的不断发展,对网络数据安全的要求越来越高,不仅希望数据加密方法能够具有较强的抗破解能力,还希望其能适用于各种不同的文件类型。而传统的数据加密方法已无法满足当前的需求。
发明内容
为了解决背景技术中提到的问题,本发明实施例提供了一种文件的加密、解密方法和装置。所述技术方案如下:
一方面,一种文件的加密方法,包括以下步骤:
生成初始密码;
读取所述文件中待加密数据;
获取所述文件中已加密数据长度,基于所述初始密码和所述已加密数据长度计算得到加密密码;
使用所述加密密码对所述待加密数据进行加密,得到加密数据。
进一步的,所述加密密码是通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到。
进一步的,通过所述预设函数计算得到的所述加密密码是分散化的。
进一步的,所述预设函数为散列函数。
进一步的,其特征在于所述加密密码的长度与所述初始密码长度相同。
进一步的,所述生成初始密码的步骤,包括:利用随机函数生成所述初始密码。
进一步的,所述初始密码为数组。
进一步的,在使用所述加密密码对所述待加密数据进行加密时,是对所述待加密数据的每个字节进行加密。
进一步的,所述加密数据是通过所述加密密码与所述待加密数据进行逻辑异或运算得到。
进一步的,所述文件为流媒体。
进一步的,在读取所述文件中待加密数据时,是按顺序分段读取。
进一步的,更包含步骤:保存所述初始密码。
另一方面,本发明还提供一种加密文件的解密方法,包括:
获取初始密码;
读取所述加密文件中待解密数据;
获取所述文件中已解密数据长度,基于所述初始密码和所述已解密数据长度计算得到解密密码;
使用所述解密密码对所述待解密数据进行解密,得到解密数据。
进一步的,所述解密密码是通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到。
进一步的,所述预设函数与所述文件加密时使用的函数相同。
进一步的,所述初始密码为所述文件加密时使用的初始密码。
进一步的,在使用所述解密密码对所述待解密数据进行解密时,是对所述待解密数据的每个字节进行解密。
进一步的,所述解密数据是通过所述解密密码与所述待解密数据进行逻辑异或运算得到。
进一步的,所述文件为流媒体。
进一步的,所述读取所述待解密数据的方式与加密所述文件时读取待加密数据的方式相同。
对应于上述文件加密方法,本发明提供一种文件加密装置,其特征在于,
包括:
初始密码生成单元,用于生成初始密码,并保存所述初始密码至存储单元中;
加密数据读取单元,用于读取所述文件中待加密数据;
加密密码生成单元,用于获取所述文件中已加密数据长度,并基于所述初始密码和所述已加密数据长度计算得到加密密码;
数据加密单元,使用所述加密密码对所述待加密数据进行加密,得到加密数据,并将所述加密数据保存至所述存储单元。
进一步的,所述加密密码生成单元通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到所述加密密码。
进一步的,通过所述预设函数计算得到的所述加密密码是分散化的。
进一步的,所述预设函数为散列函数。
进一步的,其特征在于所述加密密码的长度与所述初始密码长度相同。
进一步的,所述初始密码生成单元利用随机函数生成所述初始密码。
进一步的,所述数据加密单元在使用所述加密密码对所述待加密数据进行加密时,是对所述待加密数据的每个字节进行加密。
进一步的,所述数据加密单元通过将所述加密密码与所述待加密数据进行逻辑异或运算得到所述加密数据。
进一步的,所述文件为流媒体。
进一步的,所述加密数据读取单元在读取所述待加密数据时,是按顺序分段读取。
对应于上述加密文件的解密方法,本发明提供一种加密文件的解密装置,其特征在于,所述解密装置包括:
解密密码生成单元,所述解密密码生成单元从存储单元中获取初始密码,并获取所述文件中已解密数据长度,基于所述初始密码和所述已解密数据长度计算得到解密密码;
解密数据读取单元,用于读取所述加密文件中待解密数据;
数据解密单元,使用所述解密密码对所述待解密数据进行解密,得到解密数据。
进一步的,所述解密密码生成单元通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到所述解密密码。
进一步的,所述预设函数与所述文件加密时使用的函数相同。
进一步的,所述初始密码为所述文件加密时使用的初始密码。
进一步的,所述数据解密单元在使用所述解密密码对所述待解密数据进行解密时,是对所述待解密数据的每个字节进行解密。
进一步的,所述数据解密单元通过所述解密密码与所述待解密数据进行逻辑异或运算得到所述解密数据。
进一步的,所述文件为流媒体。
进一步的,所述解密读取单元读取所述待解密数据的方式与加密所述文件时读取待加密数据的方式相同。
使用本发明提供的加密技术,引入了随机函数、预设函数及数据读取方式来生成加密密码在很大程度上提升了被恶意破解的难度,本发明提供的加密技术是针对文件中的每个字节进行加密,可适用于各种类型的文件,尤其是流媒体文件,在很大程度上对传统数据加密技术进行了改进,更好的满足了当前技术发展的需求。
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例一提供的一种文件加密的方法流程图;
图2是本发明实施例二提供的一种加密文件的解密方法流程图;
图3是本发明实施例三提供的一种文件加密装置的结构示意图;
图4是本发明实施例四提供的一种加密文件的解密装置结构示意图。
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。
第一实施例
参见图1所示,本发明第一实施例提供一种文件的加密方法,包括步骤101~步骤104,详述如下。
步骤101:生成初始密码。
初始密码用于生成加密密码,本发明的实施例中,初始密码可以是单个数字,也可以是数组,可以是随机的,也可以是固定的,在一些较佳实施例中,为了提高安全性,初始密码可借助随机函数生成,更进一步的,为了提升密码破解难度,初始密码为借助随机函数生成的包含多个元素的数组。
更进一步的,为了后续的解密操作,需将初始密码进行保存。
步骤102:读取文件中待加密数据。
本发明的实施例中,读取文件中待加密数据时,可以是一次性读取所有的待加密数据,也可以按顺序分段读取,所谓按顺序分段读取是指设定一个固定数据长度单位,根据文件读取的顺序按照该单位长度来读取待加密数据,故当使用分段读取的方式来读取待加密数据时,可能需要读取多次,每次读取后,对该分段进行加密处理后,再读取下一分段数据,直至所以待加密数据加密完毕。
步骤103:获取文件中已加密数据的长度,基于所述初始密码和所述已加密数据长度计算得到加密密码。
文件中已加密数据的长度是指文件在当前已经完成加密的数据的长度。
在计算加密密码时,通过将初始密码、初始密码长度和加密数据的长度代入预设函数计算得到。本发明的实施例中并不对预设函数的类型进行限制,在本发明的一些较佳实施例中,预设函数可以为散列函数,由于分散函数计算出的结果不具有规律性,通过预设函数计算得到的加密密码是分散化的,无规律可寻,从而更进一步的增加了密码被破解的难度。
在本发明的较佳实施例中,为了增加破解难度,初始密码可设为包含多个元素的随机数组,通过预设函数计算得到的结果与初始密码长度相同的加密密码数组,如此一来,初始密码的长度较长,数据范围较大,计算得到的加密密码数组的数据范围也随之扩大。该加密密码数组中的每个字节就是用于对文件中各个字节进行加密的加密密码,该些加密密码属于较大的数据范围,之间具
有分散化的特点,且计算得出的每组加密密码之间也无规律可寻,故在很大程度上增加了密码被破解的难度,提高了数据安全性。
步骤104:使用所述加密密码对待加密数据进行加密,得到加密数据。
使用加密密码对文件中待加密数据进行加密时,是对将加密密码与对应的字节进行逻辑异或运算得到该字节数据的加密数据。
本发明的实施例中,在对文件进行加密时,是按文件读取顺序以字节为单位进行加密操作的,也就是说,文件中的每个组成字节都有对应的加密密码,每个字节都将与其对应的加密密码进行逻辑运算,以得到相应的密文,故在文件加密的过程中,是按照文件读取顺序一个字节一个字节的进行加密操作。
以下对上述加密密码的计算方法和数据加密方法的具体程序逻辑实现进行详细说明。
步骤一:从待加密文件in中读出一段长度为data_len的数据data,记录当前已经加密完成的数据长度offset,文件in的长度为in_len。如果读到的数据长度为0既文件结尾则跳出加密流程,关闭文件in和文件out,并将in文件删除,文件out重新命名成in。值得注意的是,本实施例中,文件加密是否完成是根据读取的待加密数据长度来判断,在本发明的其他实施例中,还可以通过其他方式来进行判断,如判断已加密数据的长度是否等于文件长度等,本发明并不以此为限。
步骤二:计算本次加密密码组的偏移量n=offset/m、加密密码偏移量key_i=offset%m,其中本次加密密码组的偏移量是指本次加密时所使用的加密密码组的序号,加密密码偏移量是指本次加密使用的加密密码在加密密码组中的标识;初始化data偏移data_i=0;通过预设函数计算加密密码组new_Kn,计算公式是new_Kn=xor_key(key,offset/m),其中key为通过随机函数计算得到的初始密码,m为初始密码的长度,xor_key是预设函数,为了保证xor_key的计算结果是分散化的,可以取crc64(循环冗余校验)或者Hash(散列函数)函数等来实现,本实施例中使用的是crc64(循环冗余校验)。
步骤三:将数据data中的字节数据data[data_i]和加密密码组new_Kn中的加密密码new_Kn[key_i]做加密运算,运算规则是data[data_i]^new_Kn[key_i],然后自加data_i和key_i即data_i++和key_i++。
步骤四:如果data_i==data_len,表示本次读取出的数据data已全部完成加密,则将数据data对应的密文写入文件out,如果offset+=in_len,重新执行步骤一。
步骤五:如果key_i==m,重新计算new_Kn,计算过程是new_Kn=xor_key(key,(offsert+data_i)/m),n=(offsert+data_i)/m,设置key_i=0,并重新执行步骤三。
综上所述,本发明实施例所提供的文件加密方法,通过初始密码、已加密数据的长度计算得到加密密码,再通过加密密码对文件进行加密,在加密时,文件中的每个字节数据都有对应的加密密码。故若要对加密文件进行破解,需要获取到初始密码、计算规则以及加密时已加密数据长度的获取方式,才能正确得出解密密码。
更进一步的,本发明的实施所提供的文件加密方法通过随机函数生成初始密码,并通过将初始密码、初始密码长度和已加密的数据长度代入散列函数计算得到加密密码,使得加密密码无规律可循,从而使得加密后的加密数据无规律可循,较于传统的加密方法而言,很大程度的提升了密码被破解的难度,提升了数据安全性。
更进一步的,本发明实施例所提供的文件加密方法中,初始密码可为数组,通过预设函数计算得到的结果是与初始密码长度相同的加密密码数组,由于数组的数据范围较单个字符大,故加密密码的取值范围在很大程度上得到扩张,更进一步的提升了密码被破解的难度。
更进一步的,本发明实施例所提供的文件加密方法中,读取待加密数据时采用按顺序分段读取的方式,每次读取待加密数据时需代入已加密数据的长度进行加密密码的计算,故,采取不同的分段长度读取数据时,计算得出的加密密码也不相同,从而更进一步的增加了密码被破解的难度。
值得注意的是,本发明实施例所提供的加密方法是针对文件中的每个字节进行加密,解密时也是针对单个字节进行的,从而可以在文件的任意节点进行解密,从而适用于对流媒体的加密,满足用户在客户端播放视频音频文件时,拖动播放的需求。
第二实施例
参见图2所示,本发明第二实施例提供一种加密文件的解密方法,包括步骤201~步骤204,详述如下。
步骤201:获取初始密码。
具体而言,解密时需使用加密时相同的初始密码,本步骤中,可通过加密时初始密码的保存路径中读取得到初始密码,可以是通过其他方式获取初始密码,其使用的技术手段为本领域技术人员所习知,故不再赘述。
步骤202:读取加密文件中待解密数据。
由于读取待解密数据的方式会影响到解密密码的生成,所以本实施例中,读取所述待解密数据的方式与加密所述文件时读取待加密数据的方式相同。
步骤203:获取所述已解密数据长度,基于初始密码和已解密数据长度计算得到解密密码。
文件中解密数据的长度是指文件在当前已经完成解密的数据的长度。
在计算解密密码时,通过将初始密码、初始密码长度和解密数据的长度代入预设函数计算得到,其中所使用的预设函数与加密时所使用的函数相同。
步骤204:使用所述解密密码对所述待解密数据进行解密,得到解密数据。
使用解密密码对文件中待解密数据进行解密时,是对将解密密码与对应的字节进行逻辑异或运算得到该字节数据的解密数据。
在本实施例的文件解密方法中,为了能对加密文件进行顺利解密,其操作方法与加密方法相对应,使用的初始密码、计算规则和文件读取方式应都相同。其中,解密密码的计算逻辑与上述实施例中的程序逻辑相同,故不再赘述。
同样的,本发明实施例中的加密文件解密方法,也是针对每个字节进行解密操作,故可适用于流媒体的解密。
第三实施例
参见图3所示,本发明第三实施例提供一种文件加密装置,与图1所示的文件加密方法相对应,能实现第一实施例中的文件加密方法的细节,并达到相同的效果。所述文件加密装置10包括初始密码生成单元11,存储单元12,加密数据读取单元13,加密密码生成单元14,数据加密单元15,其中初始密码生成单元11连接于存储单元12,加密密码生成单元14连接于和数据加密单元15,数据加密单元15连接于存储单元12和加密数据读取单元13。
具体而言,初始密码生成单元11,用于生成初始密码,并保存初始密码至存储单元12中。
本发明的实施例中,初始密码可以是单个数字,也可以是数组,可以是随机的,也可以是固定的,在一些较佳实施例中,为了提高安全性,初始密码可借助随机函数生成,更进一步的,为了提升密码破解难度,初始密码为借助随机函数生成的包含多个元素的数组。
将初始密码进行保存,是一方面可提供给后续加密过程中使用,另一方面是为了在解密时使用。
加密数据读取单元13,用于读取文件中待加密数据,并提供待加密数据给数据加密单元15进行加密操作。
本发明的实施例中,读取文件中待加密数据时,可以是一次性读取所有的待加密数据,也可以按顺序分段读取,所谓按顺序分段读取是指设定一个固定数据长度单位,根据文件读取的顺序按照该单位长度来读取待加密数据,故当使用分段读取的方式来读取待加密数据时,可能需要读取多次,每次读取后,对该分段进行加密处理后,再读取下一分段数据,直至所以待加密数据加密完毕。
加密密码生成单元14,可获取文件中已加密数据长度,并基于初始密码和已加密数据长度计算得到加密密码,其中,加密密码生成单元14可以从初始密码生成单元11中获得初始密码,也可以从存储单元12中读取初始密码,本发明并不做限制。
文件中已加密数据的长度是指文件在当前已经完成加密的数据的长度。
在计算加密密码时,通过将初始密码、初始密码长度和加密数据的长度代入预设函数计算得到。本发明的实施例中并不对预设函数的类型进行限制,在本发明的一些较佳实施例中,预设函数可以为散列函数,由于分散函数计算出的结果不具有规律性,通过预设函数计算得到的加密密码是分散化的,无规律可寻,从而更进一步的增加了密码被破解的难度。
在本发明的较佳实施例中,为了增加破解难度,初始密码可设为包含多个元素的随机数组,通过预设函数计算得到的结果与初始密码长度相同的加密密码数组,如此一来,初始密码的长度较长,数据范围较大,计算得到的加密密
码数组的数据范围也随之扩大。该加密密码数组中的每个字节就是用于对文件中各个字节进行加密的加密密码,该些加密密码属于较大的数据范围,之间具有分散化的特点,且计算得出的每组加密密码之间也无规律可寻,故在很大程度上增加了密码被破解的难度,提高了数据安全性。
数据加密单元15,使用的加密密码对待加密数据进行加密,得到加密数据,并将加密数据保存至所述存储单元12,其中,加密密码是从加密密码生成单元14中获得,加密数据从加密数据读取单元13中获得。
使用加密密码对文件中待加密数据进行加密时,是对将加密密码与对应的字节进行逻辑异或运算得到该字节数据的加密数据。
本发明的实施例中,在对文件进行加密时,是按文件读取顺序以字节为单位进行加密操作的,也就是说,文件中的每个组成字节都有对应的加密密码,每个字节都将与其对应的加密密码进行逻辑运算,以得到相应的密文,故在文件加密的过程中,是按照文件读取顺序一个字节一个字节的进行加密操作。
本实施例中所使用的加密密码的计算方式和加密方法的实现逻辑与实施例一中的相同,故不再赘述。
由此可见,通过本发明实施例所提供的文件加密装置对文件进行加密时,通过初始密码、已加密数据的长度计算得到加密密码,再通过加密密码对文件进行加密,在加密时,文件中的每个字节数据都有对应的加密密码。故若要对加密文件进行破解,需要获取到初始密码、计算规则以及加密时已加密数据长度的获取方式,才能正确得出解密密码。
更进一步的,本发明的实施所提供的文件加密装置对文件进行加密时,通过随机函数生成初始密码,并通过将初始密码、初始密码长度和已加密的数据长度代入散列函数计算得到加密密码,使得加密密码无规律可循,从而使得加密后的加密数据无规律可循,较于传统的加密方法而言,很大程度的提升了密码被破解的难度,提升了数据安全性。
更进一步的,本发明实施例所提供的文件加密装置对文件进行加密时,初始密码可为数组,通过预设函数计算得到的结果是与初始密码长度相同的加密密码数组,由于数组的数据范围较单个字符大,故加密密码的取值范围在很大程度上得到扩张,更进一步的提升了密码被破解的难度。
更进一步的,本发明实施例所提供的文件加密装置对文件进行加密时,读取待加密数据时采用按顺序分段读取的方式,每次读取待加密数据时需代入已加密数据的长度进行加密密码的计算,故,采取不同的分段长度读取数据时,计算得出的加密密码也不相同,从而更进一步的增加了密码被破解的难度。
值得注意的是,本发明实施例所提供的加密装置对文件进行加密时是针对文件中的每个字节进行加密,解密时也是针对单个字节进行的,从而可以在文件的任意节点进行解密,从而适用于对流媒体的加密,满足用户在客户端播放视频音频文件时,拖动播放的需求。
第四实施例
参见图4所示,本发明第四实施例提供一种文件解密装置,与图2所示的文件解密方法相对应,能实现第一实施例中的文件解密方法的细节,并达到相同的效果。所述加密文件解密装置20包括解密密码生成单元21、存储单元22、解密数据读取单元23和数据解密单元24,其中,解密密码生成单元21连接于存储单元22和数据解密单元24,数据解密单元24分别连接于其他三个单元。
具体而言,解密密码生成单元21从存储单元22中获取文件加密时使用的初始密码,并获取文件中已解密数据长度,基于初始密码和已解密数据长度计算得到解密密码。
值得注意的是,本发明的其他实施例中,可通过加密时初始密码的保存路径中读取得到初始密码,可以是通过其他方式获取初始密码,其使用的技术手段为本领域技术人员所习知,故不再赘述。文件中解密数据的长度是指文件在当前已经完成解密的数据的长度。
在计算解密密码时,通过将初始密码、初始密码长度和解密数据的长度代入预设函数计算得到,其中所使用的预设函数与加密时所使用的函数相同。
解密数据读取单元23,读取加密文件中待解密数据,如前文所述,读取待解密数据的方式会影响到解密密码的生成,所以本实施例中,读取待解密数据的方式与加密文件时读取待加密数据的方式相同。
数据解密单元24,使用所述解密密码对所述待解密数据进行解密,得到解密数据。
使用解密密码对文件中待解密数据进行解密时,是对将解密密码与对应的
字节进行逻辑异或运算得到该字节数据的解密数据。
在本实施例的加密文件解密装置中,为了能对加密文件进行顺利解密,其操作方法与加密方法相对应,使用的初始密码、计算规则和文件读取方式应都相同。其中,解密密码的计算逻辑与上述实施例中的程序逻辑相同,故不再赘述。
同样的,本发明实施例中的加密文件解密装置,也是针对每个字节进行解密操作,故可适用于流媒体的解密。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
Claims (38)
- 一种文件加密的方法,其特征在于,所述方法包括:生成初始密码;读取所述文件中待加密数据;获取所述文件中已加密数据长度,基于所述初始密码和所述已加密数据长度计算得到加密密码;使用所述加密密码对所述待加密数据进行加密,得到加密数据。
- 根据权利要求1所述的文件加密方法,其特征在于,所述加密密码是通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到。
- 根据权利要求2所述的文件加密方法,其特征在于,通过所述预设函数计算得到的所述加密密码是分散化的。
- 根据权利要求2所述的文件加密方法,其特征在于,所述预设函数为散列函数。
- 根据权利要求2所述的文件加密方法,其特征在于所述加密密码的长度与所述初始密码长度相同。
- 根据权利要求1所述的文件加密方法,其特征在于,所述生成初始密码的步骤,包括:利用随机函数生成所述初始密码。
- 根据权利要求1所述的文件加密方法,其特征在于,所述初始密码为数组。
- 根据权利要求1所述的文件加密方法,其特征在于,在使用所述加密密码对所述待加密数据进行加密时,是对所述待加密数据的每个字节进行加密。
- 根据权利要求1所述的文件加密方法,其特征在于,所述加密数据是通过所述加密密码与所述待加密数据进行逻辑异或运算得到。
- 根据权利要求1所述的文件加密方法,其特征在于,所述文件为流媒体。
- 根据权利要求1所述的文件加密方法,其特征在于,在读取所述文件中待加密数据时,是按顺序分段读取。
- 根据权利要求1所述的文件密码方法,其特征在于,更包含步骤:保存所述初始密码。
- 一种加密文件的解密方法,其特征在于,所述方法包括:获取初始密码;读取所述加密文件中待解密数据;获取所述文件中已解密数据长度,基于所述初始密码和所述已解密数据长度计算得到解密密码;使用所述解密密码对所述待解密数据进行解密,得到解密数据。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,所述解密密码是通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到。
- 根据权利要求14所述的加密文件的解密方法,其特征在于,所述预设函数与所述文件加密时使用的函数相同。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,所述初始密码为所述文件加密时使用的初始密码。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,在使用所述解密密码对所述待解密数据进行解密时,是对所述待解密数据的每个字节进行解密。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,所述解密数据是通过所述解密密码与所述待解密数据进行逻辑异或运算得到。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,所述文件为流媒体。
- 根据权利要求13所述的加密文件的解密方法,其特征在于,所述读取所述待解密数据的方式与加密所述文件时读取待加密数据的方式相同。
- 一种文件加密装置,其特征在于,包括:初始密码生成单元,用于生成初始密码,并保存所述初始密码至存储单元中;加密数据读取单元,用于读取所述文件中待加密数据;加密密码生成单元,用于获取所述文件中已加密数据长度,并基于所述初 始密码和所述已加密数据长度计算得到加密密码;数据加密单元,使用所述加密密码对所述待加密数据进行加密,得到加密数据,并将所述加密数据保存至所述存储单元。
- 根据权利要求21所述的文件加密装置,其特征在于,所述加密密码生成单元通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到所述加密密码。
- 根据权利要求22所述的文件加密装置,其特征在于,通过所述预设函数计算得到的所述加密密码是分散化的。
- 根据权利要求22所述的文件加密装置,其特征在于,所述预设函数为散列函数。
- 根据权利要求22所述的文件加密装置,其特征在于所述加密密码的长度与所述初始密码长度相同。
- 根据权利要求21所述的文件加密装置,其特征在于,所述初始密码生成单元利用随机函数生成所述初始密码。
- 根据权利要求21所述的文件加密装置,其特征在于,所述数据加密单元在使用所述加密密码对所述待加密数据进行加密时,是对所述待加密数据的每个字节进行加密。
- 根据权利要求21所述的文件加密装置,其特征在于,所述数据加密单元通过将所述加密密码与所述待加密数据进行逻辑异或运算得到所述加密数据。
- 根据权利要求21所述的文件加密装置,其特征在于,所述文件为流媒体。
- 根据权利要求21所述的文件加密装置,其特征在于,所述加密数据读取单元在读取所述待加密数据时,是按顺序分段读取。
- 一种加密文件的解密装置,其特征在于,所述解密装置包括:解密密码生成单元,所述解密密码生成单元从存储单元中获取初始密码,并获取所述文件中已解密数据长度,基于所述初始密码和所述已解密数据长度计算得到解密密码;解密数据读取单元,用于读取所述加密文件中待解密数据;数据解密单元,使用所述解密密码对所述待解密数据进行解密,得到解密 数据。
- 根据权利要求31所述的加密文件的解密装置,其特征在于,所述解密密码生成单元通过将所述初始密码、所述初始密码长度和所述已加密数据长度代入预设函数计算得到所述解密密码。
- 根据权利要求32所述的加密文件的解密装置,其特征在于,所述预设函数与所述文件加密时使用的函数相同。
- 根据权利要求31所述的加密文件的解密装置,其特征在于,所述初始密码为所述文件加密时使用的初始密码。
- 根据权利要求31所述的加密文件的解密装置,其特征在于,所述数据解密单元在使用所述解密密码对所述待解密数据进行解密时,是对所述待解密数据的每个字节进行解密。
- 根据权利要求31所述的加密文件的解密装置,其特征在于,所述数据解密单元通过所述解密密码与所述待解密数据进行逻辑异或运算得到所述解密数据。
- 根据权利要求31所述的加密文件的解密装置,其特征在于,所述文件为流媒体。
- 根据权利要求31所述的加密文件的解密方法,其特征在于,所述解密读取单元读取所述待解密数据的方式与加密所述文件时读取待加密数据的方式相同。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US16/319,687 US20210288789A1 (en) | 2017-03-20 | 2017-04-12 | Method and device for file encryption and decryption |
| EP17901375.0A EP3499791A4 (en) | 2017-03-20 | 2017-04-12 | METHOD AND DEVICE FOR ENCRYPTING AND DECOMPOSING FILES |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710180076.0 | 2017-03-20 | ||
| CN201710180076.0A CN106878013B (zh) | 2017-03-20 | 2017-03-20 | 一种文件的加密、解密方法和装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018170963A1 true WO2018170963A1 (zh) | 2018-09-27 |
Family
ID=59172866
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/080198 Ceased WO2018170963A1 (zh) | 2017-03-20 | 2017-04-12 | 一种文件的加密、解密方法和装置 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US20210288789A1 (zh) |
| EP (1) | EP3499791A4 (zh) |
| CN (1) | CN106878013B (zh) |
| WO (1) | WO2018170963A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116015620A (zh) * | 2022-11-11 | 2023-04-25 | 自然资源部国土卫星遥感应用中心 | 一种卫星影像数据加密和解密方法和系统 |
| US12411960B2 (en) | 2019-06-10 | 2025-09-09 | Children's Hospital Los Angeles | Dynamic encryption/decryption of genomic information |
Families Citing this family (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108040191B (zh) * | 2017-12-20 | 2019-07-23 | 北京邮电大学 | 基于哈希链压缩感知的图像加密和解密方法 |
| CN109150512A (zh) * | 2018-08-22 | 2019-01-04 | 网宿科技股份有限公司 | 一种数据加密、解密方法、系统及数据加密、解密装置 |
| CN110035319B (zh) * | 2019-04-02 | 2020-05-15 | 北京文香信息技术有限公司 | 一种音视频数据的加密、解密方法、装置及播放设备 |
| CN111131158A (zh) * | 2019-11-21 | 2020-05-08 | 珠海剑心互动娱乐有限公司 | 单字节对称加密解密方法、装置及可读介质 |
| CN111368345A (zh) * | 2020-03-09 | 2020-07-03 | 浙江众邦机电科技有限公司 | 加密程序的解密方法、装置、设备和计算机可读存储介质 |
| CN112364358A (zh) * | 2020-10-30 | 2021-02-12 | 北京天润融通科技股份有限公司 | 语音加密方法与装置、语音解密方法与装置 |
| CN114285562B (zh) * | 2021-12-27 | 2023-05-09 | 元心信息科技集团有限公司 | 一种数据加密方法和装置 |
| CN114792011A (zh) * | 2022-04-21 | 2022-07-26 | 灵起科技(深圳)有限公司 | 一种桌面宠物机器人内置文件加密和解密方法 |
| CN115277266B (zh) * | 2022-09-29 | 2023-01-31 | 南京银铂科技有限公司 | 一种实验室数据加密方法、装置、终端及介质 |
| CN116015940A (zh) * | 2022-12-30 | 2023-04-25 | 上海瓶钵信息科技有限公司 | 日志手机、保存、上传的方法及系统 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101340279A (zh) * | 2008-07-09 | 2009-01-07 | 深圳市金蝶移动互联技术有限公司 | 数据加密及解密方法、系统及设备 |
| CN102402670A (zh) * | 2011-08-03 | 2012-04-04 | 广东欧珀移动通信有限公司 | 一种文件加解密方法 |
| CN103957099A (zh) * | 2014-05-16 | 2014-07-30 | 武汉大学 | 一种与水印结合的媒体加密和解密的方法 |
| CN106453318A (zh) * | 2016-10-14 | 2017-02-22 | 北京握奇智能科技有限公司 | 一种基于安全模块的数据传输系统及方法 |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CA2267395C (en) * | 1999-03-30 | 2002-07-09 | Ibm Canada Limited-Ibm Canada Limitee | Method and system for managing keys for encrypted data |
| CN102594549B (zh) * | 2012-03-22 | 2015-02-11 | 山东泰信电子股份有限公司 | 一种数据多级加密、解密方法 |
-
2017
- 2017-03-20 CN CN201710180076.0A patent/CN106878013B/zh not_active Expired - Fee Related
- 2017-04-12 US US16/319,687 patent/US20210288789A1/en not_active Abandoned
- 2017-04-12 WO PCT/CN2017/080198 patent/WO2018170963A1/zh not_active Ceased
- 2017-04-12 EP EP17901375.0A patent/EP3499791A4/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101340279A (zh) * | 2008-07-09 | 2009-01-07 | 深圳市金蝶移动互联技术有限公司 | 数据加密及解密方法、系统及设备 |
| CN102402670A (zh) * | 2011-08-03 | 2012-04-04 | 广东欧珀移动通信有限公司 | 一种文件加解密方法 |
| CN103957099A (zh) * | 2014-05-16 | 2014-07-30 | 武汉大学 | 一种与水印结合的媒体加密和解密的方法 |
| CN106453318A (zh) * | 2016-10-14 | 2017-02-22 | 北京握奇智能科技有限公司 | 一种基于安全模块的数据传输系统及方法 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP3499791A4 * |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US12411960B2 (en) | 2019-06-10 | 2025-09-09 | Children's Hospital Los Angeles | Dynamic encryption/decryption of genomic information |
| CN116015620A (zh) * | 2022-11-11 | 2023-04-25 | 自然资源部国土卫星遥感应用中心 | 一种卫星影像数据加密和解密方法和系统 |
| CN116015620B (zh) * | 2022-11-11 | 2023-07-28 | 自然资源部国土卫星遥感应用中心 | 一种卫星影像数据加密和解密方法和系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106878013B (zh) | 2021-02-02 |
| EP3499791A4 (en) | 2019-09-18 |
| US20210288789A1 (en) | 2021-09-16 |
| CN106878013A (zh) | 2017-06-20 |
| EP3499791A1 (en) | 2019-06-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2018170963A1 (zh) | 一种文件的加密、解密方法和装置 | |
| CN109040090B (zh) | 一种数据加密方法及装置 | |
| US9537657B1 (en) | Multipart authenticated encryption | |
| CN102013980A (zh) | 需要采用穷举法解密的随机加密方法 | |
| JP2013205800A (ja) | データを暗号化する装置及び方法 | |
| CN112100696B (zh) | 存储器装置及其安全读取方法 | |
| JP2008545163A (ja) | セキュアハッシュ関数の強化 | |
| CN111404953A (zh) | 一种消息加密方法、解密方法及相关装置、系统 | |
| CN104281815A (zh) | 文件加解密的方法和系统 | |
| CN105468940A (zh) | 软件保护方法及装置 | |
| CN108777803A (zh) | 广电云平台视频流处理方法、装置、设备及介质 | |
| CN112134693B (zh) | 密钥加密存储方法、获取方法及其装置 | |
| CN102811124A (zh) | 基于两卡三码技术的系统验证方法 | |
| CN106778292B (zh) | 一种Word加密文档的快速还原方法 | |
| CN112818404B (zh) | 数据访问权限的更新方法、装置、设备及可读存储介质 | |
| CN114513302A (zh) | 一种数据加解密方法及设备 | |
| CN116881945B (zh) | 一种基于tpcm的固态硬盘加解密方法、系统及电子设备 | |
| CN105959099A (zh) | 一种实现ssr密码加密的方法 | |
| WO2023198036A1 (zh) | 一种密钥生成方法、装置及设备 | |
| US8341417B1 (en) | Data storage using encoded hash message authentication code | |
| CN112069472A (zh) | 一种用户登录认证方法及系统 | |
| TW202222051A (zh) | 加密方法、終端裝置、加密系統以及程式 | |
| CN103763097A (zh) | 密码或密钥的安全加密方法 | |
| CN111130788B (zh) | 数据处理方法和系统、数据读取方法和iSCSI服务器 | |
| CN111859408A (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: 17901375 Country of ref document: EP Kind code of ref document: A1 |
|
| ENP | Entry into the national phase |
Ref document number: 2017901375 Country of ref document: EP Effective date: 20190314 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |