A proxy re-encryption method based on SM2 collaborative algorithm
By sharding the private key and cooperating with the collaborative server, it solves the problem of low private key security in traditional proxy re-encryption, improves the security and difficulty of the private key, and is suitable for encryption with hardware encryption locks and without hardware. Lock terminal scenarios to ensure data security and access efficiency.
Patent Information
- Application Number
- CN202410181253.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-02-18
Smart Images

Figure CN118018196B
Abstract
Description
Technical Field
[0001] The present invention relates to a data proxy re-encryption technology in the field of cryptography, and in particular to a proxy re-encryption method based on an SM2 collaborative algorithm. Background Art
[0002] As cloud storage of data becomes mainstream and data scenarios become increasingly diverse, users have more processing needs for data stored in the cloud: for example, they need to distribute files to recipients. The traditional file distribution model has the problem of leaking user stored data or increasing the user's computing burden. To solve this problem, proxy re-encryption technology has emerged. After data is encrypted, it is stored in the cloud. When other users are authorized to access the data, the cloud can use the proxy re-encryption key to convert the data ciphertext into re-encrypted ciphertext that can be decrypted by other users. This not only solves the problem of user stored data leakage, but also avoids the computing burden of users having to frequently decrypt and encrypt data ciphertext.
[0003] However, in traditional proxy re-encryption algorithms, users usually hold the complete private key. Since the terminal without a hardware encryption lock has poor security protection capabilities, users cannot effectively protect their private keys in application scenarios where the terminal does not have a hardware encryption lock. Therefore, in terms of the security of the private key, only the user holding the complete private key affects the security of network services to a certain extent. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention aims to provide a proxy re-encryption method based on the SM2 collaborative algorithm, which fragments the private key while maintaining the characteristics of the proxy re-encryption, thereby solving the problem of low security of the private key in the prior art. The specific technical solution is as follows:
[0005] A proxy re-encryption method based on the SM2 collaborative algorithm, characterized in that: it includes a data sender A, a data receiver B, a collaborative server and a cloud, and specifically includes the following steps:
[0006] S1: Data sender A and data receiver B work together with the collaboration server to generate user-side private key shards and collaboration-side private key shards and Or generate a complete private key and , generate and publish the public key and ;
[0007] S2: Data sender A uses its own public key Generate data initial ciphertext , and send it to cloud storage;
[0008] S3: If the data sender A holds the private key fragment, execute step S4 and jump to step S6; if the data sender A holds the complete private key, jump directly to step S5;
[0009] S4: Data sender A shards data based on the user's private key , the public key of the data requester B Shard with the collaboration server based on the collaboration server's private key Perform collaborative operations to generate proxy re-encryption keys With elliptic curve points And send it to the cloud;
[0010] S5: Data sender A uses the complete private key , the public key of the data recipient B Generate proxy re-encryption keys With elliptic curve points And send it to the cloud;
[0011] S6: The cloud uses the initial ciphertext Re-encrypting keys with a proxy Perform re-encryption operation to generate re-encrypted ciphertext , and send the re-encrypted ciphertext With elliptic curve points To data recipient B;
[0012] S7: If the data recipient B holds the private key shard, execute step S8; if the data recipient B holds the complete private key, jump directly to step S9;
[0013] S8: Data receiver B re-encrypts the ciphertext , user-side private key sharding and elliptic curve points Shard with the collaboration server based on the collaboration server's private key Perform collaborative decryption operations to generate data plaintext;
[0014] S9: Data receiver B re-encrypts the ciphertext , full private key and elliptic curve points Perform decryption operations to generate data plaintext.
[0015] Furthermore, the data sender A, the data receiver B, the collaborative server and the cloud share the elliptic curve parameters of the SM2 algorithm. , where the elliptic curve For a finite field The elliptic curve on For elliptic curve superior The base point of the order, Generate the order of the element to meet the safety requirements.
[0016] Furthermore, the S1 stage includes the following steps:
[0017] S11. Data sender A (or data receiver B) generates a A random number between
[0018] S12. Determine the type of private key that the user will hold. If the user will hold a complete private key, execute step S13 and jump to step S16; if the user will hold a fragmented private key, jump to step S14;
[0019] S13. Use the generated random number as the complete private key , the user generates a public key ;
[0020] S14. Use the generated random number as the client private key shard (or ), data sender A (or data receiver B) generates a partial public key (or ),Will (or ) is sent to the collaboration server;
[0021] S15. The collaborative server generates a The random number between the two is used as the private key shard of the collaboration end. (or ),according to (or ) Generate user public key (or );
[0022] S16. The user's public key (or )public.
[0023] Further: The S2 stage includes the following steps:
[0024] S21. Data sender A generates a random number ;
[0025] S22. Data sender A calculates the elliptic curve point ;
[0026] S23. Data sender A calculates the elliptic curve point ;
[0027] S24. Data sender A generates partial ciphertext , and perform the following calculations:
[0028] ;
[0029] ;
[0030] S25. Data sender A calculates the hash value ;
[0031] S26. Data sender A outputs ciphertext to cloud storage.
[0032] Further: The S4 stage includes the following steps:
[0033] S41. Data sender A sends the public key of data requester B Request the collaboration server to generate a proxy re-encryption key;
[0034] S42. Collaborative server selects random number , and calculate the elliptic curve point ;
[0035] S43. The collaborative server receives the public key of the data requester B. Compute elliptic curve points ;
[0036] S44. The collaborative server generates a partial proxy re-encryption key , perform the following calculations:
[0037] ;
[0038] ;
[0039] S45. The collaborative server returns part of the proxy re-encryption key , elliptic curve point To data sender A;
[0040] S46. Data sender A selects a random number , and calculate the elliptic curve point ;
[0041] S47. Data sender A uses the public key of data receiver B Compute elliptic curve points ;
[0042] S48. Data sender A re-encrypts the key based on the partial proxy Generate full proxy re-encryption key , and perform the following calculations:
[0043] ;
[0044] ;
[0045] S49. Data sender A sends the complete proxy re-encryption key , elliptic curve point To the cloud.
[0046] Further: The S5 stage includes the following steps:
[0047] S51. Data sender A selects a random number , and calculate the elliptic curve point ;
[0048] S52. Data sender A uses the public key of data receiver B Compute elliptic curve points ;
[0049] S53. Data sender A generates a complete proxy re-encryption key , and perform the following calculations:
[0050] ;
[0051] ;
[0052] ;
[0053] S54. Data sender A sends the complete proxy re-encryption key , elliptic curve point To the cloud.
[0054] Further: The S6 stage includes the following steps:
[0055] S61. The cloud starts from the initial ciphertext Get ;
[0056] S62. The cloud re-encrypts the key based on the proxy ,calculate ;
[0057] S63. Send re-encrypted ciphertext to the cloud With elliptic curve points To data recipient B.
[0058] Furthermore, the S8 stage includes the following steps:
[0059] S81. Data receiver B sends elliptic curve point Request collaborative computing from the collaborative server;
[0060] S82. The collaboration server shards according to the collaboration client private key Compute elliptic curve points , send elliptic curve point To data recipient B;
[0061] S83. Data receiver B fragments data according to the user's private key , elliptic curve point , re-encrypt the ciphertext , the public key of data receiver B and elliptic curve points Generate elliptic curve points , perform the following calculations:
[0062] ;
[0063] ;
[0064] ;
[0065] S84. Data receiver B re-encrypts the ciphertext Generate plaintext , perform the following calculations:
[0066] ;
[0067] ;
[0068] S85. Data recipient B calculates the hash value ;
[0069] S86. Data recipient B determines the Is it equal to , if so, As the data plain text.
[0070] Furthermore, the S9 stage includes the following steps:
[0071] S91. Data recipient B uses the complete private key , re-encrypt the ciphertext , the public key of data receiver B and elliptic curve points Generate elliptic curve points , perform the following calculations:
[0072] ;
[0073] ;
[0074] ;
[0075] S92. Data receiver B re-encrypts the ciphertext Generate plaintext , perform the following calculations:
[0076] ;
[0077] ;
[0078] S93. Data receiver B calculates hash value ;
[0079] S94. The data receiving party B determines the Is it equal to , if so, As the data plain text.
[0080] The beneficial effects of the present invention are:
[0081] 1. Users can choose to hold different types of private keys, taking into account the application scenarios of users with or without hardware encryption lock terminals: In the application scenario of users with hardware encryption lock terminals, users hold the complete private key and can directly perform decryption and authorization operations; in the application scenario of users without hardware encryption lock terminals, users hold private key shards and need to perform collaborative calculations with the collaborative server to complete decryption and authorization operations, which can avoid being invaded by malware or hackers, and is particularly suitable for application scenarios such as mobile Internet and Internet of Things;
[0082] 2. By sharding the private key in the algorithm, the user and the collaborative server hold the private key shards respectively and complete the operation involving the private key through collaborative operation, it is ensured that the attacker cannot obtain the complete user private key when invading any party, thereby increasing the difficulty for the attacker to steal the private key and greatly improving the security of the private key without affecting the sharing and access efficiency of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1 It is a flow chart of the proxy re-encryption method based on the SM2 collaborative algorithm of the present invention; DETAILED DESCRIPTION
[0084] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.
[0085] The present invention proposes a proxy re-encryption scheme based on the SM2 collaborative algorithm, and specific description symbols and definitions are given below.
[0086]
[0087] The elliptic curve parameters involved in the present invention are set according to the national secret SM2 algorithm standard. Data sender A, data requester B, cloud and collaborative server share the elliptic curve parameters of the SM2 algorithm , the elliptic curve over the finite field is , whose base point is ,and The order of is a prime number .
[0088] like Figure 1 As shown, the proxy re-encryption method based on the SM2 collaborative algorithm includes the following steps:
[0089] S1: Data sender A and data receiver B work together with the collaboration server to generate user-side private key shards and collaboration-side private key shards and , generate and publish the public key and ; In the application scenario of the terminal without hardware encryption lock, the private key can be divided into two parts; or the data sender A and the data receiver B generate a complete private key and (Generate a complete private key without the participation of the collaborative server), generate and publish the public key and ; In the application scenario of a terminal with a hardware encryption lock, directly generate a complete private key for the user;
[0090] As an optional implementation scheme of the present invention, two types of keys can be provided, which are respectively suitable for application scenarios of terminals with hardware encryption locks and terminals without hardware encryption locks, thereby meeting different needs of users.
[0091] Specifically, step S1 includes:
[0092] S11. Data sender A (or data receiver B) generates a A random number between
[0093] S12. Determine the type of private key that the user will hold. If the user will hold a complete private key, execute step S13 and jump to step S16; if the user will hold a shard of the private key, jump to step S14; (the order of steps executed by the user holding the complete private key is S11→S12→S13→S16; the order of steps executed by the user holding a shard of the private key is S11→S12→S14→S15→S16);
[0094] S13. Use the generated random number as the complete private key , the user generates a public key ;
[0095] S14. Use the generated random number as the client private key shard (or ), data sender A (or data receiver B) generates a partial public key (or ),Will (or ) is sent to the collaboration server;
[0096] S15. The collaborative server generates a The random number between the two is used as the private key shard of the collaboration end. (or ),according to (or ) Generate user public key (or );
[0097] S16. The user's public key (or )public.
[0098] In this technical solution, part of the private key is stored on the user's terminal, and the other part is stored in the collaborative server, realizing the secure distributed storage of the private key. In this way, even if the user's terminal or the collaborative server is attacked or cracked, the user's complete private key cannot be obtained, thereby protecting the user's data security. This technology can effectively improve the security and difficulty of private keys without affecting the sharing and access efficiency of data.
[0099] As an optional implementation scheme of the present invention, in an application scenario with a hardware encryption lock terminal, the user holds a complete private key and can directly perform decryption and authorization operations; in an application scenario without a hardware encryption lock terminal or with a terminal device with low security protection capabilities, the user holds a part of the private key, called a key shard, and needs to perform collaborative calculations with the collaborative server to complete decryption and authorization operations. The present application shards the private key in the algorithm, which not only maintains the advantage of proxy re-encryption in reducing communication costs during data transmission, but also improves the security of the private key.
[0100] S2: Data sender A uses the public key of data sender A Generate data initial ciphertext , and send it to cloud storage;
[0101] Specifically, step S2 includes:
[0102] S21. Data sender A generates a random number ;
[0103] S22. Data sender A calculates the elliptic curve point ;
[0104] S23. Data sender A calculates the elliptic curve point ;
[0105] S24. Data sender A generates partial ciphertext , and perform the following calculations:
[0106] ;
[0107] ;
[0108] S25. Data sender A calculates the hash value ;
[0109] S26. Data sender A outputs ciphertext to cloud storage.
[0110] S3: If the data sender A holds the private key fragment, execute step S4 and jump to step S6; if the data sender A holds the complete private key, jump directly to step S5;
[0111] S4: Data sender A shards data based on the user's private key , the public key of the data requester B Shard with the collaboration server based on the collaboration server's private key Perform collaborative operations to generate proxy re-encryption private key With elliptic curve points And send it to the cloud;
[0112] Specifically, step S4 includes:
[0113] S41. Data sender A sends the public key of data requester B Request the collaboration server to generate a proxy re-encryption key;
[0114] S42. Collaborative server selects random number , and calculate the elliptic curve point ;
[0115] S43. The collaborative server receives the public key of the data requester B. Compute elliptic curve points ;
[0116] S44. The collaborative server generates a partial proxy re-encryption key , perform the following calculations:
[0117] ;
[0118] ;
[0119] S45. The collaborative server returns part of the proxy re-encryption key , elliptic curve point To data sender A;
[0120] S46. Data sender A selects a random number , and calculate the elliptic curve point ;
[0121] S47. Data sender A uses the public key of data receiver B Compute elliptic curve points ;
[0122] S48. Data sender A re-encrypts the key based on the partial proxy Generate full proxy re-encryption key , and perform the following calculations:
[0123] ;
[0124] ;
[0125] S49. Data sender A sends the complete proxy re-encryption key , elliptic curve point To the cloud.
[0126] .S5: Data sender A uses the complete private key , the public key of the data recipient B Generate proxy re-encryption keys With elliptic curve points And send it to the cloud;
[0127] Specifically, step S5 includes:
[0128] S51. Data sender A selects a random number , and calculate the elliptic curve point ;
[0129] S52. Data sender A uses the public key of data receiver B Compute elliptic curve points ;
[0130] S53. Data sender A generates a complete proxy re-encryption key , and perform the following calculations:
[0131] ;
[0132] ;
[0133] ;
[0134] S54. Data sender A sends the complete proxy re-encryption key , elliptic curve point To the cloud.
[0135] S6: The cloud uses the initial ciphertext Re-encrypting keys with a proxy Perform re-encryption operation to generate re-encrypted ciphertext , and send the re-encrypted ciphertext With elliptic curve points To data recipient B;
[0136] Specifically, step S6 includes:
[0137] S61. The cloud starts from the initial ciphertext Get ;
[0138] S62. The cloud re-encrypts the key based on the proxy ,calculate ;
[0139] S63. Send re-encrypted ciphertext to the cloud With elliptic curve points To data recipient B.
[0140] S7: If the data recipient B holds the private key shard, execute step S8; if the data recipient B holds the complete private key, jump directly to step S9;
[0141] S8: Data receiver B re-encrypts the ciphertext , user-side private key sharding and elliptic curve points Shard with the collaboration server based on the collaboration server's private key Perform collaborative decryption operations to generate data plaintext;
[0142] Specifically, step S8 includes:
[0143] S81. Data receiver B sends elliptic curve point Request collaborative computing from the collaborative server;
[0144] S82. The collaboration server shards according to the collaboration client private key Compute elliptic curve points , send elliptic curve point To data recipient B;
[0145] S83. Data receiver B fragments data according to the user's private key , elliptic curve point , re-encrypt the ciphertext , the public key of data receiver B and elliptic curve points Generate elliptic curve points , perform the following calculations:
[0146] ;
[0147] ;
[0148] ;
[0149] S84. Data receiver B re-encrypts the ciphertext Generate plaintext , perform the following calculations:
[0150] ;
[0151] ;
[0152] S85. Data recipient B calculates the hash value ;
[0153] S86. Data recipient B determines the Is it equal to , if so, As the data plain text.
[0154] S9: Data receiver B re-encrypts the ciphertext , full private key and elliptic curve points Perform decryption operations to generate data plaintext.
[0155] Specifically, step S9 includes:
[0156] S91. Data recipient B uses the complete private key , re-encrypt the ciphertext , the public key of data receiver B and elliptic curve points Generate elliptic curve points , perform the following calculations:
[0157] ;
[0158] ;
[0159] ;
[0160] S92. Data receiver B re-encrypts the ciphertext Generate plaintext , perform the following calculations:
[0161] ;
[0162] ;
[0163] S93. Data receiver B calculates hash value ;
[0164] S94. The data receiving party B determines the Is it equal to , if so, As the data plain text.
[0165] In summary, the present invention shards the private key in the algorithm. When storing data in the cloud and accessing cloud data, the user (data sender A and data requester B) and the collaborative server respectively hold the private key shards and complete the operation involving the private key through collaborative operation, ensuring that the attacker cannot obtain the complete user private key when invading any party, thereby increasing the difficulty for the attacker to steal the private key and greatly improving the security of the private key. Therefore, by choosing to hold different types of private keys, the user takes into account the application scenarios of the user with or without a hardware encryption lock terminal: in the application scenario of the user with a hardware encryption lock terminal, the user holds the complete private key; in the application scenario of the user without a hardware encryption lock terminal, the user holds the private key shard; the present invention provides two types of keys to meet the different needs of users.
[0166] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A proxy re-encryption method based on the SM2 collaborative algorithm, characterized in that: Including data sender A, data receiver B, cloud and collaboration server, specifically including the following steps: S1: Data sender A and data receiver B work together with the collaboration server to generate user-side private key shards and collaboration-side private key shards and Or generate a complete private key and , generate and publish the public key and ; S2: Data sender A uses the public key of data sender A Generate data initial ciphertext , and send it to cloud storage; S3: If the data sender A holds the private key fragment, execute step S4 and jump to step S6; if the data sender A holds the complete private key, jump directly to step S5; S4: Data sender A shards data based on the user's private key , the public key of the data requester B Shard with the collaboration server based on the collaboration server's private key Perform collaborative operations to generate proxy re-encryption keys With elliptic curve points And send it to the cloud; S5: Data sender A uses the complete private key , the public key of the data recipient B Generate proxy re-encryption keys With elliptic curve points And send it to the cloud; S6: The cloud uses the initial ciphertext Re-encrypting keys with a proxy Perform re-encryption operation to generate re-encrypted ciphertext , and send the re-encrypted ciphertext With elliptic curve points To data recipient B; S7: If the data recipient B holds the private key shard, execute step S8; if the data recipient B holds the complete private key, jump directly to step S9; S8: Data receiver B re-encrypts the ciphertext , user-side private key sharding and elliptic curve points Shard with the collaboration server based on the collaboration server's private key Perform collaborative decryption operations to generate data plaintext; S9: Data receiver B re-encrypts the ciphertext , full private key and elliptic curve points Perform decryption operations to generate data plaintext.
2. The proxy re-encryption method based on the SM2 collaborative algorithm as claimed in claim 1, characterized in that: The data sender A, the data receiver B, the cloud and the collaborative server share the elliptic curve parameters of the SM2 algorithm , where the elliptic curve For a finite field The elliptic curve on To meet the safety requirements, the order of the generated element is For elliptic curve superior The base point of the stage.
3. The proxy re-encryption method based on the SM2 collaborative algorithm as claimed in claim 2, characterized in that: The data sender A uses the user's private key to shard Sharding of the collaboration server's private key Collaborative generation of proxy re-encryption keys includes: Data sender A sends the public key To the collaboration server; Collaboration server generates random numbers , and generate elliptic curve points ; The collaboration server uses the public key Calculating the hash value , calculate the partial proxy re-encryption key , sending the partial proxy re-encryption key and elliptic curve points To data sender A; Data sender A generates a random number , and generate elliptic curve points ; Data sender A uses the public key Calculating the hash value , calculate the proxy re-encryption key ; Data sender A sends the proxy re-encryption key and elliptic curve points To the cloud.
4. The proxy re-encryption method based on the SM2 collaborative algorithm as claimed in claim 3, characterized in that: The data sender A uses the complete private key Generating a proxy re-encryption key involves: Data sender A generates a random number , and generate elliptic curve points ; Data sender A uses the public key Calculating the hash value , calculate the proxy re-encryption key ; Data sender A sends the data to the proxy for re-encryption and elliptic curve points To the cloud.
5. The proxy re-encryption method based on the SM2 collaborative algorithm according to claim 4 is characterized in that: The cloud is based on the initial ciphertext Re-encrypting keys with a proxy Methods for performing re-encryption operations include: The cloud receives the ciphertext Get ; The cloud re-encrypts the key based on the proxy Calculate partially re-encrypted ciphertext ; The cloud generates a re-encrypted ciphertext , and re-encrypt the ciphertext With elliptic curve points Send to data recipient B.
6. The proxy re-encryption method based on the SM2 collaborative algorithm according to claim 5 is characterized in that: The data receiver B uses the user's private key to shard Sharding of the collaborative client private key with the collaborative server Collaborative decryption includes: The data receiver B sends the elliptic curve point Request the collaborative server to perform collaborative decryption; The collaboration server is divided into pieces according to the collaboration client private key Compute elliptic curve points , sending the elliptic curve point To data recipient B; The data receiver B uses the elliptic curve point , public key , user-side private key sharding Calculating the hash value : ; The data receiver B determines the hash value based on the and re-encrypted ciphertext Compute elliptic curve points ; The data receiver B uses the elliptic curve point Generate data plaintext : ; The data receiver B uses the elliptic curve point , data plaintext Generate hash value , and determine whether the decryption is successful.
7. The proxy re-encryption method based on the SM2 collaborative algorithm according to claim 6 is characterized in that: The data recipient B uses the complete private key Decrypting and re-encrypting ciphertext includes: The data receiver B uses the elliptic curve point , public key , full private key Calculating the hash value ; The data receiver B determines the hash value based on the and re-encrypted ciphertext Compute elliptic curve points ; The data receiver B uses the elliptic curve point Generate data plaintext : ; The data receiver B uses the elliptic curve point , data plaintext Generate hash value , and determine whether the decryption is successful.
