Data encryption storage method and device of mobile storage terminal and storage medium

By generating a unique encryption key based on text and image data, combined with the generation of key ID and user authentication, the problem of easy leakage of encryption keys is solved, and the security and effectiveness of mobile terminal data encryption storage is improved.

CN120493280AInactive Publication Date: 2025-08-15SHENZHEN SHUAIHONGYU TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510580013.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-07
Publication Date
2025-08-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing mobile terminal data encryption storage technology, encryption keys are prone to leakage, resulting in the problem of encryption data leakage. The existing technology lacks the means of generating and protecting encryption keys.

Method used

By obtaining the data to be encrypted, a key generation sequence based on text data and image data is generated, a unique encryption key is generated, and a storage ciphertext is encrypted, and a key ID is generated based on the storage ciphertext and encryption key. After the user's identity verification, the encryption key is restored through the key ID for decryption.

Benefits of technology

Improve the security of encryption keys and the security of mobile terminal data encryption storage, prevent encryption key leakage, and ensure the security and effectiveness of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120493280A_ABST
    Figure CN120493280A_ABST
Patent Text Reader

Abstract

The invention discloses a data encryption storage method and device of a mobile storage terminal and a storage medium, and relates to the technical field of mobile terminal data encryption storage, and the method comprises the following steps: obtaining to-be-encrypted data, and generating a unique encryption key based on the to-be-encrypted data; performing encryption operation on the text data through the encryption key; performing encryption operation on the image data through the encryption key; generating a key ID based on the storage ciphertext and the encryption key; when a user needs to access the storage ciphertext in the mobile storage terminal, the identity of the user is verified firstly, and after verification is passed, the encryption key is restored through the key ID and the storage ciphertext, and the storage ciphertext is decrypted; the method and the device are used for solving the problems that the encryption key is easy to leak and the encrypted data is further leaked due to insufficient generation and protection means of the encryption key in the existing mobile terminal data encryption storage technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption storage in mobile terminals, and in particular to a data encryption storage method, device and storage medium for a mobile storage terminal. Background Art

[0002] Mobile terminal data encryption storage technology refers to a technical system that uses cryptographic means to protect static data stored in mobile terminals (such as smartphones, tablets, USB flash drives, mobile hard drives and SD cards, etc.), ensuring that the data is in an encrypted state in the local or external storage media of the device to prevent unauthorized access, theft or tampering.

[0003] Existing mobile terminal data encryption and storage technologies typically encrypt data using a fixed key, and the key is typically stored within the mobile terminal. However, due to the portability and mobility of mobile terminals, such as mobile devices like mobile phones and USB flash drives, users face a high risk of losing the mobile terminal when carrying it. If the mobile terminal is lost and the encryption key is present within the mobile terminal, data within the mobile terminal may be leaked. Furthermore, existing mobile terminal data encryption and storage technologies also perform encryption operations using a manually set encryption key, which is stored in the user's hands. If the user accidentally leaks the encryption key, data within the mobile terminal may also be leaked. For example, patent application publication number CN113297615A discloses a "Mobile Terminal and Data Encryption Method Thereof." This solution utilizes a fixed encryption key from a super SIM card to encrypt data, and the encryption key is stored within the mobile terminal or SIM card. If the mobile terminal is lost, the data within the mobile terminal may also be leaked. Existing mobile terminal data encryption and storage technologies also lack sufficient means for generating and protecting the encryption key, resulting in the vulnerability of the encryption key and, in turn, the leakage of the encrypted data. Summary of the Invention

[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent, by obtaining data to be encrypted, the data to be encrypted including text data and image data, generating a key generation sequence based on the text data and the image data, and generating a unique encryption key for the data to be encrypted based on the key generation sequence, then performing encryption operation on the text data by the encryption key to obtain storage ciphertext and store the storage ciphertext, then performing encryption operation on the image data by the encryption key to obtain storage ciphertext and store the storage ciphertext, then generating a key ID based on the storage ciphertext and the encryption key and storing the key ID, and finally, when the user needs to access the storage ciphertext in the mobile storage terminal, first authenticate the user, and after the authentication is passed, restore the encryption key by the key ID and the storage ciphertext and decrypt the storage ciphertext, so as to solve the problem that the existing mobile terminal data encryption storage technology still has insufficient means for generating and protecting encryption keys, which makes the encryption key easy to be leaked and further causes the encrypted data to be leaked.

[0005] To achieve the above objectives, in a first aspect, the present application provides a data encryption storage method for a mobile storage terminal, comprising the following steps:

[0006] Acquire data to be encrypted, and generate a unique encryption key based on the data to be encrypted, wherein the data to be encrypted includes text data and image data;

[0007] Perform encryption operation on text data using an encryption key to obtain a stored ciphertext and store the stored ciphertext;

[0008] Perform encryption operation on the image data using the encryption key to obtain storage ciphertext and store the storage ciphertext;

[0009] Generate a key ID based on the stored ciphertext and the encryption key and store the key ID;

[0010] When a user needs to access the stored ciphertext in the mobile storage terminal, the user's identity is authenticated first. After the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted.

[0011] Furthermore, obtaining the data to be encrypted and generating a unique encryption key based on the data to be encrypted includes the following sub-steps:

[0012] Acquire data to be stored in a mobile storage terminal, named as data to be encrypted, wherein the data to be encrypted includes text data and image data, and the image data includes picture data and video data;

[0013] generating a key generation sequence based on the text data and the image data;

[0014] Generates a unique encryption key for the data to be encrypted based on the key generation sequence.

[0015] Furthermore, generating a key generation sequence based on text data and image data includes the following sub-steps:

[0016] For text data, the binary code corresponding to the text data in the computer is named the key generation sequence;

[0017] If the data to be stored is video data, then the first frame of the video data is obtained and named as the first frame image, and the first frame image belongs to the image data;

[0018] For the image data, grayscale processing is performed on the image data to obtain a grayscale image;

[0019] Obtain the grayscale values of the first row of pixels in the grayscale image, and arrange and combine the grayscale values in the order of the pixels from left to right to obtain the grayscale sequence of the grayscale image;

[0020] The binary code corresponding to the grayscale sequence in the computer is named the key generation sequence.

[0021] Furthermore, generating a unique encryption key for the data to be encrypted based on the key generation sequence includes the following sub-steps:

[0022] The number of digits in the key generation sequence is counted and named as the sequence digits;

[0023] Set the first digit threshold and remove the digits after the first digit threshold in the key generation sequence so that the number of sequence digits is equal to the first digit threshold. The retained key generation sequence is named the standard generation sequence.

[0024] Number the numbers in the standard generation sequence and mark them as N from left to right i , where i is a positive integer and i is the sequence number of N, 1≤i≤the first digit threshold;

[0025] Set No. P j , j is a positive integer and j is the serial number of P, j is initially 1, and the analysis starts from i=1 to determine N i Is it 1? If so, set P j Set it to i, add one to i and j and judge again. If not, add one to i and judge again until each N i Until the judgment is completed;

[0026] The statistically obtained P j , for P j Make the changes, keeping only P j The unit digit in the j ;

[0027] In order of j from small to large, U j The combination is formed into a string of numbers, which is named as encryption key.

[0028] Furthermore, performing encryption operation on the text data using the encryption key to obtain storage ciphertext and storing the storage ciphertext includes the following sub-steps:

[0029] Obtaining text data, and naming the binary code corresponding to the text data in the computer as the text code;

[0030] In the text code, each 8-bit binary digit is a byte, and the bytes in the text code are numbered from left to right. n Indicates, where n is a positive integer and n is the sequence number of X;

[0031] The binary code corresponding to the encryption key in the computer is named the key code, and the bytes in the key code are numbered and marked as P in order from left to right. m , where m is a positive integer and m is the serial number of P;

[0032] For any X n , start the analysis with m=1, and set X n With P m Perform XOR operation on the numbers with the same digits in the result to get H nm , H nm Represents X n With P m Perform the XOR operation on the result, add one to m and add H nm With P m The numbers with the same digits in the XOR operation are executed in a loop until the maximum value of m is reached. The final H nm Marked as Y n ;

[0033] Calculate P when m is an odd number m The sum of , marked as ONA, calculates P when m is an even number m The sum of , marked as ENA;

[0034] For any Y n , if n is an odd number, calculate Y n +ONA-ENA, if n is an even number, calculate Y n -ONA+ENA, mark the final calculation result as T n ;

[0035] Based on ASCII encoding, T n Convert to character and sort T in ascending order of n nThe storage ciphertext of the text data is obtained by performing permutations and combinations, and is named as text ciphertext.

[0036] Furthermore, performing encryption operation on the image data using the encryption key to obtain storage ciphertext and storing the storage ciphertext includes the following sub-steps:

[0037] Convert the video data into image data corresponding to each frame and perform encryption operation on the image data;

[0038] For any image data, obtain the RGB three-channel color value of the pixel in the image data, where the RGB three-channel color value includes R, G and B;

[0039] Mark the encryption key as W, calculate W%255, and mark the result as V1;

[0040] Count the total number of times each digit in R appears in the encryption key, marked as V2;

[0041] Count the total number of times each digit in G appears in the encryption key, marked as V3;

[0042] The R of the pixel point is changed to R+V1, G is changed to G+V2, and B is changed to B+V3. The RGB three-channel color values in each pixel are modified to obtain the storage ciphertext of the image data, which is named image ciphertext. The storage ciphertext of the image data is obtained by combining all the corresponding image ciphertexts into a video.

[0043] Furthermore, generating a key ID based on the stored ciphertext and the encryption key and storing the key ID includes the following sub-steps:

[0044] The decimal number corresponding to the ciphertext is named as the ID sequence;

[0045] Generate a grayscale sequence for the image ciphertext in the same way as generating a grayscale sequence, and name it ID sequence;

[0046] The ID sequence of the image data shall be based on the ID sequence of the image ciphertext of the first frame;

[0047] Number each digit in the ID sequence and mark it as K from left to right h , where h is a positive integer and h is the serial number of K;

[0048] Get U j , and set F j , start the analysis with h=1 and judge U j With K h Are they equal? If so, record F j is h, if not, add h+1 and judge again;

[0049] For each U j Analyze and get the corresponding F j , in order of j from small to large, F j The key ID is obtained by combining and storing the key ID.

[0050] Furthermore, when a user needs to access the stored ciphertext in the mobile storage terminal, the user identity is first authenticated. After the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted, including the following sub-steps:

[0051] When a user needs to access the stored ciphertext in the mobile storage terminal, the user's identity is verified through identity information verification technology;

[0052] If the verification fails, access is prohibited. If the verification succeeds, the encryption key is restored through the key ID and the stored ciphertext, and then the plaintext corresponding to the stored ciphertext is decrypted using the stored ciphertext and the encryption key.

[0053] In a second aspect, the present application provides an electronic device comprising a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the above method are performed.

[0054] In a third aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.

[0055] Beneficial effects of the present invention: The present invention obtains data to be encrypted, including text data and image data, generates a key generation sequence based on the text data and image data, and simultaneously generates a unique encryption key for the data to be encrypted based on the key generation sequence. The advantage of the present invention is that a unique encryption key is generated for the data to be encrypted, so that the encryption key of each piece of data to be encrypted is different, and all stored ciphertexts cannot be decrypted using a single encryption key, thereby significantly improving the security and effectiveness of encrypted storage of data on mobile terminals.

[0056] The present invention performs encryption operations on text data and image data through an encryption key to obtain a stored ciphertext and store the stored ciphertext, and then generates a key ID based on the stored ciphertext and the encryption key and stores the key ID. The advantage is that after the encryption operation is completed, the encryption key is combined with the stored ciphertext to generate a key ID, and then the encryption key is deleted. At this time, the encryption key is in an unknown state and does not exist in any storage device or in the hands of the user. It can only be restored from the corresponding stored ciphertext through the key ID, which greatly improves the security of the encryption key and further improves the security and effectiveness of the encrypted storage of mobile terminal data. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 is a flow chart of the steps of the method of the present invention;

[0058] Figure 2 A flowchart of the steps of encrypting and storing data according to the present invention;

[0059] Figure 3 Flowchart of the steps for generating encryption keys of the present invention. DETAILED DESCRIPTION

[0060] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0061] Example 1, please refer to Figure 1 As shown, the present application provides a data encryption storage method for a mobile storage terminal, comprising the following steps:

[0062] See also Figures 2 to 3 As shown, step S1, obtains the data to be encrypted, and generates a unique encryption key based on the data to be encrypted. The data to be encrypted includes text data and image data. Step S1 includes the following sub-steps:

[0063] Step S101: obtaining data to be stored in a mobile storage terminal, which is named as data to be encrypted. The data to be encrypted includes text data and image data. The image data includes picture data and video data.

[0064] In the specific implementation, the data is encrypted and stored by Figure 2 As shown, Figure 3 The detailed steps for generating an encryption key are shown. Since the binary code of the data to be encrypted is long in the computer, it is not conducive to the explanation in this embodiment. In this embodiment, only a very small number of words of data to be encrypted are used as an example for illustration. Assume that the data to be encrypted in this embodiment is "height" without quotation marks.

[0065] Step S102, generating a key generation sequence based on the text data and the image data;

[0066] Step S102 includes the following sub-steps:

[0067] Step S102.1: For text data, the binary code corresponding to the text data in the computer is named as a key generation sequence;

[0068] Step S102.2: If the data to be stored is video data, obtain the first frame of the video data and name it the first frame picture. The first frame picture belongs to the picture data.

[0069] Step S102.3, performing grayscale processing on the image data to obtain a grayscale image;

[0070] Step S102.4, obtaining the grayscale values of the first row of pixels in the grayscale image, and arranging and combining the grayscale values in order of the pixels from left to right to obtain a grayscale sequence of the grayscale image;

[0071] Step S102.5, naming the binary code corresponding to the grayscale sequence in the computer as a key generation sequence;

[0072] In a specific implementation, the data to be encrypted "height" is text data, and the corresponding key generation sequence is 111010001011101010101011111010011010101110011000. For image data, for example, the grayscale value of the first pixel in the first row is 242, and the grayscale value of the second pixel in the first row is 158, so the grayscale sequence is 242158, and so on. The binary code corresponding to 242158 is 001100100011010000110010001100010011010100111000, which is the key generation sequence;

[0073] Step S103, generating a unique encryption key for the data to be encrypted based on the key generation sequence;

[0074] Step S103 includes the following sub-steps:

[0075] Step S103.1, count the number of digits in the key generation sequence and name it as sequence digits;

[0076] Step S103.2: Set a first digit threshold, remove the digits after the first digit threshold in the key generation sequence, so that the number of sequence digits is equal to the first digit threshold, and name the retained key generation sequence the standard generation sequence;

[0077] Step S103.3: Number the numbers in the standard generation sequence and mark them as N in order from left to right. i , where i is a positive integer and i is the sequence number of N, 1≤i≤the first digit threshold;

[0078] In a specific implementation, taking the key generation sequence 11101000101110101010101011111010011010101110011000 of the text data in this embodiment as an example, the number of sequence bits is 48. There is no fixed requirement for setting the first digit threshold. The larger the first digit threshold, the longer the encryption key, and vice versa. In this embodiment, for the convenience of explanation, the first digit threshold is set to 10, and all the numbers after the 10th digit in the key generation sequence are removed, and the standard generation sequence is 1110100010, and the numbers N1 to N are obtained. 10 ;

[0079] Step S103.4, set the number P j , j is a positive integer and j is the serial number of P, j is initially 1, and the analysis starts from i=1 to determine N i Is it 1? If so, set P j Set it to i, add one to i and j and judge again. If not, add one to i and judge again until each N i Until the judgment is completed;

[0080] Step S103.5: Count the P j , for P j Make the changes, keeping only P j The unit digit in the j ;

[0081] Step S103.6: In the order of j from small to large, j Combined into a string of numbers, named encryption key;

[0082] In a specific implementation, when i=1, N1 is 1, P1 is set to 1, i and j are increased by 1 at the same time, N2 is 1, P2 is set to 2, i and j are increased by 1 at the same time, N3 is 1, P3 is set to 3, i and j are increased by 1 at the same time, N4 is 0, i is increased by one, N5 is 1, P4 is set to 5, and so on. Finally, P1 to P5 are 1, 2, 3, 5 and 9 respectively, and the final encryption key is 12359. Assuming that P6 is 12, only the digits are retained, and U6 is 2. Under normal circumstances, the setting of the first digit threshold will be maintained at around 100, so that the encryption key has more bits and higher complexity.

[0083] Step S2, encrypting the text data using the encryption key to obtain a stored ciphertext and storing the stored ciphertext; Step S2 includes the following sub-steps:

[0084] Step S201, obtaining text data, and naming the binary code corresponding to the text data in the computer as the text code;

[0085] Step S202: In the text code, each 8-bit binary number is a byte. The bytes in the text code are numbered from left to right. n Indicates, where n is a positive integer and n is the sequence number of X;

[0086] Step S203: Name the binary code corresponding to the encryption key in the computer as the key code, number the bytes in the key code, and mark them as P in order from left to right. m , where m is a positive integer and m is the serial number of P;

[0087] In a specific implementation, the text code is 1110100010111010101010101111101001101010101110011000, and the numbers X1 to X6 are 11101000, 10111010, 10101011, 11101001, 10101011, and 10011000, respectively. The key code is 0011000100110010001100110011010100111001, and the numbers P1 to P5 are 00110001, 00110010, 00110011, 00110101, and 00111001, respectively.

[0088] Step S204: for any X n , start the analysis with m=1, and set X n With P m Perform XOR operation on the numbers with the same digits in the result to get H nm , H nm Represents X n With P m Perform the XOR operation on the result, add one to m and add H nm With P m The numbers with the same digits in the XOR operation are executed in a loop until the maximum value of m is reached. The final H nm Marked as Y n ;

[0089] In a specific implementation, taking X1 as an example, X1 and P1 are XORed, where X1 is 11101000, P1 is 00110001, the first digit to the eighth digit of X1 are 1, 1, 1, 0, 1, 0, 0, and 0 respectively, and the first digit to the eighth digit of P1 are 0, 0, 1, 1, 0, 0, 0, and 1 respectively, where the third digit, the sixth digit, and the seventh digit are equal, and the remaining digits are not equal, thus obtaining H. 11 is 11011001, at this time n and m are both 1, and then H11 Perform XOR operation with P2 to get H 12 , then H 12 XOR operation with P3 to get H 13 , and so on, we finally get H 15 That is, Y1 is specifically 11010100. Similarly, Y2 to Y6 are calculated to be 10000110, 10010111, 11010101, 10010111 and 10100100 respectively.

[0090] Step S205, calculate P when m is an odd number m The sum of , marked as ONA, calculates P when m is an even number m The sum of , marked as ENA;

[0091] Step S206, for any Y n , if n is an odd number, calculate Y n +ONA-ENA, if n is an even number, calculate Y n -ONA+ENA, mark the final calculation result as T n ;

[0092] Step S207: Encode T based on ASCII code. n Convert to character and sort T in ascending order of n n Perform permutations and combinations to obtain the stored ciphertext of the text data, which is named as text ciphertext;

[0093] In the specific implementation, P1+P3+P5=ONA=10011101 is calculated, and P2+P4=ENA=01100111 is calculated. Taking Y1 as an example, n=1, n is an odd number, and Y1+ONA-ENA is calculated to obtain T1 as 100001010. At this time, T1 is 9 bits, and T1 needs to be changed to 8 bits to form a complete byte. Therefore, T1 is subtracted by 100000000. If the calculation result is a negative number, it is increased by 100000000. The same is true for decryption, and the final T1 is 00001010. Similarly, T2 to T6 are 01010000, 11001101, 10011111, 11001101 and 01101110. Converting to characters, T1 to T6 are P, And n, that is, the ciphertext is

[0094] Step S3, performing encryption operation on the image data using the encryption key to obtain storage ciphertext and storing the storage ciphertext; Step S3 includes the following sub-steps:

[0095] Step S301, converting the video data into image data corresponding to each frame, and performing encryption operation on the image data;

[0096] Step S302: for any image data, obtain the RGB three-channel color value of the pixel in the image data, where the RGB three-channel color value includes R, G, and B;

[0097] Step S303, mark the encryption key as W, calculate W%255, and mark the calculation result as V1;

[0098] Step S304, counting the total number of times each digit in R appears in the encryption key, marked as V2;

[0099] Step S305, counting the total number of times each digit in G appears in the encryption key, marked as V3;

[0100] Step S306: Change the R value of the pixel to R+V1, G value to G+V2, and B value to B+V3. Modify the RGB color values of each pixel to obtain the storage ciphertext of the image data, which is named as the image ciphertext. The storage ciphertext of the image data is obtained by combining all the corresponding image ciphertexts into a video.

[0101] In a specific implementation, for example, the R, G, and B values of a certain pixel are 122, 148, and 255 respectively. Taking the encryption key 12359 as an example, W is 12359, and the calculated V1 is 119, R is 119, and the three digits are 1, 1, and 9 respectively. The sum of the number of times 1 and 9 appear in the encryption key is counted, and the obtained V2 is 2. Although the encryption key listed in this embodiment is too short, the obtained V2 is small. However, in actual application, the encryption key length is longer, and the calculated V2 will increase. G is 1. 48, the three digits are 1, 4 and 8 respectively. The sum of the number of times 1, 4 and 8 appear in the encryption key is counted, and V3 is obtained to be 1. Finally, the R of the pixel point is changed to 119+119=238, G is changed to 148+2=150, and B is changed to 255+1=256. Since 256 is greater than the maximum color value of 255, it is reduced by 255, and B is changed to 1. Similarly, if the color value is less than 0, it is increased by 255. By changing each pixel in the image data, the image ciphertext can be obtained.

[0102] Step S4: Generate a key ID based on the stored ciphertext and the encryption key and store the key ID. Step S4 includes the following sub-steps:

[0103] Step S401, naming the decimal number corresponding to the ciphertext as an ID sequence;

[0104] Step S402: Generate a grayscale sequence for the image ciphertext in the same manner as that for generating a grayscale sequence, and name it ID sequence;

[0105] Step S403: The ID sequence of the image data is based on the ID sequence of the first frame's ciphertext.

[0106] Step S404: Number each digit in the ID sequence and mark them as K from left to right. h , where h is a positive integer and h is the serial number of K;

[0107] Step S405, obtain U j , and set F j , start the analysis with h=1 and judge U j With K h Are they equal? If so, record F j is h, if not, add h+1 and judge again;

[0108] Step S406: for each U j Analyze and get the corresponding F j , in order of j from small to large, F j Combine to obtain the key ID and store the key ID;

[0109] In the specific implementation, the ID sequence is the T of the ciphertext. n The corresponding decimal numbers, T1 to T6 are 00001010, 01010000, 11001101, 10011111, 11001101 and 01101110, and the corresponding decimal numbers are 10, 80, 205, 159, 205 and 110 respectively, so the ID sequence is 1080205159205110, and the numbers K1 to K 16 , U1 to U5 are 1, 2, 3, 5 and 9 respectively. Through the analysis of step S405, F1 to F5 are 1, 5, U3, 7 and 10 respectively. Among them, U3 cannot be found in the ID sequence. This is because in this embodiment, for the convenience of illustration, all the listed data are reduced, so that the number of digits in the ID sequence is small. Under normal circumstances, the number of digits in the ID sequence is long and can definitely contain every digit from 0 to 9. Here, it is assumed that F3 is 50, and F j Convert to binary numbers in ASCII code. In ASCII code, F1 to F5 are 00000001, 00000101, 01010000, 00000111 and 00010000 respectively. The key DI is 0000000100000101010100000000011100010000. The key ID and the corresponding stored ciphertext are stored in the same path.

[0110] Step S5: When a user needs to access the stored ciphertext in the mobile storage terminal, the user is authenticated first. After the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted. Step S5 includes the following sub-steps:

[0111] Step S501: When a user needs to access the stored ciphertext in the mobile storage terminal, the user's identity is verified through identity information verification technology;

[0112] Step S502: If the verification fails, access is prohibited. If the verification succeeds, the encryption key is restored using the key ID and the stored ciphertext, and then the plaintext corresponding to the stored ciphertext is decrypted using the stored ciphertext and the encryption key.

[0113] In the specific implementation, the user's identity information is verified through existing identity information verification technologies, including but not limited to face recognition, fingerprint recognition, password login, and verification code login technologies. It is necessary to ensure that at least two identity information verification technologies are used at the same time to verify the user. Since restoring the encryption key through the key ID and stored ciphertext is actually the reverse procedure for generating the key ID, and restoring the plaintext through the stored ciphertext and encryption key is actually the reverse procedure for generating the stored ciphertext, no specific explanation will be given in this embodiment.

[0114] In Example 2, the present application further provides an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in a data encryption storage method for a mobile storage terminal are executed to implement the following functions: obtaining data to be encrypted, generating a unique encryption key based on the data to be encrypted; performing encryption operations on text data using the encryption key; performing encryption operations on image data using the encryption key; generating a key ID based on stored ciphertext and the encryption key; when a user needs to access stored ciphertext in the mobile storage terminal, the user is first authenticated, and after the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted.

[0115] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0116] Example 3. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the data encryption storage method of the mobile storage terminal are executed to achieve the following functions: obtaining the data to be encrypted, generating a unique encryption key based on the data to be encrypted; performing encryption operations on text data using the encryption key; performing encryption operations on image data using the encryption key; generating a key ID based on the stored ciphertext and the encryption key; when a user needs to access the stored ciphertext in the mobile storage terminal, the user is first authenticated, and after the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted.

[0117] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on this understanding, the above technical solutions, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.

[0118] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data encryption storage method for a mobile storage terminal, characterized in that: The steps include: Acquire data to be encrypted, and generate a unique encryption key based on the data to be encrypted, wherein the data to be encrypted includes text data and image data; Perform encryption operation on text data using an encryption key to obtain a stored ciphertext and store the stored ciphertext; Perform encryption operation on the image data using the encryption key to obtain storage ciphertext and store the storage ciphertext; Generate a key ID based on the stored ciphertext and the encryption key and store the key ID; When a user needs to access the stored ciphertext in the mobile storage terminal, the user's identity is authenticated first. After the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted.

2. The data encryption storage method of a mobile storage terminal according to claim 1, characterized in that: Obtaining the data to be encrypted and generating a unique encryption key based on the data to be encrypted includes the following sub-steps: Acquire data to be stored in a mobile storage terminal, named as data to be encrypted, wherein the data to be encrypted includes text data and image data, and the image data includes picture data and video data; generating a key generation sequence based on the text data and the image data; Generates a unique encryption key for the data to be encrypted based on the key generation sequence.

3. The data encryption storage method of a mobile storage terminal according to claim 2, characterized in that: Generating a key generation sequence based on text data and image data includes the following sub-steps: For text data, the binary code corresponding to the text data in the computer is named the key generation sequence; If the data to be stored is video data, then the first frame of the video data is obtained and named as the first frame image, and the first frame image belongs to the image data; For the image data, grayscale processing is performed on the image data to obtain a grayscale image; Obtain the grayscale values of the first row of pixels in the grayscale image, and arrange and combine the grayscale values in the order of the pixels from left to right to obtain the grayscale sequence of the grayscale image; The binary code corresponding to the grayscale sequence in the computer is named the key generation sequence.

4. The data encryption storage method of a mobile storage terminal according to claim 3, characterized in that: Generating a unique encryption key for the data to be encrypted based on the key generation sequence includes the following sub-steps: The number of digits in the key generation sequence is counted and named as the sequence digits; Set the first digit threshold and remove the digits after the first digit threshold in the key generation sequence so that the number of sequence digits is equal to the first digit threshold. The retained key generation sequence is named the standard generation sequence. Number the numbers in the standard generation sequence and mark them as N from left to right i , where i is a positive integer and i is the sequence number of N, 1≤i≤the first digit threshold; Set the number P j , j is a positive integer and j is the serial number of P, j is initially 1, and the analysis starts from i=1 to determine N i Is it 1? If so, set P j Set it to i, add one to i and j and judge again. If not, add one to i and judge again until each N i Until the judgment is completed; The statistically obtained P j , for P j Make the changes, keeping only P j The unit digit in the j ; In order of j from small to large, U j The combination is formed into a string of numbers, which is named as encryption key.

5. The data encryption storage method of a mobile storage terminal according to claim 4, characterized in that: Encrypting text data using an encryption key to obtain stored ciphertext and storing the stored ciphertext includes the following sub-steps: Obtaining text data, and naming the binary code corresponding to the text data in the computer as the text code; In the text code, each 8-bit binary digit is a byte, and the bytes in the text code are numbered from left to right. n Indicates, where n is a positive integer and n is the sequence number of X; The binary code corresponding to the encryption key in the computer is named the key code, and the bytes in the key code are numbered and marked as P in order from left to right. m , where m is a positive integer and m is the serial number of P; For any X n , start the analysis with m=1, and set X n With P m Perform XOR operation on the numbers with the same digits in the result to get H nm , H nm Represents X n With P m Perform the XOR operation on the result, add one to m and add H nm With P m The numbers with the same digits in the XOR operation are executed in a loop until the maximum value of m is reached. The final H nm Marked as Y n ; Calculate P when m is an odd number m The sum of , marked as ONA, calculates P when m is an even number m The sum of , marked as ENA; For any Y n , if n is an odd number, calculate Y n +ONA-ENA, if n is an even number, calculate Y n -ONA+ENA, mark the final calculation result as T n ; Based on ASCII encoding, T n Convert to character and sort T in ascending order of n n The storage ciphertext of the text data is obtained by performing permutations and combinations, and is named as text ciphertext.

6. The data encryption storage method of a mobile storage terminal according to claim 5, characterized in that: Performing encryption operation on image data using an encryption key to obtain storage ciphertext and storing the storage ciphertext includes the following sub-steps: Convert the video data into image data corresponding to each frame and perform encryption operation on the image data; For any image data, obtain the RGB three-channel color value of the pixel in the image data, where the RGB three-channel color value includes R, G and B; Mark the encryption key as W, calculate W%255, and mark the result as V1; Count the total number of times each digit in R appears in the encryption key, marked as V2; Count the total number of times each digit in G appears in the encryption key, marked as V3; The R of the pixel point is changed to R+V1, G is changed to G+V2, and B is changed to B+V3. The RGB three-channel color values in each pixel are modified to obtain the storage ciphertext of the image data, which is named image ciphertext. The storage ciphertext of the image data is obtained by combining all the corresponding image ciphertexts into a video.

7. The data encryption storage method of a mobile storage terminal according to claim 6, characterized in that: Generating a key ID based on the stored ciphertext and the encryption key and storing the key ID includes the following sub-steps: The decimal number corresponding to the ciphertext is named as the ID sequence; Generate a grayscale sequence for the image ciphertext in the same way as generating a grayscale sequence, and name it ID sequence; The ID sequence of the image data shall be based on the ID sequence of the image ciphertext of the first frame; Number each digit in the ID sequence and mark it as K from left to right h , where h is a positive integer and h is the serial number of K; Get U j , and set F j , start the analysis with h=1 and judge U j With K h Are they equal? If so, record F j is h, if not, add h+1 and judge again; For each U j Analyze and get the corresponding F j , in order of j from small to large, F j The key ID is obtained by combining and storing the key ID.

8. The data encryption storage method of a mobile storage terminal according to claim 7, characterized in that: When a user needs to access the stored ciphertext in a mobile storage terminal, the user is authenticated first. After the authentication is passed, the encryption key is restored using the key ID and the stored ciphertext and the stored ciphertext is decrypted, including the following sub-steps: When a user needs to access the stored ciphertext in the mobile storage terminal, the user's identity is verified through identity information verification technology; If the verification fails, access is prohibited. If the verification succeeds, the encryption key is restored through the key ID and the stored ciphertext, and then the plaintext corresponding to the stored ciphertext is decrypted using the stored ciphertext and the encryption key.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 8 are executed.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are executed.

Citation Information

Patent Citations

  • Mobile terminal and data encryption method thereof

    CN113297615A

Cited By

  • Data management method and system for multi-user encrypted mobile storage medium

    CN121071906A

  • A data management method and system for multi-user encrypted mobile storage media

    CN121071906B