Key usage management method and system based on SGX in cloud storage mode
By using Intel SGX technology to build a trusted execution environment in cloud storage mode, the challenge of key usage management is solved, the secure storage and restricted use of keys is achieved, and the confidentiality and security of data is enhanced.
Patent Information
- Application Number
- CN202011501908.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2040-12-18
AI Technical Summary
In cloud storage mode, there are challenges in secure storage and usage management of keys, especially due to the limited number of TPM hardware counters and performance bottlenecks, which lead to unlimited key usage, increasing the risk of data breaches.
Using Intel SGX technology to build a trusted execution environment on the data owner and user side, use monotonic counters to manage the number of key usage, and generate, seal, decrypt and use keys in enclave to ensure the secure storage of keys and Restricted use.
It effectively protects keys, prevents unlimited use, enhances data confidentiality and security, and improves the efficiency and user experience of key management.
Smart Images

Figure CN112613048B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer information security technology, and mainly involves managing data encryption keys based on SGX in a cloud storage mode, and utilizing SGX to achieve secure storage of keys at the data user end and limit the number of uses, thereby protecting the confidentiality of outsourced data. Background Art
[0002] As an important part of cloud computing, cloud storage focuses on providing users with online storage services based on the Internet. In the cloud storage model, storage is a service. Users do not need to consider the specific technical details such as the storage type and storage method of physical devices, as well as the availability and reliability of data. Instead, they can obtain corresponding services from cloud service providers (CSP) on demand and access their data anytime and anywhere. Cloud storage can bring opportunities in improving IT efficiency, cost savings, and green computing, but it also faces some security challenges.
[0003] In the cloud storage model, data is stored in a third-party CSP, which is out of the control of the data owner (DO). Its security is highly dependent on the CSP. Considering that the CSP is untrustworthy, in order to protect the confidentiality of the data, the DO can first encrypt the plaintext data and then store the ciphertext data at the CSP, and the key is kept by the DO itself. At this time, the secure storage and use of the key is the key to protecting the confidentiality of the data. First, the key should be securely stored on both the DO side and the data user (DU) side to prevent the confidentiality of the data from being destroyed due to key leakage. Secondly, the use of the key on the DU side should be restricted, that is, the use of the key by the DU should be controlled to prevent the security policy from being destroyed or data leakage due to the unlimited use of the key by the DU.
[0004] Patent document CN103138939B proposes a key usage management method based on a trusted platform module in a cloud storage mode. A trusted platform module TPMo, a key management daemon module KMD and an encryption module DE are set on the data owner Owner side, and a trusted platform module TPMu, a virtual counter management module VCM and a key management module KM are set on the data user User side; the data owner Owner encrypts the data and uploads the encrypted ciphertext data to the server of the cloud service provider CSP; the data user User side manages the key usage count.
[0005] This invention utilizes the key management and secure storage functions of the trusted platform module to enable secure storage and transmission of keys; it utilizes the monotonic counter function of the trusted platform module to manage and control the number of times the key is used by binding and judging the number of times the key is used with a monotonically increasing virtual counter value, thereby effectively solving the security problems caused by the unlimited use of keys.
[0006] However, its shortcomings are: first, the basis for implementing this method is the Trusted Platform Module TPM, but TPM is a chip external to the computer motherboard, and some user devices may not have a TPM chip; second, due to factors such as price and process, TPM only provides a small number of hardware counters, and the rapid and continuous update of TPM hardware counters will cause blockage and reduce program performance. Although this method uses virtual counters to solve the problem of the small number of TPM hardware counters, each update operation of the virtual counter will still update the TPM hardware counter, and there is still a significant performance degradation problem; third, in this method, the encryption and decryption of the data key is completed inside the TPM, but the use of the key to decrypt the ciphertext data from the cloud server is completed in the ordinary memory environment, and attacks from the operating system or programs with higher permissions may cause key leakage.
[0007] Therefore, the field urgently needs the emergence of new technical solutions for key usage management under the cloud storage model. Summary of the invention
[0008] The technical problem to be solved by the present invention is to provide a key usage management method and system based on SGX in a cloud storage mode, which can effectively ensure the secure storage of keys and the confidentiality of data, control and manage the use of keys by authorized users, and prevent users from destroying the confidentiality of data by using keys without protection and restriction.
[0009] The technical solution adopted by the present invention to solve the technical problem is a key usage management method based on SGX in a cloud storage mode. Based on Intel SGX technology, a trusted execution environment is built on the data owner DO end and the data user DU end respectively, and related operations of private information are performed in the security zone enclave, and other non-sensitive operations and data are performed in the REE operating system environment; the interaction between REE and enclave is controlled by SGX to protect the integrity and confidentiality of the enclave and the code and data therein;
[0010] In the process of key usage management, not only the sealing and unsealing of the key is performed in the enclave, but the key is also used in the enclave to achieve secure storage and use of the key. In terms of key usage, the monotonic counter provided by SGX is used to manage and control the number of key uses by binding the number of key uses to the monotonically increasing counter value, thereby solving the security issues caused by the unlimited use of the key.
[0011] Moreover, the data owner DO end sets a key daemon module KDM, a key migration module KMOM, a file encryption module FEM and a file upload module FUM, the key daemon module KDM and the file encryption module FEM are located in the enclave of the DO end, and the key migration module KMOM and the file upload module FUM are located in the REE of the DO end; the data user DU end sets a monotonic counter management module MCMM, a key management module KMM, a key migration module KMIM, a file decryption module FDM and a file processing module FPM, the monotonic counter management module MCMM, the key management module KMM and the file decryption module FDM are located in the enclave of the DU end, and the key migration module KMIM and the file processing module FPM are located in the REE of the DU end.
[0012] Moreover, the data belongs to the master DO terminal,
[0013] The key daemon module KDM is used to generate a symmetric file encryption key FEK, and pass the FEK to the file encryption module FEM; associate the FEK with the data, seal and unseal the FEK, and pass the corresponding relationship between the FEK and the data and the FEK in the sealed state to the key migration module KMOM, or receive the corresponding relationship between the FEK and the data and the FEK in the sealed state from the KMOM; receive the asymmetric key from the key migration module KMOM, encrypt the FEK and its maximum usage times MAX_TIMES with the asymmetric key, and pass the encrypted FEK and MAX_TIMES to the key migration module KMOM;
[0014] The key migration module KMOM is used to interact with the key daemon module KDM and the local file system, store the FEK in a sealed state transmitted from the key daemon module KDM to the local file system, or read the FEK in a sealed state from the local file system and transmit it to the key daemon module KDM; interact with the key migration module KMIM of the data user DU, receive the key migration request issued by the key migration module KMIM, generate a data access authorization certificate for the data user DU, and transmit the data access authorization certificate and the encrypted FEK and MAX_TIMES to KMIM to realize the migration of FEK and MAX_TIMES;
[0015] The file encryption module FEM is used to interact with the key daemon module KDM to obtain the file encryption key FEK, encrypt the plaintext data from the file upload module FUM using the symmetric encryption algorithm and the FEK, and return the ciphertext data to the FUM;
[0016] The file upload module FUM is used to pass the plaintext data to the file encryption module FEM, obtain the encrypted ciphertext data from the FEM, and upload the ciphertext data to the cloud service provider CSP.
[0017] Moreover, in the data user DU,
[0018] The monotonic counter management module MCMM is used to manage and operate the monotonic counter MC based on the API interface provided by SGX, including creating a corresponding MC for each FEK, returning the identifier MC_ID of the MC, reading the current value MC_VALUE of the corresponding MC according to the MC_ID, accumulating the current value of the MC with a step length of 1, and destroying the MC corresponding to the MC_ID;
[0019] The key management module KMM is used to generate an asymmetric public-private key pair as a migration key, and use the migration key to decrypt the FEK in the ciphertext state and its maximum usage count MAX_TIMES from the key migration module KMIM; seal and unseal the FEK and MAX_TIMES, and pass the sealed FEK and MAX_TIMES to the key migration module KMIM, or receive the sealed FEK and MAX_TIMES from KMIM; accept the decryption request from the file decryption module FDM, and pass the request to KMIM; interact with the monotonic counter management module MCMM to obtain the current value of the monotonic counter MC corresponding to the FEK, and judge whether the FEK meets the usage conditions. If the FEK is available, the FEK is passed to the file decryption module FDM, and the FEK is sealed again after use. If the usage conditions of the FEK are not met, the identifier MC_ID of the monotonic counter MC corresponding to the FEK is passed to MCMM, an instruction to destroy MC is issued to MCMM, and the key loading failure information is returned to FDM;
[0020] The key migration module KMIM is used to interact with the key migration module KMOM on the DO side and send a key migration request to KMOM; interact with the key management module KMM and pass the encrypted FEK and MAX_TIMES to KMM to achieve the migration of FEK and MAX_TIMES; interact with the local file system and store the sealed FEK and MAX_TIMES from KMM to the local file system; receive the key loading request from the key management module KMM and pass the sealed FEK and MAX_TIMES read from the local file system to KMM;
[0021] The file decryption module FDM is used to interact with the key management module KMM to obtain the FEK, use the symmetric encryption algorithm and the FEK to decrypt the ciphertext data from the file processing module FPM, and return the plaintext data to the FPM;
[0022] The file processing module FPM is used to interact with the cloud service provider CSP and obtain ciphertext data from the CSP; interact with the file decryption module FDM, pass the ciphertext data to FDM, and receive the plaintext data returned by FDM.
[0023] Moreover, during the data processing stage at the data owner DO end, the data owner DO encrypts the data and uploads the encrypted data to the server of the cloud service provider CSP, which is implemented by the following sub-steps:
[0024] A1) The file upload module FUM reads the plaintext file to be encrypted from the local file system and records its identifier as ID File , and the ID File The file is sent to the file encryption module FEM, requesting FEM to encrypt the file;
[0025] A2) The file encryption module FEM will File Passed to the key daemon module KDM, requesting KDM to be ID File The corresponding data File generates a symmetric file encryption key;
[0026] A3) The key daemon module KDM calls the random number generation method sgx_read_rand() provided by the SGX API to generate a symmetric file encryption key FEK with a length of 128 bits, and passes the FEK to the file encryption module FEM;
[0027] A4) The file encryption module FEM calls the AES encryption algorithm sgx_rijndael128GCM_encrypt() provided by the SGX API to use FEK to encrypt File and obtain the ciphertext data E FEK (File), and EFEK (File) is passed to the file upload module FUM;
[0028] A5) The file upload module FUM sends the encrypted data E FEK (File) and its ID File Upload to the server of the cloud service provider CSP;
[0029] A6) The key daemon module KDM calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal the FEK and obtain the sealing key Seal DO (FEK), ID File With Seal DO (FEK) is associated and then transmitted to the key migration module KMOM;
[0030] A7) The key migration module KMOM sends ID File With Seal DO (FEK) is stored in the local file system.
[0031] Moreover, when the key is migrated from the data owner DO to the data user DU, the file encryption key FEK and its maximum usage times MAX_TIMES are migrated from the data owner DO to the data user DU, which is achieved by the following sub-steps:
[0032] B1) The key migration module KMOM on the DO side verifies the identity and access rights of the DU. If the verification is successful, KMOM generates a data access authorization certificate Cert for the DU. File , and sends the key migration preparation information to the key migration module KMIM on the DU side;
[0033] B2) The key migration module KMIM at the DU end initiates a file encryption key migration request to the key management module KMM at the DU end;
[0034] B3) The key management module KMM on the DU side calls the RSA key generation method sgx_create_rsa_key_pair() provided by the SGX API to generate an asymmetric migration key pair MigrtKey, and returns the public key part MigrtKey_pub of MigrtKey to KMIM;
[0035] B4) The key migration module KMIM at the DU end sends MigrtKey_pub to the key migration module KMOM at the data owner DO end;
[0036] B5) The key migration module KMOM at the DO end uses ID FileRead the corresponding sealed file encryption key Seal from the local file system DO (FEK), Seal DO (FEK) is passed to the key daemon module KDM on the DO side together with MigrtKey_pub;
[0037] B6) The key daemon module KDM on the DO side calls the data deseal method sgx_unseal_data() provided by the SGX API to deseal the seal DO (FEK) performs desealing operation to obtain FEK, and generates the maximum number of times MAX_TIMES for FEK according to the specification of DO, and concatenates FEK and MAX_TIMES to obtain FEK||MAX_TIMES;
[0038] B7) The key daemon module KDM on the DO side calls the RSA encryption method sgx_rsa_pub_encrypt_sha256() provided by the SGX API, and encrypts FEK||MAX_TIMES with the public key part of the migration key MigrtKey_pub to obtain the ciphertext data E MigrtKey_pub (FEK||MAX_TIMES), E MigrtKey_pub (FEK||MAX_TIMES) is returned to the key migration module KMOM on the DO side.
[0039] B8) The key migration module KMOM on the DO side transfers Cert File 、ID File and E MigrtKey_pub (FEK||MAX_TIMES) is sent to the key migration module KMIM at the DU end;
[0040] B9) The key migration module KMIM at the DU end transfers Cert File 、ID File After the association is made, it is stored in the local file system and the ID File 、E MigrtKey_pub (FEK||MAX_TIMES) is transmitted to the key management module KMM at the DU end.
[0041] Moreover, the key usage phase at the data user DU is divided into a key preprocessing phase and a key restricted use phase, which are implemented through the key binding monotonic counter sub-process, the key loading sub-process and the key storage sub-process.
[0042] The key preprocessing stage includes that after the DU end and the DO end interact and execute the key migration process, the DU end executes a key binding monotonic counter sub-process once, and then executes a key storage sub-process once;
[0043] The key restricted use phase includes the DU end executing the key loading sub-process after executing the key migration process and the key pre-processing phase.
[0044] If the key is loaded successfully, the key management module KMM on the DU side will pass the FEK to the file decryption module FDM on the DU side. The file decryption module FDM on the DU side calls the sgx_rijndael128GCM_decrypt() method provided by the SGX API to decrypt E through FEK. FEK (File) obtains the plaintext file File, returns File to the file processing module FPM on the DU side, and feeds back the information of successful data access to the key management module KMM on the DU side; the DU side executes the key storage sub-process;
[0045] If the key loading fails, and the related information of the key loading failure is that the key has exceeded the maximum number of times it has been used, you need to re-execute the key migration process to obtain the FEK in ciphertext form from the DO end, and store the key securely locally through the key preprocessing stage.
[0046] Moreover, the key binding monotonic counter sub-process includes the following steps:
[0047] C1) The key management module KMM on the DU side calls the RSA decryption method sgx_rsa_priv_decrypt_sha256() provided by the SGX API and uses the private key MigrtKey_pri to decrypt E MigrtKey_pub (FEK||MAX_TIMES) gets FEK and MAX_TIMES, and destroys MigrtKey_pri by releasing the memory;
[0048] C2) The key management module KMM at the DU end initiates a request to create a monotonic counter MC to the monotonic counter management module MCMM at the DU end;
[0049] C3) The monotonic counter management module MCMM on the DU side calls the monotonic counter generation method sgx_create_monotonic_counter() provided by the SGX API to create a monotonic counter MC for FEK, sets the initial value of MC to 0, creates a variable MC_VALUE to save the value of MC, and passes the MC identifier MC_ID and MC_VALUE value to the key management module KMM on the DU side;
[0050] C4) The key management module KMM at the DU end creates a variable CUR_TIMES to record the current value of the monotonic counter MC, and assigns the MC_VALUE value to CUR_TIMES;
[0051] The key loading sub-process includes the following steps:
[0052] D1) The key migration module KMIM at the DU end uses ID File Read Seal from the local file system DU (KeyInfo), if Seal DU (KeyInfo) fails to read, the corresponding key loading failure information is returned; otherwise, Seal DU (KeyInfo) is transmitted to the key management module KMM on the DU side;
[0053] D2) The key management module KMM on the DU side calls the data decryption method sgx_unseal_data() provided by the SGX API to decrypt the seal. DU (KeyInfo) performs deseal operation to obtain FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest;
[0054] D3) The key management module KMM on the DU side calls the hash value calculation method sgx_sha256_msg() provided by the SGX API to calculate the hash value digest'=hash(FEK||MAX_TIMES||CUR_TIMES||MC_ID) of FEK, MAX_TIMES, CUR_TIMES, and MC_ID, and determines whether digest' is the same as digest. If digest' is not equal to digest, it means that the data in the file system is damaged, and the corresponding key loading failure information is returned; otherwise, execute D4);
[0055] D4) The key management module KMM at the DU end transmits the MC_ID to the monotonic counter management module MCMM;
[0056] D5) The monotonic counter management module MCMM on the DU side calls the monotonic counter value reading method sgx_read_monotonic_counter() provided by the SGX API to read the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID. If the MC_VALUE reading fails, it means that the MC has been deleted, and the corresponding key loading failure information is returned; otherwise, the read MC value MC_VALUE is returned to the key management module KMM;
[0057] D6) The key management module KMM at the DU end compares the value MC_VALUE of the MC just obtained with the previously stored value CUR_TIMES. If MC_VALUE is not equal to CUR_TIMES, it means that a replay attack has occurred, and returns the corresponding key loading failure information; otherwise, execute D7);
[0058] D7) The key management module KMM at the DU end compares CUR_TIMES and MAX_TIMES. If CUR_TIMES>MAX_TIMES, it means that the current usage of FEK has exceeded the maximum usage, and returns the corresponding key loading failure information; otherwise, it returns the key loading success information and passes the FEK to the file decryption module FDM at the DU end;
[0059] The key storage sub-process includes the following steps:
[0060] E1) The key management module KMM at the DU end transmits the identifier MC_ID of the monotonic counter MC to the monotonic counter management module MCMM at the DU end;
[0061] E2) The monotonic counter management module MCMM at the DU end calls the monotonic counter value update method sgx_increment_monotonic_counter() provided by the SGX API to increase the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID by 1, and transmits the increased MC_VALUE value to the KMM;
[0062] E3) The key management module KMM on the DU side assigns the obtained MC_VALUE value to CUR_TIMES, and calls the hash value calculation method sgx_sha256_msg() provided by SGXAPI to calculate the hash value of FEK, MAX_TIMES, CUR_TIMES, and MC_ID digest=hash(FEK||MAX_TIMES||CUR_TIMES||MC_ID);
[0063] E4) The key management module KMM on the DU side calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest to obtain the sealed data Seal DU (KeyInfo), Seal DU (KeyInfo) and ID File After association, the key is transmitted to the key migration module KMIM at the DU end;
[0064] E5) The key migration module KMIM at the DU end transfers ID File With Seal DU (KeyInfo) is stored in the local file system.
[0065] Another object of the present invention is to provide a system for implementing the SGX-based key usage management method in the cloud storage mode, including a data owner DO end and a data user DU end.
[0066] Another object of the present invention is to provide a computer-readable storage medium, comprising instructions, which, when executed on a computer, enables the computer to execute the SGX-based key usage management method in the cloud storage mode.
[0067] Compared with the prior art, the present invention has the following main advantages:
[0068] (1) Overcoming the limitations of the prior art, it is proposed for the first time to apply SGX technology to key management and data processing in the cloud storage mode, and use SGX to build a trusted execution environment enclave. The generation, sealing, unsealing and use of keys are all carried out in the enclave, thereby effectively protecting the keys and realizing the secure storage of keys. Compared with the prior art that uses TPM to manage keys, the present invention uses Intel SGX technology to manage keys. Intel SGX technology is a security enhancement technology that comes with Intel's 6th generation CPU and later. There is no need to install an external chip on the motherboard. As long as the device using such a CPU can use the technical solution of the present invention. In addition, in the method described in CN103138939B, the encryption and decryption of the key is completed inside the TPM, but due to the limitation of the computing power of the TPM, the use of the key (i.e., using the key to decrypt data from the cloud server) is carried out in ordinary memory, and attacks from the operating system or programs with higher permissions may cause key leakage. In the present invention, not only the sealing and unsealing of the key are performed in the enclave, but the use of the key is also performed in the enclave, and the enclave is a dedicated area in the memory, and the operating system and other programs cannot access the area, thereby enhancing the security of the system.
[0069] (2) In terms of key usage, the number of times the key is used is bound to a monotonic counter, and the number of times the key is used is securely stored and integrity checked to prevent it from being destroyed, thereby ensuring that the use of the key is limited, effectively solving the security problem caused by unlimited use after the key is distributed. In the method described in the prior art, in order to limit the number of times the key is used, the scheme adopted is to bind the key to a virtual monotonic counter, and after each use of the key, a monotonic increase operation is performed on the corresponding monotonic counter. Before each use of the key, it is determined whether the key still meets the use conditions by judging whether the corresponding virtual monotonic counter value reaches the specified limited number of times. In this method, each update operation of the virtual monotonic counter requires an update of the TPM hardware counter. However, due to the performance limitation of the TPM, frequent update operations on the hardware counter will cause blocking, reduce the running efficiency of the program, and affect the user experience. In the present invention, the monotonic counter used is provided by SGX, and its number is sufficient, so there is no need to adopt the virtual monotonic counter scheme, which is easier to implement. Secondly, compared with TPM, the SGX hardware monotonic counter is more efficient in performing update operations and provides a better user experience.
[0070] In summary, the present invention uses SGX technology to build a trusted execution environment so that keys can be securely stored and used. By using the monotonic counter function provided by SGX, the number of times a key is used is managed and controlled by binding the number of times a key is used with a monotonically increasing counter value, thereby effectively solving the security problem caused by the unlimited use of keys. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is a framework diagram of a key usage management system based on SGX in a cloud storage mode in an embodiment of the present invention.
[0072] Figure 2 It is a diagram of the key migration process of an embodiment of the present invention.
[0073] Figure 3 This is a flow chart of the use of the key at the DU end according to an embodiment of the present invention.
[0074] Figure 4 This is a sub-flow chart of a key binding monotonic counter according to an embodiment of the present invention.
[0075] Figure 5 This is a key loading sub-flow chart of an embodiment of the present invention.
[0076] Figure 6 It is a key storage sub-flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0077] The technical solution of the present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0078] Taking into account the defects of the prior art, the present invention proposes to apply SGX technology to key management and data processing in cloud storage mode.
[0079] Intel Software Guard Extensions, or SGX for short, is a set of instructions used to enhance the security of application code and data. SGX can create a protected, secure memory area, called an enclave, and place private information that needs to be protected and instructions for operating private information in the enclave. The security boundary of the enclave only includes the CPU and itself, and other applications running in the system (including the operating system itself and other privileged software) cannot access the enclave. The interaction between the enclave and the ordinary application memory area is controlled by SGX, thereby avoiding attacks by malware in the system and protecting the integrity and confidentiality of data and calculations.
[0080] The present invention notes that SGX has the following functional characteristics: First, SGX technology can be used to create an execution environment isolated from a normal memory environment, namely an enclave. The code and data in the encalve are stored in a dedicated memory area, and the operating system and other programs cannot access this area. Second, SGX has the function of sealing and desealing data. The key derivation mechanism of SGX can generate a sealing key using information such as secret data stored in the CPU and the measurement of the enclave. Different enclaves generate different sealing keys. The enclave uses symmetric encryption to seal and deseale data using the derived sealing key. Only when the enclave that performs the desealing operation and the enclave that performs the sealing operation are the same, can the sealed data be desealed to obtain plaintext data.
[0081] Therefore, the present invention proposes to build a trusted execution environment (TEE) on the data owner DO side and the data user DU side based on Intel SGX technology. In SGX technology, TEE is enclave. All operations related to private information are performed in the enclave, including key generation, sealing, unsealing, encryption and decryption of data with keys, etc. Other non-sensitive operations and data are performed in an operating system environment called REE (Rich Execution Enviroment), including network interaction, access to the local file system, etc. The interaction between REE and enclave is controlled by SGX to protect the integrity and confidentiality of the enclave and the code and data therein.
[0082] The present invention proposes a key usage management method based on SGX in a cloud storage mode, including three participants: the data owner DO, the cloud service provider CSP, and the data user DU. The overall process is: the data owner DO encrypts the data and stores it in the server of the cloud service provider CSP. When the data user DU needs to access the data stored by DO at the CSP, it initiates a data access request to DO and obtains the authorization certificate, key and its maximum number of uses from DO. DU presents the authorization certificate to CSP and obtains the ciphertext data from CSP. Before decrypting the data, the DU side judges the use conditions of the key. If the current number of uses of the key does not exceed its maximum number of uses, the key can be used, and the data is decrypted with the key, and the plaintext data is returned to the application. If the key has exceeded the predetermined maximum number of uses, the key will be securely deleted and the key loading failure information will be returned, thereby achieving the control of the key usage times and the protection of data confidentiality.
[0083] The architecture of the key usage management method and system based on SGX in the cloud storage mode proposed by the present invention is as follows: Figure 1 As shown, it mainly includes the following modules:
[0084] Key Daemon Module (KDM), Key Migration-Out Module (KMOM), File Encryption Module (FEM), File Upload Module (FUM), Monotonic Counter Management Module (MCMM), Key Management Module (KMM), Key Migration-In Module (KMIM), File Decryption Module (FDM), File Processing Module (FPM). Among them:
[0085] The data owner DO side sets the key daemon module KDM, the key migration module KMOM, the file encryption module FEM, and the file upload module FUM; and, KDM and FEM are located in the enclave of the DO side, and KMOM and FUM are located in the REE of the DO side. Compared with the method described in CN103138939B, the module settings of the DO side are different in the present invention. In CN103138939B, the key management daemon module KMD and the data encryption module DE on the Owner side are in the ordinary memory environment, that is, in the REE, and attacks from the operating system or programs with higher permissions may cause key leakage. In the present invention, the key daemon module KDM and the file encryption module FEM on the DO side exist in the enclave, and the operating system and other client programs cannot access the data therein, thereby improving the security of the system.
[0086] The data user DU sets a monotonic counter management module MCMM, a key management module KMM, a key migration module KMIM, a file decryption module FDM and a file processing module FPM; and MCMM, KMM and FDM are located in the enclave of the DU end, and KMIM and FPM are located in the REE of the DU end. Unlike the prior art, in the present invention, the loading process of encrypted data (completed by the file processing module FPM) and the decryption process (completed by the file decryption module FDM) are separated, FDM is in the enclave, and FPM is in the REE. Through this functional division, the key only exists in the enclave, and only the sealed key ciphertext can exist in the REE. In CN103138939B, the operation of using the key to decrypt data on the User end is completed in the ordinary memory environment REE, and attacks from the operating system or programs with higher permissions may cause key leakage. Therefore, compared with the prior art, when the DU end uses the key to decrypt data, the present invention has stronger protection for the confidentiality of the key.
[0087] The main functions of the above functional modules are:
[0088] Key daemon module KDM: Generate a symmetric file encryption key (File Encryption Key, FEK), pass FEK to file encryption module FEM; associate FEK with data, seal and unseal FEK, pass the correspondence between FEK and data, and FEK in a sealed state to the key migration module KMOM, or receive the correspondence between FEK and data and FEK in a sealed state from KMOM; receive an asymmetric key from the key migration module KMOM, encrypt FEK and its maximum number of uses MAX_TIMES (MAX_TIMES is specified by DO as needed) with an asymmetric key, and pass the encrypted FEK and MAX_TIMES to KMOM. Different from the prior art, the execution environment of the key daemon module KDM in the present invention is different. In CN103138939B, the execution environment of the key management daemon module KDM is a normal memory environment. In the present invention, KDM is located in a trusted execution environment enclave. The advantage of this design is that the key plaintext will not be exposed in the normal memory environment, which can more effectively prevent key leakage.
[0089] Key migration module KMOM: interacts with the key daemon module KDM and the local file system, stores the sealed FEK transmitted from KDM to the local file system, or reads the sealed FEK from the local file system and passes it to KDM; interacts with the key migration module KMIM on the DU side, receives the key migration request issued by KMIM, generates a data access authorization certificate for DU, passes the data access authorization certificate and the encrypted FEK and MAX_TIMES to KMIM, and realizes the migration of FEK and MAX_TIMES. Different from the prior art, the present invention adds a key migration module KMOM on the DO side. Because the key daemon module KDM is located in the trusted execution environment enclave, due to the security design of the enclave, it cannot interact directly with the file system, so KMOM in the ordinary memory environment is required to perform data interaction with the file system. The data transfer between KMOM and KDM is controlled by SGX.
[0090] File encryption module FEM: interacts with the key daemon module KDM to obtain the file encryption key FEK, uses the symmetric encryption algorithm and FEK to encrypt the plaintext data from the file upload module FUM, and returns the ciphertext data to FUM. Different from the prior art, the present invention places FEM in the enclave, while in CN103138939B, the corresponding data encryption module DE is located in the ordinary memory environment, which may cause key leakage when using the key to encrypt data. In the present invention, the key usage process occurs in the enclave, which can more effectively prevent key leakage.
[0091] File upload module FUM: reads the plaintext data stored in the local file system and passes the plaintext data to the file encryption module FEM, obtains the encrypted ciphertext data from FEM, and uploads the ciphertext data to the cloud service provider CSP. After the ciphertext data is uploaded to the CSP, the plaintext data is deleted from the local file system. Unlike the prior art, FUM is a module added to the DO end of the present invention. In CN103138939B, the data encryption module DE is located in a normal memory environment and can interact directly with the file system, but it also leads to an unsafe key usage environment. In the present invention, the file encryption module FEM is in the enclave and cannot directly exchange data with the file system. FUM is needed to assist in completing the data transfer between them. Monotonic Counter Management Module MCMM: Based on the API interface provided by SGX to manage and operate the monotonic counter (MC), including: creating a corresponding MC for each FEK, and returning the identifier MC_ID of the MC, reading the current value MC_VALUE of the corresponding MC according to MC_ID, accumulating the current value of MC with a step length of 1, and destroying the MC corresponding to the FEK according to MC_ID after the number of times the FEK is used exceeds the maximum number of times MAX_TIMES. Different from the prior art, the present invention uses the hardware counter provided by SGX, which is more efficient in performing read and update operations on the counter. Moreover, this module is located in the trusted execution environment enclave, and the operating system and other client programs cannot access the contents therein, thereby increasing the reliability of this module.
[0092] Key management module KMM: generates an asymmetric public-private key pair as a migration key, and uses the migration key to decrypt the FEK in the ciphertext state and its maximum usage count MAX_TIMES from the key migration module KMIM; seals and unseals the FEK and MAX_TIMES, and passes the sealed FEK and MAX_TIMES to the key migration module KMIM, or receives the sealed FEK and MAX_TIMES from KMIM; accepts the decryption request from the file decryption module FDM and passes the request to KMIM; interacts with the monotonic counter management module MCMM to obtain the current value of the monotonic counter MC corresponding to the FEK, and determines whether the FEK meets the usage conditions. If the FEK is available, the FEK is passed to the file decryption module FDM, and the FEK is sealed again after use. If the usage conditions of the FEK are not met, the identifier MC_ID of the monotonic counter MC corresponding to the FEK is passed to MCMM, an instruction to destroy MC is issued to MCMM, and the key loading failure information is returned to FDM. Compared with the prior art that places the key management module in a common memory environment, the present invention places the KMM in the enclave, so the key plaintext will not appear in the common memory, protecting the confidentiality of the key and preventing key leakage. At the same time, since the enclave cannot interact directly with the file system, the key migration module KMIM in the common memory environment is required to assist in completing the data transfer between the KMM and the file system.
[0093] Key migration module KMIM: interacts with the key migration module KMOM on the DO side and sends a key migration request to KMOM; interacts with the key management module KMM and passes the encrypted FEK and MAX_TIMES to KMM to realize the migration of FEK and MAX_TIMES; interacts with the local file system and stores the sealed FEK and MAX_TIMES from KMM to the local file system; receives a key loading request from the key management module KMM and passes the sealed FEK and MAX_TIMES read from the local file system to KMM.
[0094] File decryption module FDM: interacts with the key management module KMM to obtain FEK, uses the symmetric encryption algorithm and FEK to decrypt the ciphertext data from the file processing module FPM, and returns the plaintext data to FPM. Unlike the existing technology, the decryption operation using the key occurs in the enclave instead of in the ordinary memory environment, and the key plaintext will not appear in the ordinary memory environment, which improves security.
[0095] File processing module FPM: interacts with the cloud service provider CSP to obtain ciphertext data from the CSP; interacts with the local file system to store the ciphertext data obtained from the CSP in the local file system. When the DU needs to decrypt the ciphertext data later, it directly reads the ciphertext data from the local file system; interacts with the file decryption module FDM, passes the ciphertext data to FDM, and receives the plaintext data returned by FDM. Compared with the prior art, this module is a module added by the present invention on the DU side. The file decryption module FDM is in the enclave and cannot interact directly with the file system. FPM is required as a data transfer station to assist in completing the data transfer between FDM and the file system.
[0096] The system workflow of the present invention is improved on the basis of the prior art. In order to realize the key usage management in the cloud storage mode, the process framework is similar, such as Figure 1 The following steps are shown:
[0097] 1) The data owner DO encrypts the data and uploads the encrypted data to the server of the cloud service provider CSP.
[0098] 2) When the data user DU wants to use the data stored by the data owner DO at the cloud service provider CSP, it initiates a data access request to DO.
[0099] 3) The data owner DO verifies the identity and access rights of the data user DU. If the DU is an illegal user or initiates an access request to data to which it does not have access rights, the data owner DO will not respond to the DU's request. Otherwise, the DO will issue a data access authorization certificate to the DU and send the data access authorization certificate, key, and its maximum number of uses to the DU.
[0100] 4) The data owner DO sends the identity and access rights of the data user DU to the cloud service provider CSP.
[0101] 5) The data user DU initiates a data access request to the cloud service provider CSP and presents the data access authorization certificate issued by the data owner DO to the CSP.
[0102] 6) CSP determines whether DU can access data based on DU identity and access rights provided by DO, DU data access request and authorization certificate. If DU can access data, the encrypted data is sent to DU; otherwise, the data access request of DU is not responded.
[0103] 7) After the data user DU obtains the ciphertext data from the cloud service provider CSP, it decrypts and accesses the data using the key obtained from the data owner DO.
[0104] Based on the new system structure proposed by the present invention, the present invention further proposes: isolating the execution environment and the general memory environment when the key is generated and used. On the DO side, the key is generated in the enclave. On the DU side, the key usage process is also carried out in the enclave environment. Therefore, unlike the prior art, the present invention not only realizes the secure storage and restricted use of the key on the DU side, but also enhances the confidentiality of the key during use.
[0105] See also Figure 2-6 The following is a further description of the workflow of the method provided in the embodiment of the present invention:
[0106] 1. The data owner DO processes the data:
[0107] 1) in the above system workflow is the data processing stage of the data owner DO, which mainly includes the following steps:
[0108] 1-1) The file upload module FUM reads the plaintext file to be encrypted from the local file system and records its identifier as ID File , and the ID File The file is sent to the file encryption module FEM, requesting FEM to encrypt the file.
[0109] 1-2) File encryption module FEM will ID File Passed to the key daemon module KDM, requesting KDM to be ID File The corresponding data File generates a symmetric file encryption key.
[0110] 1-3) The key daemon module KDM calls the random number generation method sgx_read_rand() provided by the SGX API to generate a 128-bit symmetric file encryption key FEK, and passes the FEK to the file encryption module FEM.
[0111] 1-4) The file encryption module FEM uses the AES encryption algorithm, that is, calling the sgx_rijndael128GCM_encrypt() method provided by the SGX API to use FEK to encrypt File and obtain the ciphertext data E FEK (File), and E FEK (File) is passed to the file upload module FUM.
[0112] 1-5) The file upload module FUM uploads the encrypted data E FEK (File) and its ID File Upload to the server of the cloud service provider CSP.
[0113] 1-6) The key daemon module KDM calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal the FEK and obtain the sealing key Seal DO (FEK), ID File With Seal DO (FEK) is associated and then transmitted to the key migration module KMOM.
[0114] 1-7) The key migration module KMOM transfers ID File With Seal DO (FEK) is stored in the local file system.
[0115] Unlike the prior art, the main difference of the present invention is the architectural design of the DO-side program in the data processing stage of the data owner DO side. In CN103138939B, the key generation and key encryption data of the Owner side are performed in the ordinary memory environment, and only the encryption operation of the key is performed in the trusted platform module TPMo. In the present invention, the generation of keys, the use of keys, and the sealing of keys are all performed in the enclave, and only the sealed key ciphertext will be transmitted to the outside of the enclave and stored in the local file system, and the key plaintext will not be exposed in the ordinary memory environment. In addition, for the reason of security design, the enclave cannot interact directly with the file system, so the present invention adds a key migration module KMOM to the DO side, which is located in the ordinary memory environment, and the data exchange between KMOM and KDM is controlled by SGX. For the same reason, the present invention also adds a file upload module FUM to the DO side to realize the data exchange with the file encryption module FEM in the enclave. FUM and KMOM interact with the local file system to complete data loading and storage.
[0116] 2. The key is migrated from the data owner DO to the data user DU:
[0117] 3) of the above system workflow migrates the file encryption key FEK and its maximum usage times MAX_TIMES from the data owner DO to the data user DU, which mainly includes the following steps: Figure 2 As shown:
[0118] 3-1) The key migration module KMOM on the DO side verifies the identity and access rights of the DU. If the DU is an illegal user or initiates an access request to data to which it does not have access rights, the verification fails and the DU's request is not responded to. If the verification passes, KMOM generates a data access authorization certificate Cert for the DU. File And send the information of preparing key migration to the key migration module KMIM on the DU side.
[0119] 3-2) The key migration module KMIM at the DU end initiates a file encryption key migration request to the key management module KMM at the DU end.
[0120] 3-3) The key management module KMM on the DU side calls the RSA key generation method sgx_create_rsa_key_pair() provided by the SGX API to generate an asymmetric migration key pair MigrtKey, and returns the public key part MigrtKey_pub of MigrtKey to KMIM.
[0121] 3-4) The key migration module KMIM at the DU end sends MigrtKey_pub to the key migration module KMOM at the data owner DO end.
[0122] 3-5) The key migration module KMOM at the DO end uses ID File Read the corresponding sealed file encryption key FEK from the local file system, also known as Seal DO (FEK), Seal DO (FEK) and MigrtKey_pub are passed to the key daemon module KDM on the DO side.
[0123] 3-6) The key daemon module KDM on the DO side calls the data deseal method sgx_unseal_data() provided by the SGX API to deseal the seal DO (FEK) performs an unsealing operation to obtain FEK, and generates a maximum usage count MAX_TIMES for FEK according to the specification of DO, and concatenates FEK and MAX_TIMES to obtain FEK||MAX_TIMES.
[0124] 3-7) The key daemon module KDM on the DO side calls the RSA encryption method sgx_rsa_pub_encrypt_sha256() provided by the SGX API, and encrypts FEK||MAX_TIMES with the public key part of the migration key MigrtKey_pub to obtain the ciphertext data E MigrtKey_pub (FEK||MAX_TIMES), E MigrtKey_pub (FEK||MAX_TIMES) is returned to the key migration module KMOM on the DO side.
[0125] 3-8) The key migration module KMOM on the DO side transfers Cert File 、ID File and E MigrtKey_pub (FEK||MAX_TIMES) is sent to the key migration module KMIM on the DU side.
[0126] 3-9) The key migration module KMIM at the DU end transfers Cert File 、ID File After the association is made, it is stored in the local file system and the ID File 、E MigrtKey_pub (FEK||MAX_TIMES) is transmitted to the key management module KMM at the DU end.
[0127] Unlike the prior art, the main difference of the present invention in the key migration stage is the encryption operation of the key FEK using the migration key MigrtKey. In CN103138939B, the environment when the key is encrypted is a normal memory environment. In the present invention, the encryption of FEK occurs in the DO end enclave, which protects the confidentiality of FEK more strongly.
[0128] 3. The key usage phase at the data user DU:
[0129] 7) in the above system workflow is the secure storage and restricted use stage of the file encryption key FEK at the data user DU end, which is divided into the key preprocessing stage and the key restricted use stage, including the key binding monotonic counter sub-process, the key loading sub-process and the key storage sub-process. Among them, the key binding monotonic counter sub-process will only be executed once after the DU end and the DO end interact and execute the key migration process to bind the FEK to its corresponding monotonic counter; when accessing data, it is necessary to obtain the plain text form of the FEK through the key loading sub-process in order to access the ciphertext data E FEK (File) to decrypt; each time after accessing the data, the key storage sub-process needs to be executed to store the FEK locally securely. It should be noted that after executing the key binding monotonic counter sub-process, the key storage sub-process also needs to be executed once to store the FEK and ID File After the association is made, it is securely stored in the local file system and is accessed through the ID during the key restricted use phase. File The corresponding FEK in a sealed state can be found from the local file system.
[0130] Unlike the prior art, in the present invention, after completing the key migration, the DU side needs to perform a key preprocessing operation first. In CN103138939B, after completing the key migration operation using the asymmetric key AsyKey, it is necessary to continue to retain AsyKey for the DU side to perform key sealing and unsealing operations. In the present invention, in order to achieve the purpose of using specific keys for specific functions, after completing the key migration, the DU side will destroy the migration key MigrtKey. In the preprocessing stage, the DU side will bind a monotonic counter to the FEK, and save it to the DU side local file system after performing a sealing operation on the FEK.
[0131] 3.1 Key Preprocessing Phase
[0132] After the DU and DO interact and execute the key migration process, they need to execute a key binding monotonic counter sub-process and then execute a key storage sub-process to obtain the key from the ciphertext E MigrtKey_pub FEK and MAX_TIMES are obtained from (FEK||MAX_TIMES), and are sealed and stored in the local file system after being bound to a monotonic counter. This stage must be performed after key migration is completed, but it does not involve data access and will no longer be executed in subsequent data access processes. Therefore, it can be called the key preprocessing stage. Its main process is:
[0133] 7-0-1) The DU end executes the key binding monotonic counter sub-process, and the process is 7-0-1-1) to 7-0-1-4).
[0134] 7-0-2) The DU end executes the key storage sub-process, the process is 7-9-1)—7-9-5).
[0135] 3.2 Key restricted use stage
[0136] After executing the key migration process and the key preprocessing stage, the DU securely stores the file encryption key FEK and its maximum usage count MAX_TIMES in the local file system, and can then access data through the key under restricted conditions. In the process of accessing data, if it is found that the key usage conditions are not met, that is, the current usage count of FEK has exceeded MAX_TIMES, the monotonic counter bound to FEK will be securely destroyed and FEK will not be loaded successfully. At this point, if DU still wants to access the data, it is necessary to re-execute the key migration process to obtain the FEK in ciphertext form from the DO, and securely store the key locally through the key preprocessing stage. Its workflow is as follows: Figure 3 As shown:
[0137] 7-1) The file processing module FPM at the DU end converts the ciphertext data E FEK (File) and its ID File The file is transmitted to the file decryption module FDM on the DU side.
[0138] 7-2) The file decryption module FDM on the DU end will File Passed to the key management module KMM at the DU end, requesting E FEK (File) The file encryption key FEK corresponding to (File).
[0139] 7-3) The key management module KMM at the DU end will File The key migration module KMIM transmitted to the DU end.
[0140] 7-4) The DU end executes the key loading sub-process, and the process is 7-4-1) to 7-4-7). In this process, if the key loading is successful, go to 7-7). If the key loading fails, and the relevant information of the key loading failure is that the key has exceeded the maximum number of uses, go to 7-5), otherwise go to 7-10).
[0141] 7-5) The key management module KMM at the DU end transmits the identifier MC_ID of the monotonic counter to the monotonic counter management module MCMM at the DU end.
[0142] 7-6) The monotonic counter management module MCMM on the DU side calls the monotonic counter destruction method sgx_destroy_monotonic_counter() provided by the SGX API to delete the monotonic counter MC corresponding to the MC_ID, and go to 7-10).
[0143] 7-7) The key management module KMM on the DU side transmits the FEK to the file decryption module FDM on the DU side.
[0144] 7-8) The file decryption module FDM on the DU side calls the AES decryption method sgx_rijndael128GCM_decrypt() provided by the SGX API to decrypt E through FEK FEK (File) obtains the plaintext file File, returns File to the file processing module FPM on the DU side, and feeds back information about successful data access to the key management module KMM on the DU side.
[0145] 7-9) The DU end executes the key storage sub-process, the process is 7-9-1) to 7-9-5).
[0146] 7-10) The data access process ends.
[0147] Unlike the prior art, the present invention implements the isolation of the key usage environment and the ordinary memory environment on the DU side to protect the confidentiality of the key. In the present invention, the DU side uses the key to decrypt the data in the file decryption module FDM in the enclave, while in CN103138939B, the User side decrypts the data in the ordinary memory environment. In order to support the import of sealed keys into the key management module KMM in the enclave and the import of ciphertext data into the file decryption module FDM in the enclave, the present invention adds a key migration module KMIM and a file processing module FPM in the ordinary memory environment to realize data interaction between the DU side enclave and the local file system.
[0148] 1) The key binding monotonic counter sub-process includes the following steps: Figure 4 As shown:
[0149] 7-0-1-1) The key management module KMM on the DU side calls the RSA decryption method sgx_rsa_priv_decrypt_sha256() provided by the SGX API and uses the private key MigrtKey_pri of MigrtKey to decrypt E MigrtKey_pub (FEK||MAX_TIMES) gets FEK and MAX_TIMES, and destroys MigrtKey_pri by releasing the memory.
[0150] 7-0-1-2) The key management module KMM at the DU end initiates a request to create a monotonic counter MC to the monotonic counter management module MCMM at the DU end.
[0151] 7-0-1-3) The monotonic counter management module MCMM on the DU side calls the monotonic counter generation method sgx_create_monotonic_counter() provided by the SGX API to create a monotonic counter MC for FEK, sets the initial value of MC to 0, creates a variable MC_VALUE to save the value of MC, and passes the MC identifier MC_ID and MC_VALUE value to the key management module KMM on the DU side.
[0152] 7-0-1-4) The key management module KMM at the DU end creates a variable CUR_TIMES to record the current value of the monotonic counter MC, and assigns the MC_VALUE value to CUR_TIMES.
[0153] Unlike the virtual monotonic counter used in the prior art, the present invention uses the hardware counter provided by SGX, which has higher efficiency in reading and updating the counter. In addition, the monotonic counter management module MCMM on the DU side of the present invention is located inside the enclave, and the reading of the monotonic counter value MC_VALUE occurs inside the enclave, and the subsequent use of MC_VALUE is also in the enclave. Compared with the virtual counter management module VCM in the ordinary memory environment of the User side in the prior art, the monotonic counter management module MCMM of the present invention is more secure and reliable.
[0154] 2) The key loading sub-process includes the following steps: Figure 5 As shown:
[0155] 7-4-1) The key migration module KMIM at the DU end uses ID File Read Seal from the local file system DU (KeyInfo), if Seal DU(KeyInfo) fails to read, the corresponding key loading failure information is returned; otherwise, Seal DU (KeyInfo) is transmitted to the key management module KMM on the DU side.
[0156] 7-4-2) The key management module KMM on the DU side calls the data deseal method sgx_unseal_data() provided by the SGX API to deseal the seal DU (KeyInfo) performs deseal operation to obtain FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest.
[0157] 7-4-3) The key management module KMM on the DU side calls the sgx_sha256_msg() method provided by the SGX API to calculate the hash values of FEK, MAX_TIMES, CUR_TIMES, and MC_ID
[0158] digest'=hash(FEK||MAX_TIMES||CUR_TIMES||MC_ID),
[0159] And determine whether digest' is the same as digest. If digest' is not equal to digest, it means that the data in the file system is damaged, and the corresponding key loading failure information is returned; otherwise, execute 7-4-4).
[0160] 7-4-4) The key management module KMM at the DU end passes the MC_ID to the monotonic counter management module MCMM.
[0161] 7-4-5) The monotonic counter management module MCMM on the DU side calls the monotonic counter value reading method sgx_read_monotonic_counter() provided by the SGX API to read the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID. If the MC_VALUE reading fails, it means that the MC has been deleted, and the corresponding key loading failure information is returned; otherwise, the read MC value MC_VALUE is returned to the key management module KMM.
[0162] 7-4-6) The key management module KMM at the DU end compares the value MC_VALUE of the MC just obtained with the previously stored value CUR_TIMES. If MC_VALUE is not equal to CUR_TIMES, it means that a replay attack has occurred, and the corresponding key loading failure information is returned; otherwise, execute 7-4-7).
[0163] 7-4-7) The key management module KMM on the DU side compares CUR_TIMES and MAX_TIMES. If CUR_TIMES>MAX_TIMES, it means that the current number of times FEK has been used has exceeded its maximum number of times, and the corresponding key loading failure information is returned; otherwise, the key loading success information is returned, and the FEK is passed to the file decryption module FDM on the DU side.
[0164] In the key loading stage, after the prior art performs the decryption operation of the ciphertext key inside the trusted platform module TPMu on the User side, it is necessary to send the key plaintext to the ordinary memory environment, and then judge the key usage conditions, use or delete the key. The security of the ordinary memory environment is difficult to guarantee. In the present invention, the decryption of the key, the judgment of the key usage conditions, and the key deletion are all completed in the enclave, which is more secure.
[0165] 3) The key storage sub-process includes the following steps: Figure 6 As shown:
[0166] 7-9-1) The key management module KMM at the DU end passes the identifier MC_ID of the monotonic counter MC to the monotonic counter management module MCMM at the DU end.
[0167] 7-9-2) The monotonic counter management module MCMM on the DU side calls the monotonic counter value update method sgx_increment_monotonic_counter() provided by the SGX API to increase the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID by 1, and transmits the increased MC_VALUE value to the KMM.
[0168] 7-9-3) The key management module KMM on the DU side assigns the obtained MC_VALUE value to CUR_TIMES, and calls the hash value calculation method sgx_sha256_msg() provided by the SGX API to calculate the hash value of FEK, MAX_TIMES, CUR_TIMES, and MC_ID digest = hash (FEK||MAX_TIMES||CUR_TIMES||MC_ID).
[0169] 7-9-4) The key management module KMM on the DU side calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest to obtain the sealed data Seal DU (KeyInfo), Seal DU (KeyInfo) and ID FileAfter association, they are transmitted to the key migration module KMIM at the DU end.
[0170] 7-9-5) The key migration module KMIM at the DU end transfers ID File With Seal DU (KeyInfo) is stored in the local file system.
[0171] Unlike the prior art, in the key storage stage, the present invention processes the monotonic counter and the plaintext key in the enclave, and the sealing and unsealing of the key does not require the storage of additional key data on the local file system. In CN103138939B, the hash function hash() is used to calculate the summary of the plaintext key DEK, the number of times VC has been used, and the specified number of times N is used in a normal memory environment, which may lead to key leakage. In addition, the secure storage and loading of the key also requires the storage of additional key data E in the local file system. AsyKey_pub (BindKey), if E AsyKey_pub If (BindKey) is missing, key loading will fail.
[0172] In specific implementation, the method proposed in the technical solution of the present invention can be implemented by technical personnel in this field using computer software technology to realize automatic operation process. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of the present invention and computer equipment running the corresponding computer program, should also be within the scope of protection of the present invention.
[0173] In some possible embodiments, a system for implementing the SGX-based key usage management method in the cloud storage mode is provided, including a data owner DO end and a data user DU end. Further, the data owner DO end sets a key daemon module KDM, a key migration module KMOM, a file encryption module FEM and a file upload module FUM, the key daemon module KDM and the file encryption module FEM are located in the enclave of the DO end, and the key migration module KMOM and the file upload module FUM are located in the REE of the DO end; the data user DU end sets a monotonic counter management module MCMM, a key management module KMM, a key migration module KMIM, a file decryption module FDM and a file processing module FPM, the monotonic counter management module MCMM, the key management module KMM and the file decryption module FDM are located in the enclave of the DU end, and the key migration module KMIM and the file processing module FPM are located in the REE of the DU end. For specific implementation, please refer to the above text, and the present invention will not be repeated.
[0174] In some possible embodiments, a computer-readable storage medium is provided, including instructions, which, when executed on a computer, enable the computer to execute the SGX-based key usage management method in the cloud storage mode.
[0175] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A key usage management method based on SGX in a cloud storage mode, characterized by: Based on Intel SGX technology, a trusted execution environment is built on the data owner DO side and the data user DU side respectively. The operations related to private information are performed in the secure area enclave, and other non-sensitive operations and data are performed in the REE operating system environment. The interaction between REE and enclave is controlled by SGX to protect the integrity and confidentiality of the enclave and the code and data therein. In the process of key usage management, not only the sealing and unsealing of the key is performed in the enclave, but also the use of the key is performed in the enclave, so as to realize the safe storage and use of the key. In terms of key use, the monotonic counter provided by SGX is used to manage and control the number of key uses by binding the number of key uses with the monotonically increasing counter value, thereby solving the security problem caused by the unlimited use of the key. The data owner DO side sets a key daemon module KDM, a key migration module KMOM, a file encryption module FEM and a file upload module FUM, the key daemon module KDM and the file encryption module FEM are located in the enclave of the DO side, and the key migration module KMOM and the file upload module FUM are located in the REE of the DO side; The data user DU side is provided with a monotonic counter management module MCMM, a key management module KMM, a key migration module KMIM, a file decryption module FDM and a file processing module FPM, wherein the monotonic counter management module MCMM, the key management module KMM and the file decryption module FDM are located in the enclave of the DU side, and the key migration module KMIM and the file processing module FPM are located in the REE of the DU side; The data belongs to the DO terminal. The key daemon module KDM is used to generate a symmetric file encryption key FEK, and pass the FEK to the file encryption module FEM; associate the FEK with the data, seal and unseal the FEK, and pass the corresponding relationship between the FEK and the data and the FEK in the sealed state to the key migration module KMOM, or receive the corresponding relationship between the FEK and the data and the FEK in the sealed state from the KMOM; receive the asymmetric key from the key migration module KMOM, encrypt the FEK and its maximum usage times MAX_TIMES with the asymmetric key, and pass the encrypted FEK and MAX_TIMES to the key migration module KMOM; The key migration module KMOM is used to interact with the key daemon module KDM and the local file system, store the FEK in a sealed state transmitted from the key daemon module KDM to the local file system, or read the FEK in a sealed state from the local file system and transmit it to the key daemon module KDM; interact with the key migration module KMIM at the data user DU end, receive the key migration request issued by the key migration module KMIM, generate a data access authorization certificate for the data user DU end, transmit the data access authorization certificate and the encrypted FEK and MAX_TIMES to KMIM, and realize the migration of FEK and MAX TIMES; The file encryption module FEM is used to interact with the key daemon module KDM to obtain the file encryption key FEK, encrypt the plaintext data from the file upload module FUM using the symmetric encryption algorithm and the FEK, and return the ciphertext data to the FUM; The file upload module FUM is used to pass the plaintext data to the file encryption module FEM, obtain the encrypted ciphertext data from FEM, and upload the ciphertext data to the cloud service provider CSP; In the data user DU, The monotonic counter management module MCMM is used to manage and operate the monotonic counter MC based on the API interface provided by SGX, including creating a corresponding MC for each FEK, returning the identifier MC_ID of the MC, reading the current value MC_VALUE of the corresponding MC according to the MC_ID, accumulating the current value of the MC with a step length of 1, and destroying the MC corresponding to the MC_ID; The key management module KMM is used to generate an asymmetric public-private key pair as a migration key, and use the migration key to decrypt the FEK in the ciphertext state and its maximum usage count MAX_TIMES from the key migration module KMIM; seal and unseal the FEK and MAX_TIMES, and pass the sealed FEK and MAX_TIMES to the key migration module KMIM, or receive the sealed FEK and MAX_TIMES from KMIM; accept the decryption request from the file decryption module FDM, and pass the request to KMIM; interact with the monotonic counter management module MCMM to obtain the current value of the monotonic counter MC corresponding to the FEK, and judge whether the FEK meets the usage conditions. If the FEK is available, the FEK is passed to the file decryption module FDM, and the FEK is sealed again after use. If the usage conditions of the FEK are not met, the identifier MC_ID of the monotonic counter MC corresponding to the FEK is passed to MCMM, an instruction to destroy MC is issued to MCMM, and the key loading failure information is returned to FDM; The key migration module KMIM is used to interact with the key migration module KMOM on the DO side and send a key migration request to KMOM; interact with the key management module KMM and pass the encrypted FEK and MAX_TIMES to KMM to achieve the migration of FEK and MAX_TIMES; interact with the local file system and store the sealed FEK and MAX_TIMES from KMM to the local file system; receive the key loading request from the key management module KMM and pass the sealed FEK and MAX_TIMES read from the local file system to KMM; The file decryption module FDM is used to interact with the key management module KMM to obtain the FEK, use the symmetric encryption algorithm and the FEK to decrypt the ciphertext data from the file processing module FPM, and return the plaintext data to the FPM; The file processing module FPM is used to interact with the cloud service provider CSP and obtain the encrypted data from the CSP; Interact with the file decryption module FDM, pass the ciphertext data to FDM, and receive the plaintext data returned by FDM.
2. According to claim 1, the key usage management method based on SGX in the cloud storage mode is characterized in that: During the data processing phase on the data owner DO side, the data owner DO encrypts the data and uploads the encrypted data to the server of the cloud service provider CSP. This is achieved using the following sub-steps: A1) The file upload module FUM reads the plaintext file to be encrypted from the local file system and records its identifier as ID File , and the ID File The file is sent to the file encryption module FEM, requesting FEM to encrypt the file; A2) The file encryption module FEM will File Passed to the key daemon module KDM, requesting KDM to be ID File The corresponding data File generates a symmetric file encryption key; A3) The key daemon module KDM calls the random number generation method sgx_read_rand() provided by the SGX API to generate a symmetric file encryption key FEK with a length of 128 bits, and passes the FEK to the file encryption module FEM; A4) The file encryption module FEM uses the AES encryption algorithm and calls the AES encryption algorithm sgx_rijndael128GCM_encrypt() provided by the SGX API to use FEK to encrypt File and obtain the ciphertext data E FEK (File), and E FEK (File) is passed to the file upload module FUM; A5) The file upload module FUM sends the encrypted data E FEK (File) and its ID File Upload to the server of the cloud service provider CSP; A6) The key daemon module KDM calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal the FEK and obtain the sealing key Seal DO (FEK), ID File With Seal DO (FEK) is associated and then transmitted to the key migration module KMOM; A7) The key migration module KMOM sends ID File With Seal DO (FEK) is stored in the local file system.
3. According to claim 2, the key usage count management method based on SGX in the cloud storage mode is characterized in that: When the key is migrated from the data owner DO to the data user DU, the file encryption key FEK and its maximum usage times MAX_TIMES are migrated from the data owner DO to the data user DU. The following sub-steps are used to achieve this: B1) The key migration module KMOM on the DO side verifies the identity and access rights of the DU. If the verification is successful, KMOM generates a data access authorization certificate Cert for the DU. File , and sends the key migration preparation information to the key migration module KMIM on the DU side; B2) The key migration module KMIM at the DU end initiates a file encryption key migration request to the key management module KMM at the DU end; B3) The key management module KMM on the DU side calls the RSA key generation method sgx_create_rsa_key_pair() provided by the SGX API to generate an asymmetric migration key pair MigrtKey, and returns the public key part MigrtKey_pub of MigrtKey to KMIM; B4) The key migration module KMIM at the DU end sends MigrtKey_pub to the key migration module KMOM at the data owner DO end; B5) The key migration module KMOM at the DO end uses ID File Read the corresponding sealed file encryption key Seal from the local file system DO (FEK), Seal DO (FEK) is passed to the key daemon module KDM on the DO side together with MigrtKey_pub; B6) The key daemon module KDM on the DO side calls the data deseal method sgx_unseal_data() provided by the SGX API to deseal the seal DO (FEK) performs desealing operation to obtain FEK, and generates the maximum number of times MAX_TIMES for FEK according to the specification of DO, and concatenates FEK and MAX_TIMES to obtain FEK||MAX_TIMES; B7) The key daemon module KDM on the DO side calls the RSA encryption method sgx_rsa_pub_encrypt_sha256() provided by the SGX API, and encrypts FEK||MAX_TIMES with the public key part of the migration key MigrtKey_pub to obtain the ciphertext data E MigrtKey_pub (FEK||MAX_TIMES), E MigrtKey_pub (FEK||MAX_TIMES) is returned to the key migration module KMOM on the DO side; B8) The key migration module KMOM on the DO side transfers Cert File 、ID File and E MigrtKey_pub (FEK||MAX_TIMES) is sent to the key migration module KMIM at the DU end; B9) The key migration module KMIM at the DU end transfers Cert File 、ID File After the association is made, it is stored in the local file system and the ID File 、E MigrtKey_pub (FEK||MAX_TIMES) is transmitted to the key management module KMM at the DU end.
4. According to claim 3, the key usage count management method based on SGX in the cloud storage mode is characterized in that: The key usage phase at the data user DU is divided into the key preprocessing phase and the key restricted use phase, which are implemented through the key binding monotonic counter sub-process, key loading sub-process and key storage sub-process. The key preprocessing stage includes that after the DU end and the DO end interact and execute the key migration process, the DU end executes a key binding monotonic counter sub-process once, and then executes a key storage sub-process once; The key restricted use phase includes the DU end executing the key loading sub-process after executing the key migration process and the key pre-processing phase. If the key is loaded successfully, the key management module KMM on the DU side will pass the FEK to the file decryption module FDM on the DU side. The file decryption module FDM on the DU side calls the sgx_rijndael128GCM_decrypt() method provided by the SGX API to decrypt E through FEK. FEK (File) obtains the plaintext file File, returns File to the file processing module FPM on the DU side, and feeds back the information of successful data access to the key management module KMM on the DU side; the DU side executes the key storage sub-process; If the key loading fails, and the related information of the key loading failure is that the key has exceeded the maximum number of times it has been used, you need to re-execute the key migration process to obtain the FEK in ciphertext form from the DO end, and store the key securely locally through the key preprocessing stage.
5. According to claim 4, the key usage count management method based on SGX in the cloud storage mode is characterized in that: The key binding monotonic counter sub-process, The following steps are included: C1) The key management module KMM on the DU side calls the RSA decryption method sgx_rsa_priv_decrypt_sha256() provided by the SGX API and uses the private key MigrtKey_pri to decrypt E MigrtKey_pub (FEK||MAX_TIMES) gets FEK and MAX_TIMES, and destroys MigrtKey_pri by releasing the memory; C2) The key management module KMM at the DU end initiates a request to create a monotonic counter MC to the monotonic counter management module MCMM at the DU end; C3) The monotonic counter management module MCMM on the DU side calls the monotonic counter generation method sgx_create_monotonic_counter() provided by the SGX API to create a monotonic counter MC for FEK, sets the initial value of MC to 0, creates a variable MC_VALUE to save the value of MC, and passes the MC identifier MC_ID and MC_VALUE value to the key management module KMM on the DU side; C4) The key management module KMM at the DU end creates a variable CUR_TIMES to record the current value of the monotonic counter MC, and assigns the MC_VALUE value to CUR_TIMES; The key loading sub-process, The following steps are included: D1) The key migration module KMIM at the DU end uses ID File Read Seal from the local file system DU (KeyInfo), if Seal DU (KeyInfo) If the reading fails, the corresponding key loading failure information is returned; Otherwise, Seal DU (KeyInfo) is transmitted to the key management module KMM on the DU side; D2) The key management module KMM on the DU side calls the data decryption method sgx_unseal_data() provided by the SGX API to decrypt the seal. DU (KeyInfo) performs deseal operation to obtain FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest; D3) The key management module KMM on the DU side calls the hash value calculation method sgx_sha256_msg() provided by the SGX API to calculate the hash value digest'=hash(FEK||MAX_TIMES||CUR_TIMES||MC_ID) of FEK, MAX_TIMES, CUR_TIMES, and MC_ID, and determines whether digest' is the same as digest. If digest' is not equal to digest, it means that the data in the file system is damaged, and the corresponding key loading failure information is returned; Otherwise, execute D4); D4) The key management module KMM at the DU end transmits the MC_ID to the monotonic counter management module MCMM; D5) The monotonic counter management module MCMM at the DU end calls the monotonic counter value reading method sgx_read_monotonic_counter() provided by the SGX API to read the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID; if the MC_VALUE reading fails, it means that the MC has been deleted, and the corresponding key loading failure information is returned; otherwise, the read MC value MC_VALUE is returned to the key management module KMM; D6) The key management module KMM at the DU end compares the value MC_VALUE of the MC just obtained with the previously stored value CUR_TIMES. If MC_VALUE is not equal to CUR_TIMES, it means that a replay attack has occurred, and returns the corresponding key loading failure information; otherwise, execute D7); D7) The key management module KMM at the DU end compares CUR_TIMES and MAX_TIMES. If CUR_TIMES>MAX_TIMES, it means that the current usage count of FEK has exceeded the maximum usage count, and the corresponding key loading failure information is returned; Otherwise, it returns the key loading success information and transmits the FEK to the file decryption module FDM on the DU side; The key storage sub-process, The following steps are included: E1) The key management module KMM at the DU end transmits the identifier MC_ID of the monotonic counter MC to the monotonic counter management module MCMM at the DU end; E2) The monotonic counter management module MCMM at the DU end calls the monotonic counter value update method sgx_increment_monotonic_counter() provided by the SGX API to increase the value MC_VALUE of the monotonic counter MC corresponding to the MC_ID by 1, and transmits the increased MC_VALUE value to the KMM; E3) The key management module KMM on the DU side assigns the obtained MC_VALUE value to CUR_TIMES, and calls the hash value calculation method sgx_sha256_msg() provided by the SGX API to calculate the hash value of FEK, MAX_TIMES, CUR_TIMES, and MC_ID digest=hash(FEK||MAX_TIMES||CUR_TIMES||MC_ID); E4) The key management module KMM on the DU side calls the data sealing method sgx_seal_data_ex() provided by the SGX API to seal FEK, MAX_TIMES, CUR_TIMES, MC_ID and digest to obtain the sealed data Seal DU (KeyInfo), Seal DU (KeyInfo) and ID File After association, the key is transmitted to the key migration module KMIM at the DU end; E5) The key migration module KMIM at the DU end transfers ID File With Seal DU (KeyInfo) is stored in the local file system.
6. A system for implementing the SGX-based key usage management method in the cloud storage mode described in any one of claims 1 to 5, comprising a data owner DO end and a data user DU end.
7. A computer-readable storage medium, comprising instructions, which, when executed on a computer, enables the computer to execute the SGX-based key usage management method in a cloud storage mode as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Key usage count management method based on trusted platform module in cloud storage mode
CN103138939B
Secret key use time management method based on credible platform module under cloud storage mode
CN103138939A
Key security management system and method based on SGX
CN109150517A
Secure cloud storage method based on SGX
CN110138799A
Data security management system
US20150244684A1
