[go: up one dir, main page]

CN120185906A - A model file distribution method, device, storage medium and processor - Google Patents

A model file distribution method, device, storage medium and processor Download PDF

Info

Publication number
CN120185906A
CN120185906A CN202510421183.2A CN202510421183A CN120185906A CN 120185906 A CN120185906 A CN 120185906A CN 202510421183 A CN202510421183 A CN 202510421183A CN 120185906 A CN120185906 A CN 120185906A
Authority
CN
China
Prior art keywords
model
key
encryption
user
owner
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202510421183.2A
Other languages
Chinese (zh)
Inventor
黄超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pacific Insurance Technology Co Ltd
Original Assignee
Pacific Insurance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pacific Insurance Technology Co Ltd filed Critical Pacific Insurance Technology Co Ltd
Priority to CN202510421183.2A priority Critical patent/CN120185906A/en
Publication of CN120185906A publication Critical patent/CN120185906A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Algebra (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)

Abstract

本申请公开了一种模型文件分发方法、装置、存储介质及处理器。该方案中,密钥生成中心基于模型拥有者的标识符生成模型拥有者的密钥数据,基于模型使用者的标识符生成模型使用者的密钥数据;模型拥有者基于加密元素和主公钥对原始模型文件进行加密,并生成重加密密钥,将加密元素、重加密密钥和加密后的模型文件发送给密钥代理中心;密钥代理中心基于加密元素和重加密密钥,生成重加密密文,将重加密密文和加密后的模型文件发送给模型使用者;模型使用者基于模型使用者的密钥数据、重加密密文和主公钥对加密后的模型文件进行解密,得到原始模型文件。相较于模型文件分发过程中存在安全性差和加解密的效率低的问题,本申请具有明显的优势。

The present application discloses a model file distribution method, device, storage medium and processor. In the scheme, a key generation center generates key data of a model owner based on an identifier of the model owner, and generates key data of a model user based on an identifier of a model user; the model owner encrypts the original model file based on an encryption element and a master public key, generates a re-encryption key, and sends the encryption element, the re-encryption key and the encrypted model file to a key proxy center; the key proxy center generates a re-encrypted ciphertext based on the encryption element and the re-encryption key, and sends the re-encrypted ciphertext and the encrypted model file to the model user; the model user decrypts the encrypted model file based on the key data, the re-encrypted ciphertext and the master public key of the model user to obtain the original model file. Compared with the problems of poor security and low efficiency of encryption and decryption in the process of model file distribution, the present application has obvious advantages.

Description

Model file distribution method, device, storage medium and processor
Technical Field
The present application relates to the field of data transmission technologies, and in particular, to a method and apparatus for distributing a model file, a storage medium, and a processor.
Background
At present, along with development of large model technology, the cost of training large models is continuously increased, and particularly for ultra-large scale models with parameters exceeding 100B, the models not only need huge computing resources and a large number of data sets to pretrain, but also need Fine-tuning (Fine-tuning) of the pretrained large models in specific business scenes, so that the models can effectively adapt to different business demands of companies. After the big model is pre-trained and fine-tuned, the network structure and the weight file of the big model are respectively saved into binary files, and the binary files are simply called model files. Thus, the model file serves as a core output, and security during distribution is extremely important.
However, the data volume of the model file is large, and in the distribution process of the model file, the encryption and decryption efficiency is low.
Therefore, how to improve encryption and decryption efficiency under the condition of ensuring the security of the model file in the distribution process is a technical problem to be solved.
Disclosure of Invention
Based on the above problems, the application provides a method, a device, a storage medium and a processor for distributing model files, which aim to improve encryption and decryption efficiency under the condition of ensuring the safety of the model files in the distribution process.
The embodiment of the application discloses the following technical scheme:
The first aspect of the present application provides a model file distribution method, which includes:
the key generation center generates key data of the model owner based on the identifier of the model owner, and generates key data of the model user based on the identifier of the model user;
Encrypting an original model file by a model owner based on an encryption element and a main public key to obtain an encrypted model file, generating a re-encryption key based on key data of the model owner and a public key of a model user, and transmitting the encryption element, the re-encryption key and the encrypted model file to a key agent center;
The key agent center generates a re-encryption ciphertext based on the encryption element and the re-encryption key, and sends the re-encryption ciphertext and the encrypted model file to a model user;
And the model user decrypts the encrypted model file based on the key data of the model user, the re-encrypted ciphertext and the main public key to obtain an original model file.
Optionally, the model owner encrypts the original model file based on the encryption element and the master public key to obtain an encrypted model file, generates a re-encryption key based on the key data of the model owner and the public key of the model user, and sends the encryption element, the re-encryption key and the encrypted model file to a key proxy center, including:
the model owner determines an encryption element based on the random number and a public key of the model user;
The model owner calculates an encryption key based on the encryption element and the main public key;
encrypting the original model file by using the encryption key to obtain an encrypted model file;
generating a re-encryption key based on the key data of the model owner and the public key of the model user;
and sending the encryption element, the re-encryption key and the encrypted model file to a key proxy center.
Optionally, the model owner calculates an encryption key based on the encryption element and the master public key, including:
The model owner calculates an encryption key by using bilinear pairing based on the encryption element and a main public key, wherein the main public key is generated by a key generation center based on a BLS12-381 elliptic curve.
Optionally, the key generating center generates key data of the model owner based on the identifier of the model owner, generates key data of the model user based on the identifier of the model user, and includes:
the key generation center respectively maps the identifier of the model owner and the identifier of the model user to the BLS12-381 elliptic curve by using a public hash function based on the identifier of the model owner and the identifier of the model user to obtain a public key of the model owner and a public key of the model user;
generating a private key of the model owner based on the master private key and the public key of the model owner;
generating a private key of the model user based on the master private key and the public key of the model user;
The key data of the model owner comprises a public key of the model owner and a private key of the model owner, the key data of the model user comprises the public key of the model user and the private key of the model user, and the main private key is generated by a key generation center based on a BLS12-381 elliptic curve.
Optionally, the model user decrypts the encrypted model file based on the key data of the model user, the re-encrypted ciphertext and the master public key to obtain an original model file, which includes:
the model user calculates an encryption key based on the key data of the model user, the re-encryption ciphertext and the main public key, and decrypts the encrypted model file based on the encryption key to obtain an original model file.
A second aspect of the present application provides a model file distribution apparatus, comprising:
A key generation module for generating key data of the model owner based on the identifier of the model owner by the key generation center, and generating key data of the model user based on the identifier of the model user;
the encryption module is used for encrypting the original model file based on the encryption element and the main public key to obtain an encrypted model file, generating a re-encryption key based on the key data of the model owner and the public key of the model user, and sending the encryption element, the re-encryption key and the encrypted model file to the key agent center;
The proxy re-encryption module is used for generating a re-encryption ciphertext by the key proxy center based on the encryption element and the re-encryption key and sending the re-encryption ciphertext and the encrypted model file to a model user;
and the decryption module is used for decrypting the encrypted model file by the model user based on the key data of the model user, the re-encrypted ciphertext and the main public key to obtain an original model file.
Optionally, the encryption module is specifically configured to:
the model owner determines an encryption element based on the random number and a public key of the model user;
The model owner calculates an encryption key based on the encryption element and the main public key;
encrypting the original model file by using the encryption key to obtain an encrypted model file;
generating a re-encryption key based on the key data of the model owner and the public key of the model user;
and sending the encryption element, the re-encryption key and the encrypted model file to a key proxy center.
Optionally, the encryption module is specifically configured to:
The model owner calculates an encryption key by using bilinear pairing based on the encryption element and a main public key, wherein the main public key is generated by a key generation center based on a BLS12-381 elliptic curve.
A third aspect of the present application provides a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements a model file distribution method as provided in any of the implementations of the first aspect.
A fourth aspect of the present application provides a processor for running a computer program which when run performs a model file distribution method as provided in any of the implementations of the first aspect.
Compared with the prior art, the application has the following beneficial effects:
According to the model file distribution method provided by the application, the key generation center generates corresponding key data for different users, and a foundation is laid for the whole process. The model owner encrypts the original model file and generates a re-encryption key, so that the confidentiality of the model file is ensured, and the accurate control of the access authority of the model user is realized. The key proxy center performs a proxy re-encryption operation to generate re-encryption ciphertext specific to the user of the given model, and this mechanism ensures that even the key proxy center cannot decrypt the data content alone, thereby further enhancing data security. After receiving the re-encrypted ciphertext, the model user decrypts the re-encrypted ciphertext, and then recovers the encrypted model file, so that only authorized model users can access the content of the model file, and other unauthorized users cannot decrypt or access the data.
In summary, the method for distributing the model file provided by the application ensures the safety of the model file in the distribution process and can flexibly manage the decryption authority of the user through the close coordination of key generation, data encryption, proxy re-encryption and data decryption links. In addition, the method simplifies the key management and distribution flow and greatly improves the efficiency of the encryption and decryption process.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the application, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flowchart of a method for distributing model files according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for distributing model files according to an embodiment of the present application;
FIG. 3 is an interface display diagram of a key generation center according to an embodiment of the present application;
FIG. 4 is an interface display diagram of encrypted data of a user according to an embodiment of the present application;
FIG. 5 is a diagram showing an interface for generating user encryption results according to an embodiment of the present application;
FIG. 6 is an interface display diagram of a key proxy center provided by an embodiment of the present application;
FIG. 7 is an interface display diagram of a key proxy center for generating a re-encrypted ciphertext according to an embodiment of the present application;
FIG. 8 is an interface display diagram of a user decryption center according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of a model file distribution device according to an embodiment of the present application.
Detailed Description
As described above, the model file serves as a core output, and security during distribution is extremely important. However, the data volume of the model file is large, and in the distribution process of the model file, the encryption and decryption efficiency is low.
In view of the above problems, the inventors have studied and proposed a model file distribution method, a device, a storage medium and a processor, wherein a key generation center generates key data of a model owner based on an identifier of the model owner, generates key data of the model user based on the identifier of the model user, encrypts an original model file based on an encryption element and a master public key to obtain an encrypted model file, generates a re-encryption key based on the key data of the model owner and the public key of the model user, sends the encryption element, the re-encryption key and the encrypted model file to a key proxy center, and generates a re-encryption ciphertext based on the encryption element and the re-encryption key, and sends the re-encryption ciphertext and the encrypted model file to the model user, and the model user decrypts the encrypted model file based on the key data of the model user, the re-encryption ciphertext and the master public key to obtain the original model file.
In order to make the present application better understood by those skilled in the art, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 1, the figure is a flowchart of a model file distribution method provided in an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
S101, the key generation center generates key data of the model owner based on the identifier of the model owner, and generates key data of the model user based on the identifier of the model user.
Wherein the key data includes a public key and a private key.
The key generation center generates key data corresponding to the identifier of the user (such as a mailbox address) according to the identifier of the user through the user registration, the private key of the user is kept by the user, the public key of the user is public, and meanwhile, the identifier of the registered user is disclosed. This way it is ensured that the system is able to perform key management safely and efficiently.
S102, the model owner encrypts an original model file based on the encryption element and the main public key to obtain an encrypted model file, generates a re-encryption key based on key data of the model owner and a public key of the model user, and sends the encryption element, the re-encryption key and the encrypted model file to a key agent center.
The encryption element is generated based on the random number and a public key of a model user, and the main public key is generated by a key generation center based on a BLS12-381 elliptic curve.
Model owners refer to owners or producers of original model files that have complete control over the model files, including deciding who can access the files and how to securely transmit and distribute the files. The model owner encrypts the original model file and generates a re-encryption key that allows the key proxy center to generate re-encrypted ciphertext based on the re-encryption key so that only the designated model user can decrypt.
BLS12-381 is a specially designed elliptic curve that is mainly used in modern cryptographic protocols, especially those that require efficient bilinear pairing operations. BLS12-381 is designed to provide about 128 bits of security strength while achieving as high efficiency as possible, particularly in terms of finite field arithmetic and pairing computations. A key feature of the curve is that it supports efficient bilinear pairing operations, which is a special function e: G 1×G2→GT, where G 1、G2 corresponds to different sets of points on the curve, and G 1、G2 has the same prime order, G T is the target group, and the result of bilinear pairing is located within this group.
The original model file is encrypted by the model owner, so that even if the encrypted model file is intercepted in the transmission process, an unauthorized third party cannot access the content of the model file, and the direct interaction with the model user is not needed. The re-encryption key is used, the transmission of the model file is indirectly completed through the key proxy center, the security is further enhanced, the access rights can be flexibly managed, and the differentiated access rights management of different users is realized by generating a unique re-encryption key for each authorized model user.
S103, the key agent center generates a re-encryption ciphertext based on the encryption element and the re-encryption key, and sends the re-encryption ciphertext and the encrypted model file to a model user.
The key proxy center is used as an intermediate party and is responsible for re-encryption operation. By using the re-encryption technique, the private key of the model owner does not need to be directly exposed to other parties, including the key proxy center, which reduces the risk of key disclosure and improves the security of the model file during distribution. Moreover, the key agent center cannot decrypt, so that effective sharing of sensitive data such as model files can be promoted on the premise of ensuring data security, and different model users can utilize the resources under the condition of obtaining authorization, thereby being beneficial to cooperation among cross organizations or departments.
S104, the model user decrypts the encrypted model file based on the key data of the model user, the re-encrypted ciphertext and the main public key to obtain an original model file.
A model user refers to a person or system that wishes to obtain and use a model file, which is the ultimate recipient, but requires an authorization and decryption process to access the original model file. The model owner can only decrypt the content that he or she is authorized to access, but cannot access unauthorized files. That is, the model file is always in an encrypted state during the whole distribution process from the time when the model owner encrypts the model file until the model user decrypts the model file, so that the security of data in transmission and storage is ensured.
In one implementation, the model owner may also be converted into a model user.
According to the model file distribution method provided by the embodiment of the application, the key generation center generates corresponding key data for different users, and a foundation is laid for the whole process. The model owner encrypts the original model file and generates a re-encryption key, so that the confidentiality of the model file is ensured, and the accurate control of the access authority of the model user is realized. The key proxy center performs a proxy re-encryption operation to generate re-encryption ciphertext specific to the user of the given model, and this mechanism ensures that even the key proxy center cannot decrypt the data content alone, thereby further enhancing data security. After receiving the re-encrypted ciphertext, the model user decrypts the re-encrypted ciphertext, and then recovers the encrypted model file, so that only authorized model users can access the content of the model file, and other unauthorized users cannot decrypt or access the data.
In summary, the method for distributing the model file according to the embodiment of the present application ensures the security of the model file during the distribution process and can flexibly manage the decryption authority of the user through the close coordination of the links of key generation, data encryption, proxy re-encryption and data decryption. In addition, the method simplifies the key management and distribution flow and greatly improves the efficiency of the encryption and decryption process.
On the basis of the above embodiment, in order to further perfect the model file distribution method, a step of generating a master public key and a master private key by a key generation center based on a BLS12-381 elliptic curve is added, and a case where a model owner is a user a, a model user is a user B, and the user B is authorized by the user a is taken as an example for explanation.
Referring to fig. 2, a flowchart of another model file distribution method according to an embodiment of the present application is shown. As shown in fig. 2, the method comprises the steps of:
s201, the key generation center generates a main public key and a main private key based on the BLS12-381 elliptic curve.
In one implementation, the BLS12-381 elliptic curve supports efficient bilinear pairing, i.e., e: G 1×G2→GT, where G 1、G2 is the elliptic curve group and G 1、G2 has the same prime order and G T is the target group. Assuming that g 1、g2 is an arbitrary solution to the elliptic curve, the bilinear property e (g 1 a,g2 b)=e(g1,g2)ab) is satisfied.
The key generation center is responsible for generating a master public key (Master Public Key, MPK) and a master private key (MASTER SECRET KEY, MSK) of the system, which is maintained by the key generation center, using the MSK to generate a unique private key (SECRET KEY, SK) for each registered user.
S202, the key generation center generates key data of the user A based on the identifier of the user A, and generates key data of the user B based on the identifier of the user B.
In one possible implementation:
the key generation center respectively maps the identifier of the model owner and the identifier of the model user to the BLS12-381 elliptic curve by using a public hash function based on the identifier of the model owner and the identifier of the model user to obtain a public key of the model owner and a public key of the model user;
generating a private key of the model owner based on the master private key and the public key of the model owner;
generating a private key of the model user based on the master private key and the public key of the model user;
The key data of the model owner comprises a public key of the model owner and a private key of the model owner, the key data of the model user comprises the public key of the model user and the private key of the model user, and the main private key is generated by a key generation center based on a BLS12-381 elliptic curve.
When a user registers, the key generation center generates key data corresponding to the identifier of the user according to the identifier (such as a mailbox address) of the user, and the private key of the user is not disclosed. Meanwhile, the identifier of the registered user is disclosed, the identifier of the user is mapped to the BL S12-381 elliptic curve through the disclosed hash function, and a hash (userID) is obtained through calculation. As shown in fig. 3, fig. 3 illustrates, as an example, an interface of a key generation center, where the interface includes an input box of a user identifier (e.g., a mailbox address), an already generated Master Public Key (MPK), and a public key and a private key generated based on different user identifiers, the input box of the user identifier is used to prompt the user to input the user identifier, clicking a button to generate the public key and the private key corresponding to the user identifier, the already generated Master Public Key (MPK) is :1380691592326724594186135960003899382815651270322861796564223736022537818583 3738690941731901751466743117623235748761242938734920612499869064 0171607831011735349601200344259272762851318018659457840264368706 2933147068669610832139956982426041576255374550870270534456610541 1379513697297856815135739392728231442497838893142769609933949672 53460580639524582652822668114901647824109618695779619493790825352950224579353080395541641911023612676124063389561842845401889091,, the public key corresponding to the user identifier testme@1.2 is 21058861401728980663985884447021035405838484814814859811059094034177309945326, the private key corresponding to the user identifier testme@1.2 is 39491687549403370741353463161408421438259309576462671149757004186696432381700, and the public key corresponding to the user identifier testme@3.4 is 10468031010640112368260533098881573021287039179538204331633349877094358648507,testme@3.4 is 46732394198382223760902488200050195240791549827563437233593297174859079749569.
Illustratively, assume that user a's private key and hash (a) are skA and hA, and user B's private key and hash (B) are skB and hB, where ska=msk hash (a), skB =msk hash (B).
In this BLS12-381 elliptic curve and bilinear pairing based design, the user private keys skA and skB are generated from a combination of the master private key MSK and the user-specific hash values hA, hB. Because of the difficulty of the elliptic curve discrete logarithm problem, an attacker cannot reversely deduce the main private key MSK through the known private key and hash value. In addition, the private keys of different users are independent from each other, the master private key MSK is only mastered by the key generation center and cannot be exposed to any user, even if the private key of a certain user is revealed, the security of the private keys or the master private key of other users cannot be affected, and the security of the system is further enhanced. Therefore, the design effectively protects the security of the main private key MSK, so that the system can safely support encryption and decryption operations in a multi-user environment.
S203, the user A encrypts the original model file based on the encryption element and the main public key to obtain an encrypted model file, generates a re-encryption key based on the key data of the user A and the public key of the user B, and sends the encryption element, the re-encryption key and the encrypted model file to a key agent center.
In one possible implementation:
the model owner determines an encryption element based on the random number and a public key of the model user;
The model owner calculates an encryption key based on the encryption element and the main public key;
encrypting the original model file by using the encryption key to obtain an encrypted model file;
generating a re-encryption key based on the key data of the model owner and the public key of the model user;
and sending the encryption element, the re-encryption key and the encrypted model file to a key proxy center.
Wherein, the model owner calculates an encryption key based on the encryption element and the master public key, including:
The model owner calculates an encryption key by using bilinear pairing based on the encryption element and a main public key, wherein the main public key is generated by a key generation center based on a BLS12-381 elliptic curve.
As shown in fig. 4, fig. 4 illustrates an interface for encrypting data by a user, based on the data provided in fig. 3, in this interface, encryption Key (SK) is a private Key, particularly :39491687549403370741353463161408421438259309576462671149757004186696432381700,Master Public Key(MPK) is a primary public Key, particularly :13806915923267245941861359600038993828156512703228617965642237360225378185833738690941731901751466743117623235748761242938734920612…,My Email is a mailbox address input by a model owner, testme@1.2 is exemplified by RECIPIENT EMAIL is exemplified by a mailbox address of a model user required to be input by the model owner, testme@3.4 is exemplified by a button of Text to Encryption required to be input by the model owner, and GENERATE ENCRYPTED Text is clicked to generate encrypted data according to the input information.
As shown in fig. 5, fig. 5 illustrates a generated user encryption result interface diagram taking the content input in fig. 4 as an example. In the encryption result shown in fig. 5, C1 is an encryption element, specifically :131284680358210663716928307803393070795420238784131897976002513571576972 3601042299595600138866159306413963657165088521250500842040997557 52465336334998530123977197024743383206009265265377466726610001393434120701802281550922187759199,Nonce is a random number, specifically 58d 7a8995ba760617e626a1ebda6833, cipert shows the encrypted data, specifically 1C21330ef6f 080af0fe 387abc0C226e426e3a3C2b3f979b8a90b9a763386e3b 23637b 5C, tag is an encryption key, specifically 6e ea838bb 08239736b 8fc223fade5, and rekey is a re-encryption key, specifically 2315571171843757050511905276204492601569001381853636169930738396465256028458, for subsequent re-encryption operations.
Illustratively, when the user A encrypts the original model file, the encryption element g 1, specifically g 1=G1^(random*hB),g2=MPK=G2 ++MSK, is obtained by introducing a random number random.
Where G 1、G2 is the elliptic curve group, hB is a point where the hash value of user B maps to G 1, random is a random number, belonging to the prime-order finite field Fr, MPK is the master public key, and MSK is the master private key.
The encryption key is calculated by using the bilinear pairing e, specifically:
AES(KEY)=GT=e(g1,g2)=e(G1,G2)^(random*hB*MSK)。
The mechanism uses bilinear pairing to encrypt by introducing random numbers, which can ensure different keys generated by each encryption and prevent replay attack.
Based on the key data of the model owner and the public key of the model user, a re-encryption key rekeyA- > B is obtained, and the specific formula is as follows:
rekeyA->B=sk_A^(hB*hB*~hA)=MSK^(hA*hB*hB*~hA)=MSK^(hB*hB)=sk_B^hB。
Wherein hA is the inverse of hA, i.e., hA. HA=1, and MSK is the primary private key.
The re-encryption key functions to enable data that would otherwise be decrypted only by the model owner to be converted into a form that would only be decrypted by the particular model user without exposing the decryption key of the model owner.
S204, the key agent center generates a re-encryption ciphertext based on the encryption element and the re-encryption key, and sends the re-encryption ciphertext and the encrypted model file to the user B.
The key agent center interface shown in fig. 6, C1 is a received encryption element, specifically :1312846803582106637169283078033930707954202387841318979760025135 715769723601042299595600138866159306413963657165088521250500842049,RK_AB is a re-encryption key, specifically 23155711718437570505119052765204492601569001381853636169930738396465256028458, and clicking on the button GENERATE C Prime (C'), and the generated result is a re-encryption ciphertext shown in fig. 7. The re-encrypted ciphertext GENERATED C Prime generated in FIG. 7, specifically :1545059287865236060747234654599979534126045148996391461596117997904637558709127496561198255140807 0948186974593661621832886922637401265134249694118212896320154992 87720706877297520902945685405181430825890289467946722000450280142447005.
The key proxy center performs proxy re-encryption through the encryption element g 1 and the re-encryption key rekeyA- > B to generate a re-encryption ciphertext C1_prime, and the specific formula is as follows:
Wherein c1_prime=g 1 ++ rekeyA- > B, i.e.: c1_prime' =g 1 and (sk_B) hB.
The key agent center performs the agent re-encryption operation to generate re-encryption ciphertext specific to the specified model user, and this mechanism ensures that even the key agent center cannot independently decrypt the data content, thereby further enhancing the security of the model file distribution process. By adopting the mode of re-encrypting by the key proxy center, the private key of the model owner does not need to be directly exposed to any other party, so that the risk of key leakage is reduced, and the key management is more centralized and efficient. Because the re-encryption process can be automatically carried out, the distribution efficiency of the model files is improved, and meanwhile, the safety of each distribution is ensured. In conclusion, the method for re-encrypting by adopting the key proxy center greatly enhances the security and flexibility of data transmission, and simplifies the key management flow.
S205, the user B decrypts the encrypted model file based on the key data of the user B, the re-encrypted ciphertext and the main public key to obtain an original model file.
In one possible implementation:
the model user calculates an encryption key based on the key data of the model user, the re-encryption ciphertext and the main public key, and decrypts the encrypted model file based on the encryption key to obtain an original model file.
The user decrypting data interface diagram shown in fig. 8, wherein MPK is a master public key, particularly :13806915923267245941861359600038993828156512703228617965642237360225378185833738690941731901751466743117623235748761242938734920612…,sk_B is a private key of a model user, particularly 4673239419838222609060908820005019524097154275643723359329717490749569, c' is a heavy encrypted ciphertext, particularly :1545059787652360607473465459997953412604514899639146159611799790463755870912749656119825514080709481869745936616218328869226374012,ID_B is an identifier of the model user, particularly testme@3.4, nonce (hex) is a random number, particularly 58d 7a8995ba760617e626a1ebda6833, and ciphert ext (hex) is encrypted data, particularly 1c21330ef6f8f080 fe 387abc0c226e426e3a3c2b3f979b8a90b9a763386e3beedd23637b 8b 223 b5c, and a decrypting button is clicked to obtain an encrypted key tag (x), particularly eea b082f 79f36 f fcde 223.
Illustratively, when user B calculates the encryption KEY AES (KEY), user B knows to re-encrypt ciphertext c1_prime and master public KEY MPK, using the nature of the bilinear pairing,
E (C1_prime, MPK) =e (G 1^(random*hB*MSK*hB*hB),G2. Sup. MSK)
=e(G1,G2)^(random*hB*MSK)(hB*hB*MSK)。
Since e (G 1,G2)/(range hbmsk) =gt=aes (KEY),
Let ss=sk_b hB e (c1_prime, MPK)/(ss) =e (G 1,G2) =aes (KEY).
In order to recover the encryption KEY AES (KEY), the user B needs to eliminate the influence of ss, supposing that ss is the inverse of ss, eliminating the rest of items through the inverse to obtain the encryption KEY, and decrypting the encrypted model file by using the encryption KEY to obtain the original model file.
According to the model file distribution method provided by the embodiment of the application, the key center generates the main public key, the main private key and the key data of different users, so that a foundation is laid for the whole process. The model owner encrypts the original model file and generates a re-encryption key, so that the confidentiality of the model file is ensured, and the accurate control of the access authority of the model user is realized. The key proxy center performs a proxy re-encryption operation to generate re-encryption ciphertext specific to the user of the given model, and this mechanism ensures that even the key proxy center cannot decrypt the data content alone, thereby further enhancing data security. After receiving the re-encrypted ciphertext, the model user decrypts the re-encrypted ciphertext, and then recovers the encrypted model file, so that only authorized model users can access the content of the model file, and other unauthorized users cannot decrypt or access the data.
Based on the model file distribution method introduced in the foregoing embodiment, correspondingly, the application further provides a model file distribution device. Fig. 9 is a schematic diagram of the structure of the device. As shown in fig. 9, the model file distribution apparatus includes:
A key generation module 901, configured to generate key data of the model owner based on the identifier of the model owner by the key generation center, and generate key data of the model user based on the identifier of the model user.
The encryption module 902 is configured to encrypt an original model file by a model owner based on an encryption element and a master public key, obtain an encrypted model file, generate a re-encryption key based on key data of the model owner and a public key of a model user, and send the encryption element, the re-encryption key and the encrypted model file to a key proxy center.
The proxy re-encryption module 903 is configured to generate a re-encrypted ciphertext by using a key proxy center based on the encryption element and the re-encryption key, and send the re-encrypted ciphertext and the encrypted model file to a model user.
And the decryption module 904 is configured to decrypt the encrypted model file based on the key data of the model user, the re-encrypted ciphertext and the master public key by the model user, to obtain an original model file.
Optionally, the encryption module is specifically configured to:
the model owner determines an encryption element based on the random number and a public key of the model user;
The model owner calculates an encryption key based on the encryption element and the main public key;
encrypting the original model file by using the encryption key to obtain an encrypted model file;
generating a re-encryption key based on the key data of the model owner and the public key of the model user;
and sending the encryption element, the re-encryption key and the encrypted model file to a key proxy center.
Optionally, the encryption module is specifically configured to:
The model owner calculates an encryption key by using bilinear pairing based on the encryption element and a main public key, wherein the main public key is generated by a key generation center based on a BLS12-381 elliptic curve.
Optionally, the key generation module is specifically configured to:
the key generation center respectively maps the identifier of the model owner and the identifier of the model user to the BLS12-381 elliptic curve by using a public hash function based on the identifier of the model owner and the identifier of the model user to obtain a public key of the model owner and a public key of the model user;
generating a private key of the model owner based on the master private key and the public key of the model owner;
generating a private key of the model user based on the master private key and the public key of the model user;
The key data of the model owner comprises a public key of the model owner and a private key of the model owner, the key data of the model user comprises the public key of the model user and the private key of the model user, and the main private key is generated by a key generation center based on a BLS12-381 elliptic curve.
Optionally, the decryption module is specifically configured to:
the model user calculates an encryption key based on the key data of the model user, the re-encryption ciphertext and the main public key, and decrypts the encrypted model file based on the encryption key to obtain an original model file.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and when the program is run by a processor, the model file distribution method as introduced in any mode of the method embodiment is realized.
In addition, the embodiment of the application also provides a processor, which is used for running a computer program, and the program runs to execute the model file distribution method introduced by any implementation mode of the embodiment of the method.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment is mainly described in a different point from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points. The apparatus embodiments described above are merely illustrative, wherein elements illustrated as separate elements may or may not be physically separate, and elements illustrated as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the technical scope of the present application should be included in the scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (10)

1.一种模型文件分发方法,其特征在于,包括:1. A model file distribution method, characterized by comprising: 密钥生成中心基于模型拥有者的标识符生成模型拥有者的密钥数据,基于模型使用者的标识符生成模型使用者的密钥数据;The key generation center generates key data of the model owner based on the identifier of the model owner, and generates key data of the model user based on the identifier of the model user; 模型拥有者基于加密元素和主公钥,对原始模型文件进行加密,得到加密后的模型文件,基于模型拥有者的密钥数据和模型使用者的公钥,生成重加密密钥,将所述加密元素、所述重加密密钥和所述加密后的模型文件发送给密钥代理中心;The model owner encrypts the original model file based on the encryption element and the master public key to obtain the encrypted model file, generates a re-encryption key based on the key data of the model owner and the public key of the model user, and sends the encryption element, the re-encryption key and the encrypted model file to the key agency center; 密钥代理中心基于所述加密元素和所述重加密密钥,生成重加密密文,将所述重加密密文和所述加密后的模型文件发送给模型使用者;The key agency center generates a re-encrypted ciphertext based on the encryption element and the re-encryption key, and sends the re-encrypted ciphertext and the encrypted model file to the model user; 模型使用者基于模型使用者的密钥数据、所述重加密密文和所述主公钥,对所述加密后的模型文件进行解密,得到原始模型文件。The model user decrypts the encrypted model file based on the model user's key data, the re-encrypted ciphertext and the master public key to obtain the original model file. 2.根据权利要求1所述的方法,其特征在于,所述模型拥有者基于加密元素和主公钥,对原始模型文件进行加密,得到加密后的模型文件,基于模型拥有者的密钥数据和模型使用者的公钥,生成重加密密钥,将所述加密元素、所述重加密密钥和所述加密后的模型文件发送给密钥代理中心,包括:2. The method according to claim 1 is characterized in that the model owner encrypts the original model file based on the encryption element and the master public key to obtain the encrypted model file, generates a re-encryption key based on the key data of the model owner and the public key of the model user, and sends the encryption element, the re-encryption key and the encrypted model file to the key agency center, comprising: 模型拥有者基于随机数和模型使用者的公钥,确定加密元素;The model owner determines the encryption element based on the random number and the public key of the model user; 模型拥有者基于加密元素和主公钥,计算得到加密密钥;The model owner calculates the encryption key based on the encryption element and the master public key; 利用所述加密密钥对原始模型文件进行加密,得到加密后的模型文件;Encrypting the original model file using the encryption key to obtain an encrypted model file; 基于模型拥有者的密钥数据和模型使用者的公钥,生成重加密密钥;Generate a re-encryption key based on the key data of the model owner and the public key of the model user; 将所述加密元素、所述重加密密钥和所述加密后的模型文件发送给密钥代理中心。The encryption element, the re-encryption key and the encrypted model file are sent to a key agency center. 3.根据权利要求2所述的方法,其特征在于,所述模型拥有者基于加密元素和主公钥,计算得到加密密钥,包括:3. The method according to claim 2, characterized in that the model owner calculates the encryption key based on the encryption element and the master public key, comprising: 模型拥有者基于所述加密元素和主公钥,使用双线性配对计算得到加密密钥;所述主公钥是密钥生成中心基于BLS12-381椭圆曲线生成的。The model owner obtains the encryption key based on the encryption element and the master public key using bilinear pairing calculation; the master public key is generated by the key generation center based on the BLS12-381 elliptic curve. 4.根据权利要求1所述的方法,其特征在于,所述密钥生成中心基于模型拥有者的标识符生成模型拥有者的密钥数据,基于模型使用者的标识符生成模型使用者的密钥数据,包括:4. The method according to claim 1, characterized in that the key generation center generates the key data of the model owner based on the identifier of the model owner, and generates the key data of the model user based on the identifier of the model user, comprising: 密钥生成中心基于模型拥有者的标识符和模型使用者的标识符,使用公开的哈希函数分别将模型拥有者的标识符和模型使用者的标识符映射到BLS12-381椭圆曲线,得到模型拥有者的公钥和模型使用者的公钥;The key generation center uses a public hash function to map the model owner's identifier and the model user's identifier to the BLS12-381 elliptic curve based on the model owner's identifier and the model user's identifier, and obtains the model owner's public key and the model user's public key; 基于主私钥和模型拥有者的公钥,生成模型拥有者的私钥;Generate the model owner's private key based on the master private key and the model owner's public key; 基于主私钥和模型使用者的公钥,生成模型使用者的私钥;Generate the model user's private key based on the master private key and the model user's public key; 所述模型拥有者的密钥数据包括模型拥有者的公钥和模型拥有者的私钥;所述模型使用者的密钥数据包括模型使用者的公钥和模型使用者的私钥;所述主私钥是密钥生成中心基于BLS12-381椭圆曲线生成的。The key data of the model owner includes the public key and the private key of the model owner; the key data of the model user includes the public key and the private key of the model user; the master private key is generated by the key generation center based on the BLS12-381 elliptic curve. 5.根据权利要求1所述的方法,其特征在于,所述模型使用者基于模型使用者的密钥数据、所述重加密密文和所述主公钥,对所述加密后的模型文件进行解密,得到原始模型文件,包括:5. The method according to claim 1, characterized in that the model user decrypts the encrypted model file based on the key data of the model user, the re-encrypted ciphertext and the master public key to obtain the original model file, comprising: 模型使用者基于模型使用者的密钥数据、所述重加密密文和所述主公钥,计算得到加密密钥,基于所述加密密钥对所述加密后的模型文件进行解密,得到原始模型文件。The model user calculates an encryption key based on the model user's key data, the re-encrypted ciphertext and the master public key, and decrypts the encrypted model file based on the encryption key to obtain the original model file. 6.一种模型文件分发装置,其特征在于,包括:6. A model file distribution device, characterized by comprising: 密钥生成模块,用于密钥生成中心基于模型拥有者的标识符生成模型拥有者的密钥数据,基于模型使用者的标识符生成模型使用者的密钥数据;A key generation module, used for the key generation center to generate key data of the model owner based on the identifier of the model owner, and to generate key data of the model user based on the identifier of the model user; 加密模块,用于模型拥有者基于加密元素和主公钥,对原始模型文件进行加密,得到加密后的模型文件,基于模型拥有者的密钥数据和模型使用者的公钥,生成重加密密钥,将所述加密元素、所述重加密密钥和所述加密后的模型文件发送给密钥代理中心;The encryption module is used for the model owner to encrypt the original model file based on the encryption element and the master public key to obtain the encrypted model file, generate a re-encryption key based on the key data of the model owner and the public key of the model user, and send the encryption element, the re-encryption key and the encrypted model file to the key agency center; 代理重加密模块,用于密钥代理中心基于所述加密元素和所述重加密密钥,生成重加密密文,将所述重加密密文和所述加密后的模型文件发送给模型使用者;An agent re-encryption module is used for the key agent center to generate a re-encrypted ciphertext based on the encryption element and the re-encryption key, and send the re-encrypted ciphertext and the encrypted model file to the model user; 解密模块,用于模型使用者基于模型使用者的密钥数据、所述重加密密文和所述主公钥,对所述加密后的模型文件进行解密,得到原始模型文件。The decryption module is used for the model user to decrypt the encrypted model file based on the model user's key data, the re-encrypted ciphertext and the master public key to obtain the original model file. 7.根据权利要求6所述的装置,其特征在于,所述加密模块具体用于:7. The device according to claim 6, characterized in that the encryption module is specifically used for: 模型拥有者基于随机数和模型使用者的公钥,确定加密元素;The model owner determines the encryption element based on the random number and the public key of the model user; 模型拥有者基于加密元素和主公钥,计算得到加密密钥;The model owner calculates the encryption key based on the encryption element and the master public key; 利用所述加密密钥对原始模型文件进行加密,得到加密后的模型文件;Encrypting the original model file using the encryption key to obtain an encrypted model file; 基于模型拥有者的密钥数据和模型使用者的公钥,生成重加密密钥;Generate a re-encryption key based on the key data of the model owner and the public key of the model user; 将所述加密元素、所述重加密密钥和所述加密后的模型文件发送给密钥代理中心。The encryption element, the re-encryption key and the encrypted model file are sent to a key agency center. 8.根据权利要求7所述的装置,其特征在于,所述加密模块具体用于:8. The device according to claim 7, characterized in that the encryption module is specifically used for: 模型拥有者基于所述加密元素和主公钥,使用双线性配对计算得到加密密钥;所述主公钥是密钥生成中心基于BLS12-381椭圆曲线生成的。The model owner obtains the encryption key based on the encryption element and the master public key using bilinear pairing calculation; the master public key is generated by the key generation center based on the BLS12-381 elliptic curve. 9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,当所述程序被处理器运行时,实现如权利要求1-5任一项所述的模型文件分发方法。9. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and when the program is executed by a processor, the model file distribution method according to any one of claims 1 to 5 is implemented. 10.一种处理器,其特征在于,用于运行计算机程序,所述程序运行时执行如权利要求1-5任一项所述的模型文件分发方法。10. A processor, characterized in that it is used to run a computer program, and when the program is run, the model file distribution method according to any one of claims 1 to 5 is executed.
CN202510421183.2A 2025-04-03 2025-04-03 A model file distribution method, device, storage medium and processor Pending CN120185906A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202510421183.2A CN120185906A (en) 2025-04-03 2025-04-03 A model file distribution method, device, storage medium and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202510421183.2A CN120185906A (en) 2025-04-03 2025-04-03 A model file distribution method, device, storage medium and processor

Publications (1)

Publication Number Publication Date
CN120185906A true CN120185906A (en) 2025-06-20

Family

ID=96039053

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202510421183.2A Pending CN120185906A (en) 2025-04-03 2025-04-03 A model file distribution method, device, storage medium and processor

Country Status (1)

Country Link
CN (1) CN120185906A (en)

Similar Documents

Publication Publication Date Title
CN109559124B (en) Cloud data security sharing method based on block chain
EP3616384B1 (en) Orthogonal access control for groups via multi-hop transform encryption
CN102655508B (en) Method for protecting privacy data of users in cloud environment
CN108881314B (en) Privacy protection method and system based on CP-ABE ciphertext under fog computing environment
CN104486315B (en) A kind of revocable key outsourcing decryption method based on contents attribute
JP6363032B2 (en) Key change direction control system and key change direction control method
Li et al. Fine-grained data access control systems with user accountability in cloud computing
Jia et al. SDSM: a secure data service mechanism in mobile cloud computing
CN104113408B (en) It is a kind of realize the revocation of timely user property based on ciphertext policy ABE encryption method
US9426131B2 (en) Server apparatus and program to re-encrypt ciphertext data
Shao et al. Fine-grained data sharing in cloud computing for mobile devices
CN115242555A (en) A supervised cross-chain privacy data sharing method and device
Samanthula et al. An efficient and secure data sharing framework using homomorphic encryption in the cloud
CN102624522A (en) A Key Encryption Method Based on File Attributes
JP6115573B2 (en) Cryptographic system, data storage system, and apparatus and method used therefor
CN113901512B (en) Data sharing method and system
KR101615137B1 (en) Data access method based on attributed
CN105100083A (en) Attribute-based encryption method and attribute-based encryption system capable of protecting privacy and supporting user Undo
Wu et al. Poster: a certificateless proxy re-encryption scheme for cloud-based data sharing
CN113708917A (en) APP user data access control system and method based on attribute encryption
CN104993929A (en) Attribute-based encryption system and method supporting system attribute expansion
JP2004048479A (en) Encryption key management method for shared encrypted information
CN116094845B (en) Efficient revocation conditional proxy re-encryption method and system
CN116961893A (en) End-to-end secure encryption communication management method, system and storable medium
CN115604036A (en) Electronic medical record privacy protection system and method based on improved CP-ABE

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination