A cloud encryption file key update method based on SM9 encryption algorithm
By re-encrypting cloud storage files without decryption in the cloud, the problem of cumbersome update process and insufficient security is solved, and efficient and secure cloud encryption file key update is achieved.
Patent Information
- Application Number
- CN202411073947.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-07
AI Technical Summary
In the prior art, the encryption key update process of cloud storage files is cumbersome, occupies a large amount of bandwidth resources and time, and the encrypted files stored in the cloud need to be decrypted and then encrypted, which increases security risks.
The cloud encrypted file key update method based on SM9 encryption algorithm is adopted. The user-side device generates a new key and sends relevant parameters to the cloud server. The cloud server reencrypts the encrypted file without decryption and generates a new encrypted file. , replace the original file.
It realizes seamless key updates, ensures that files are always encrypted, reduces the risk of plaintext exposure, improves the security and efficiency of cloud-encrypted files, and reduces computing resource consumption.
Smart Images

Figure CN118611986B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a cloud encryption file key updating method based on an SM9 encryption algorithm. Background Art
[0002] Cloud storage allows users to store data on remote cloud servers. Users can not only reduce the pressure on local storage space, but also access data stored in the cloud anytime and anywhere. Cloud storage is of great significance to the data stored by users, such as data backup, data assistance, and data expansion. However, in recent years, some system vulnerabilities, such as the Log4j vulnerability (also known as the Apache Log4j 2 vulnerability, which is a serious security vulnerability), have made cloud storage less secure. The security issues of cloud storage have also caused some users to encrypt data before uploading it, so that the data stored in the cloud is encrypted data, ensuring that the data will not be leaked when there is a vulnerability in the cloud service, thereby improving the security of cloud storage data.
[0003] However, for an encryption algorithm, if the key of the encryption algorithm remains unchanged for a long time and the same key is always used, the probability of information leakage will increase. Regularly changing the encryption key can reduce the risk of information leakage. For local files, users only need to decrypt the file and re-encrypt it. However, for cloud storage files, users need to download the encrypted data file from the cloud, then decrypt it, re-encrypt the data with a new key, and finally upload the re-encrypted data. The whole process is too cumbersome and requires a lot of bandwidth resources and waiting time for users and cloud services. Summary of the invention
[0004] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a cloud encrypted file key updating method based on the SM9 encryption algorithm.
[0005] In order to achieve the above object, the main technical solutions adopted by the present invention include:
[0006] An embodiment of the present invention provides a cloud encrypted file key update method based on the SM9 encryption algorithm, comprising:
[0007] S1. When the encrypted file needs to change the key again, the user terminal device generates a first key based on the public parameters pre-set by the user;
[0008] Wherein, the encrypted file is stored in a cloud server;
[0009] The encrypted file is obtained by encrypting the original file using the initial public key;
[0010] Among them, the initial secret key and the initial public key are obtained in advance based on the public parameters set by the user;
[0011] S2. The user terminal device generates relevant parameters for re-encrypting the encrypted file based on the public parameters and / or the first information, and sends the relevant parameters to the cloud server;
[0012] The first information includes an initial key and an encrypted file;
[0013] S3. The cloud server re-encrypts the encrypted file without decrypting it using relevant parameters, generates a new encrypted file, and stores the new encrypted file to replace the previous one.
[0014] Preferably, the method further comprises:
[0015] S4. When the user needs to access the cloud server, the user terminal device downloads a new encrypted file from the cloud server and uses the first key to decrypt the new encrypted file to obtain the original file.
[0016] Preferably,
[0017] The public parameters include: the master key d set by the user m ; The base point P1 of the G1 elliptic curve in the SM9 encryption algorithm; The identifier id corresponding to the initial key, id=1; The one-byte identifier hid pre-selected by the user; The integers r1 and r2 randomly selected by the user within the first range;
[0018] The first range is (1, N-1);
[0019] Among them, d m ∈(1,N-1);N is a large prime number in the SM9 encryption algorithm.
[0020] Preferably,
[0021] The initial public key is calculated by formula (1);
[0022] The formula (1) is: ;
[0023] Among them, P m is the initial public key;
[0024] The initial key is calculated by formula (2);
[0025] The formula (2) is: ;
[0026] Among them, d1 is the initial key; ;
[0027] ;
[0028] Hash(·)is a hash function;
[0029] || represents a concatenation operation.
[0030] Preferably, the encrypted file is obtained by encrypting the original file based on the initial public key, specifically including:
[0031] The encrypted file is obtained by encrypting the original file based on the initial public key using formula (3);
[0032] Wherein, the formula (3) is:
[0033] ;
[0034] C is the encrypted file;
[0035] in, ;
[0036] ;
[0037] Represents the exclusive OR operation;
[0038] M is the original file;
[0039] ;
[0040] KDF() is the key derivation function in the SM9 encryption algorithm;
[0041] K1 is a bit string in K with the same length as the original file M;
[0042] K2 is a bit string in K that has the same length as the preset group key;
[0043] klen is the length of K, and the value of klen is the sum of the original file length and the group key length;
[0044] ;
[0045] , where e(·) is the bilinear pair mapping function;
[0046] P2 is the base point of the G2 elliptic curve in the SM9 encryption algorithm;
[0047] ;
[0048] .
[0049] Preferably, the first key in S2 is calculated by formula (4);
[0050] The formula (4) is: ;
[0051] in, is the first key;
[0052] ;
[0053] ;
[0054] .
[0055] Preferably,
[0056] The relevant parameters in S3 include ;
[0057] in, ;
[0058] ;
[0059] for A bit string with the same length as the original file M;
[0060] for A bit string having the same length as the preset group key;
[0061] for Length, The value of is the sum of the original file length and the group key length;
[0062] ;
[0063] ;
[0064] .
[0065] Preferably,
[0066] In S3, variable K1 is saved in the user terminal device or is calculated by the user terminal device based on the encrypted file and the initial key obtained from the cloud server using formula (5);
[0067] The formula (5) is:
[0068] ;
[0069] K1 is a bit string in K with the same length as the original file M;
[0070] in, .
[0071] Preferably,
[0072] The new encrypted file in S4 is calculated based on the encrypted file C and the related parameters using formula (6);
[0073] Wherein, the formula (6) is:
[0074] ;
[0075] in, ;
[0076] ;
[0077] For new encrypted files.
[0078] Preferably, the S5 specifically includes:
[0079] S51, the user terminal device is based on the new encrypted file , get the variable ,variable ,variable ;
[0080] S52, based on variables ,variable , use formula (7) to calculate the original file;
[0081] Wherein, the formula (7) is:
[0082] ;
[0083] in, ;
[0084] in for A bit string with the same length as the original file M;
[0085] for Length;
[0086] .
[0087] The beneficial effects of the present invention are as follows: the cloud encrypted file key update method based on the SM9 encryption algorithm of the present invention ensures that the original file is always in an encrypted state, and prevents the risk of plain text exposure, because the re-encryption operation can be performed without decrypting the file in the cloud. The cloud server directly re-encrypts the encrypted file through relevant parameters, without decrypting it first and then encrypting it, realizing seamless key update, and realizing efficient, secure and transparent cloud encrypted file key update, which has significant advantages. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 This is a flow chart of a cloud encrypted file key update method based on the SM9 encryption algorithm of the present invention;
[0089] Figure 2 The present invention is a flowchart of a cloud encrypted file key update method based on the SM9 encryption algorithm in an embodiment of the present invention. DETAILED DESCRIPTION
[0090] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.
[0091] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0092] The SM9 encryption algorithm is an identity-based public key encryption algorithm based on elliptic curves and bilinear pairings issued by the State Cryptography Administration. It is widely used in various fields such as finance, e-mail, e-commerce, and mobile communications.
[0093] See attached Figure 1 This embodiment provides a cloud encrypted file key update method based on the SM9 encryption algorithm, including:
[0094] S1. When the encrypted file needs to change the key again, the user terminal device generates a first key based on the public parameters pre-set by the user;
[0095] Wherein, the encrypted file is stored in a cloud server;
[0096] The encrypted file is obtained by encrypting the original file using the initial public key;
[0097] Among them, the initial secret key and the initial public key are obtained in advance based on the public parameters set by the user;
[0098] S2. The user terminal device generates relevant parameters for re-encrypting the encrypted file based on the public parameters and / or the first information, and sends the relevant parameters to the cloud server;
[0099] The first information includes an initial key and an encrypted file;
[0100] S3. The cloud server re-encrypts the encrypted file without decrypting it using relevant parameters, generates a new encrypted file, and stores the new encrypted file to replace the previous one.
[0101] See attached Figure 2 , the method described in this embodiment also includes:
[0102] S4. When the user needs to access the cloud server, the user terminal device downloads a new encrypted file from the cloud server and uses the first key to decrypt the new encrypted file to obtain the original file.
[0103] In the whole process of the cloud encrypted file key update method based on the SM9 encryption algorithm implemented in this paper, the cloud server does not need to decrypt the file to complete the re-encryption operation, ensuring that the file content is always encrypted. In this way, any data stored on the cloud server cannot be directly read even if it is obtained by an attacker.
[0104] Users can update the keys of encrypted files at any time without affecting the normal access to the files. This can deal with security issues such as key leakage and key expiration. The user-end device can generate keys based on pre-set public parameters, reducing the complexity of key distribution and management and improving the efficiency of key management. The cloud server can directly re-encrypt the file based on relevant parameters without decrypting the file. This process is transparent to the user and does not require user intervention. In addition, since the cloud server only needs to perform re-encryption operations without decrypting and re-encrypting the entire file, the consumption of computing resources is reduced, especially when processing a large number of files. Users only need to generate relevant parameters and send them to the cloud server when they need to change the key. The operation is simple and does not require complicated operation steps. The key update process is transparent in the cloud and will not interrupt or affect the user's normal access and use of encrypted files.
[0105] In the specific application of this embodiment, the public parameters include: the master key d set by the user m ; The base point P1 of the G1 elliptic curve in the SM9 encryption algorithm; The identifier id corresponding to the initial key, id=1; The one-byte identifier hid pre-selected by the user; The integers r1 and r2 randomly selected by the user within the first range;
[0106] The first range is (1, N-1);
[0107] Among them, d m ∈(1,N-1);N is a large prime number in the SM9 encryption algorithm.
[0108] The SM9 encryption algorithm is an identity-based encryption algorithm with high security. It adopts the national encryption standard and can effectively prevent various encryption attacks.
[0109] In this embodiment, the master key d set by the user m is an integer in the range (1, N−1), where N is a large prime number in the SM9 encryption algorithm. m It is the core key of the entire encryption system and is used to generate other related keys and parameters to ensure the security of the encryption and decryption process.
[0110] The G1 elliptic curve base point P1 in the SM9 algorithm is a predefined elliptic curve point belonging to the elliptic curve G1. The base point P1 is a basic element in the key generation and encryption process, used to calculate the public key and other related parameters. The identifier id is an identifier corresponding to the initial key. In this example, id=1. The identifier id is used to uniquely identify the user's initial key to ensure the uniqueness and security of the key generation and encryption process. The one-byte identifier hid pre-selected by the user. The identifier hid is an identifier used to distinguish different encryption operations or key types to ensure the flexibility and security of the encryption process.
[0111] Two integers r1 and r2 randomly selected by the user in the first range (1, N−1). They play a role in enhancing security in the key generation and encryption process, preventing the key from being predicted or cracked by increasing randomness.
[0112] Specifically, the initial public key is calculated by formula (1);
[0113] The formula (1) is: ;
[0114] Among them, P m is the initial public key;
[0115] The initial key is calculated by formula (2);
[0116] The formula (2) is: ;
[0117] Among them, d1 is the initial key; ;
[0118] ;
[0119] Hash(·)is a hash function;
[0120] || represents a concatenation operation.
[0121] In the actual application of this implementation, the encrypted file is obtained by encrypting the original file based on the initial public key, specifically including:
[0122] The encrypted file is obtained by encrypting the original file based on the initial public key using formula (3);
[0123] Wherein, the formula (3) is:
[0124] ;
[0125] C is the encrypted file;
[0126] in, ;
[0127] ;
[0128] Represents the exclusive OR operation;
[0129] M is the original file;
[0130] ;
[0131] KDF() is the key derivation function in the SM9 encryption algorithm;
[0132] K1 is a bit string in K with the same length as the original file M;
[0133] K2 is a bit string in K that has the same length as the preset group key;
[0134] klen is the length of K, and the value of klen is the sum of the original file length and the group key length;
[0135] ;
[0136] , where e(·) is the bilinear pair mapping function;
[0137] P2 is the base point of the G2 elliptic curve in the SM9 encryption algorithm; in this embodiment, the G2 elliptic curve is a specific mathematical curve used to define an elliptic curve group over a finite field. P2 is a specific point on the G2 elliptic curve and is selected as the generator of the elliptic curve, that is, all points in G2 are generated by repeated addition operations.
[0138] ;
[0139] .
[0140] Through the above formula, the encryption file generation method based on the initial public key ensures the security and integrity of the original file. By combining bilinear pair mapping, hash function and random numbers, the encrypted file has high security during storage and transmission, while ensuring the dynamic update and management function of the key.
[0141] Specifically, the first key in S2 is calculated by formula (4);
[0142] The formula (4) is: ;
[0143] in, is the first key;
[0144] ;
[0145] ;
[0146] .
[0147] In the specific application of this embodiment, the relevant parameters in S3 include ;
[0148] in, In this embodiment, an XOR operation is performed to ensure the integrity and security of the data and avoid direct transmission of the key.
[0149] ;
[0150] for A bit string with the same length as the original file M;
[0151] for A bit string having the same length as the preset group key;
[0152] for Length, The value of is the sum of the original file length and the group key length;
[0153] In this embodiment, exponential operation is used to improve security, making the generated key more difficult to crack.
[0154] ;
[0155] .
[0156] In this embodiment, in S3, the variable K1 is saved in the user terminal device or is calculated by the user terminal device based on the encrypted file and the initial key obtained from the cloud server using formula (5);
[0157] The formula (5) is:
[0158] ;
[0159] K1 is a bit string in K with the same length as the original file M;
[0160] in, .
[0161] Specifically, the new encrypted file in S4 is calculated based on the encrypted file C and the related parameters using formula (6);
[0162] Wherein, the formula (6) is:
[0163] ;
[0164] in, ;
[0165] ;
[0166] For new encrypted files.
[0167] Wherein, the S5 specifically includes:
[0168] S51, the user terminal device is based on the new encrypted file , get the variable ,variable ,variable ;
[0169] S52, based on variables ,variable , use formula (7) to calculate the original file;
[0170] Wherein, the formula (7) is:
[0171] ;
[0172] in, ;
[0173] in for A bit string with the same length as the original file M;
[0174] for Length;
[0175] .
[0176] In the method of this embodiment, when a user changes the key of an encrypted file stored in the cloud, there is no need to download the complete encrypted file and re-encrypt and upload it after decryption, which reduces the traffic bandwidth of the user downloading the complete data and reduces the time the user waits for data download. The encrypted file can be re-encrypted by the cloud server using the relevant parameters sent by the user without decryption, and the cloud server cannot infer the plaintext of the encrypted file, which protects the user's data security and reduces the risk of data leakage.
[0177] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0178] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0179] In the present invention, unless otherwise clearly specified and limited, when a first feature is “on” or “below” a second feature, it may be that the first and second features are in direct contact, or that the first and second features are in indirect contact through an intermediate medium. Moreover, when a first feature is “above”, “above” or “above” a second feature, it may be that the first feature is directly above or obliquely above the second feature, or it may simply mean that the first feature is higher in level than the second feature. When a first feature is “below”, “below” or “below” a second feature, it may be that the first feature is directly below or obliquely below the second feature, or it may simply mean that the first feature is lower in level than the second feature.
[0180] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0181] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may alter, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A cloud encrypted file key update method based on SM9 encryption algorithm, characterized in that: include: S1. When the encrypted file needs to change the key again, the user terminal device generates a first key based on the public parameters pre-set by the user; Wherein, the encrypted file is stored in a cloud server; The encrypted file is obtained by encrypting the original file using the initial public key; Among them, the initial secret key and the initial public key are obtained in advance based on the public parameters set by the user; S2. The user terminal device generates relevant parameters for re-encrypting the encrypted file based on the public parameters and / or the first information, and sends the relevant parameters to the cloud server; The first information includes an initial key and an encrypted file; S3, the cloud server re-encrypts the encrypted file without decrypting it using relevant parameters, generates a new encrypted file, and stores the new encrypted file to replace the previous one; The method further comprises: S4. When the user needs to access the cloud server, the user terminal device downloads a new encrypted file from the cloud server and decrypts the new encrypted file using the first key to obtain the original file; The public parameters include: the master key d set by the user m ; The base point P1 of the G1 elliptic curve in the SM9 algorithm; The identifier id corresponding to the initial key, id=1; The one-byte identifier hid pre-selected by the user; The integers r1 and r2 randomly selected by the user within the first range; The first range is (1, N-1); Among them, d m ∈(1,N-1);N is a large prime number in the SM9 algorithm; The initial public key is calculated by formula (1); The formula (1) is: ; Among them, P m is the initial public key; The initial key is calculated by formula (2); The formula (2) is: ; Among them, d1 is the initial key; ; ; Hash(·)is a hash function; The encrypted file is obtained by encrypting the original file based on the initial public key, and specifically includes: The encrypted file is obtained by encrypting the original file based on the initial public key using formula (3); Wherein, the formula (3) is: ; C is the encrypted file; in, ; ; M is the original file; ; K1 is a bit string in K with the same length as the original file M; K2 is a bit string in K that has the same length as the preset group key; klen is the length of K, and the value of klen is the sum of the original file length and the group key length; ; , where e(·) is the bilinear pair mapping function; P2 is the base point of the G2 elliptic curve in the SM9 algorithm; ; ; The first key in S2 is calculated by formula (4); The formula (4) is: ; in, is the first key; ; ; ; The relevant parameters in S3 include ; in, ; ; for A bit string with the same length as the original file M; for A bit string having the same length as the preset group key; for Length, The value of is the sum of the original file length and the group key length; ; ; 。 2. The cloud encrypted file key update method based on the SM9 encryption algorithm according to claim 1 is characterized in that: In S3, variable K1 is saved in the user terminal device or is calculated by the user terminal device based on the encrypted file and the initial key obtained from the cloud server using formula (5); The formula (5) is: ; K1 is a bit string in K with the same length as the original file M; in, .
3. The cloud encrypted file key update method based on the SM9 encryption algorithm according to claim 2 is characterized in that: The new encrypted file in S4 is calculated based on the encrypted file C and the related parameters using formula (6); Wherein, the formula (6) is: ; in, ; ; For new encrypted files.
4. The cloud encrypted file key update method based on the SM9 encryption algorithm according to claim 3 is characterized in that: The S5 specifically includes: S51, the user terminal device is based on the new encrypted file , get the variable ,variable ,variable ; S52, based on variables ,variable , use formula (7) to calculate the original file; Wherein, the formula (7) is: ; in, ; in, for A bit string with the same length as the original file M; for Length; 。