WO2023098390A1 - 一种基于国密算法的安全的文件共享方法和系统 - Google Patents

一种基于国密算法的安全的文件共享方法和系统 Download PDF

Info

Publication number
WO2023098390A1
WO2023098390A1 PCT/CN2022/129708 CN2022129708W WO2023098390A1 WO 2023098390 A1 WO2023098390 A1 WO 2023098390A1 CN 2022129708 W CN2022129708 W CN 2022129708W WO 2023098390 A1 WO2023098390 A1 WO 2023098390A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
client
user
algorithm
file sharing
Prior art date
Application number
PCT/CN2022/129708
Other languages
English (en)
French (fr)
Inventor
陈洪
刘中奎
张亚斌
Original Assignee
傲然技术有限公司
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 傲然技术有限公司 filed Critical 傲然技术有限公司
Priority to JP2024502244A priority Critical patent/JP2024511683A/ja
Priority to KR1020237031751A priority patent/KR20230175185A/ko
Priority to US18/553,926 priority patent/US20240187477A1/en
Priority to EP22900195.3A priority patent/EP4300874A1/en
Publication of WO2023098390A1 publication Critical patent/WO2023098390A1/zh

Links

Classifications

    • 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/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • 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
    • H04L63/045Network 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 wherein the sending and receiving network entities apply hybrid encryption, i.e. combination of symmetric and asymmetric encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/062Network architectures or network communication protocols for network security for supporting key management in a packet data network for key distribution, e.g. centrally by trusted party
    • 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/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • 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/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • 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

Definitions

  • the invention belongs to the field of computer technology security, and in particular relates to a safe file sharing method and system based on a national secret algorithm.
  • file f needs to be encrypted multiple times, which will cause inconvenience to user A. Or encrypt the file once but share the secret key with multiple people, resulting in an increased risk of secret key leakage.
  • the present invention provides a secure file sharing method and system based on national secret algorithm.
  • the present invention adopts following technical scheme:
  • a secure file sharing method based on a national secret algorithm is applied to a communication system including a file sharing client A, a file receiving client B and a secret key management center, and the file sharing method includes the following steps :
  • the user registers at the file sharing client A and the file receiving client B respectively and generates corresponding user names a and b.
  • the file sharing client A and the file receiving client B send the registration information of the user to the secret key
  • 1024 public keys are prefabricated in the file sharing client A and file receiving client B to form a 32x32 public key matrix
  • 1024 private keys are prefabricated in the secret key management center to form a 32x32 private key matrix.
  • Key matrix, the 1024 private keys of the secret key management center are in one-to-one correspondence with the 1024 public keys in the file sharing client A and the file receiving client B, forming a total of 1024 asymmetric encryption algorithm SM2 public-private key pairs;
  • the secret key management center uses the summary algorithm SM3 to calculate the summary value of the username a and b, uses the summary value and the private key matrix to compound, and calculates the user's private key sa and sb through the composite algorithm, and The user's private key sa and private key sb are sent to file sharing client A and file receiving client B respectively;
  • the user specifies the file f to be shared on the file sharing client A, and encrypts the file f to generate an encrypted shared file F, and shares the shared file F to the file receiving client B;
  • the file receiving client B decrypts the shared file F after receiving it, and obtains the designated shared file f after decryption.
  • the composite algorithm specifically includes: decomposing the digest value of the username with a length of 32 bytes, converting the binary number of each byte into an integer, a total of 32 integers, and dividing each integer by 32 to take the modulo , get a total of 32 integer values from 0 to 31, add 1 to the integer value as the vertical mark of the matrix, a total of 32 vertical marks, and take out the secret key corresponding to the vertical mark from the public key matrix or private key matrix in turn, a total of 32 Secret key, add 32 secret keys to get a new secret key.
  • the encryption operation in the step S3 includes the following steps:
  • the file sharing client A uses c' as the secret key of the symmetric encryption algorithm SM4, encrypts the file f using the symmetric encryption algorithm SM4, and obtains the ciphertext f';
  • the file sharing client A uses the asymmetric encryption algorithm SM2 and the private key sa to digitally sign the abstract to obtain the signature value s;
  • the file sharing client A combines L + f'+r"+s into a new shared file F, and shares the shared file F with the file receiving client B;
  • the file sharing client A informs the sharing user of the digital password c through other offline methods.
  • the decryption operation in the step 4 includes the following steps:
  • the file receiving client B After the file receiving client B receives the shared file F, it specifies the file F and enters the user name a registered at the file sharing client A, and the file receiving client B uses the input user name a to calculate it using a composite algorithm public key pa;
  • the file receiving client B uses the digest algorithm SM3 to perform digest calculation on L + f'+c", and uses the digest value, as well as the asymmetric encryption algorithm SM2 and the public key pa to verify the signature value s. When verifying When it succeeds, proceed to the next step. If the verification fails, it means that the file has a security risk. When the number of verification failures reaches the predetermined number, the file F will be re-encrypted, and the alarm will be prompted to remind the user;
  • the file receiving client B enters the digital password, calculates the digest, and obtains the first 16 bytes of the digest. At the same time, it takes out c” from the L+1th byte in the file F and decrypts c” with the private key sb to obtain the file. c', compare the first 16 bytes of the digest with the value of c', if they are consistent, go to the next step, if not, prompt the user to re-enter the digital password, and perform re-encryption operation on file F when the number of incorrect digital passwords reaches the predetermined number of times , and alert the user;
  • the file receiving client B uses c' as the symmetric key of the symmetric encryption algorithm SM4 to decrypt the content of f', and generates the decrypted plaintext file f to complete the sharing of file f.
  • the re-encryption operation in steps S4.2 and S4.3 is specifically: when the number of verification failures or the number of wrong input digital passwords reaches a predetermined number of times, an alarm prompts the user that the file has been damaged and cannot continue to decrypt, and the file is received by the user Terminal B generates a random number R, uses R as the secret key of the symmetric encryption algorithm SM4, and uses the symmetric encryption algorithm SM4 to encrypt the file F, so that the file F cannot be further decrypted.
  • the file sharing client A wants to share a specified file with multiple file receiving client Bs
  • the user names of multiple file receiving client Bs are respectively are b1, ... bn, where n>1, in the encryption operation in step S3, user names b1, ... bn are respectively input in file sharing client A, and user names b1, ...
  • a secure file sharing system based on a national secret algorithm includes: a file sharing client A, a file receiving client B and a secret key management center, the file sharing client A, the file receiving client B 1024 public keys are prefabricated inside, forming a 32x32 public key matrix; 1024 private keys are prefabricated in the secret key management center, forming a 32x32 private key matrix, and the 1024 private keys in the secret key management center and the file
  • the 1024 public keys in the sharing client A and the file receiving client B are in one-to-one correspondence, forming a total of 1024 asymmetric encryption algorithm SM2 public-private key pairs, and the sharing system uses the file sharing method described in any of the above to specify Files are shared.
  • the beneficial effect of the present invention is that the file sharing client A does not need to designate the encryption key by itself, and does not need to memorize or diffuse the encryption key to the file receiving client B through other means, so as to prevent the leakage of the secret key and ensure the transmission of files Security in the process, so that the content of the file is not stolen and tamper-proof. If the shared file is tampered with or the source of the file is illegal, the file receiving client B can know it and make a corresponding judgment. The legal reliability is determined by the characteristics of the asymmetric algorithm and the digest algorithm. After the non-shared user gets the shared file F, it cannot be decrypted to obtain the file content. File sharing client A can be shared with multiple users at the same time, without the need to spread the encryption key to multiple users at the same time, only the designated shared people can see the content of the file, and other people cannot view the content of the file after getting the file .
  • Fig. 1 is the schematic diagram of the communication relationship between the file sharing client A, the file receiving client B and the secret key management center of the present invention
  • Fig. 2 is a schematic diagram of the public key matrix of the present invention.
  • Fig. 3 is a schematic diagram of a private key matrix in the present invention.
  • a secure file sharing method based on the National Secret Algorithm, the method is applied to a communication system including a file sharing client A, a file receiving client B and a key management center, the described
  • the file sharing method includes the following steps:
  • the user registers at the file sharing client A and the file receiving client B respectively and generates corresponding user names a and b.
  • the file sharing client A and the file receiving client B send the registration information of the user to the secret key
  • 1024 public keys are prefabricated in the file sharing client A and the file receiving client B to form a 32x32 public key matrix, as shown in Figure 2;
  • 1024 private keys are prefabricated in the secret key management center.
  • the 1024 private keys of the secret key management center are in one-to-one correspondence with the 1024 public keys in the file sharing client A and the file receiving client B, forming a total 1024 asymmetric encryption algorithm SM2 public-private key pairs.
  • the secret key management center calculates the digest value (32 bytes) of the username a and b using the digest algorithm SM3, composites the digest value and the private key matrix, and calculates the user's private key through the composite algorithm sa, sb, and send the user's private key sa and private key sb to file sharing client A and file receiving client B respectively.
  • the composite algorithm is specifically as follows: decompose the digest value of the 32-byte username, convert each byte of binary number into an integer (integer size is 0-255), there are 32 integers in total, each integer Divide 32 and take the modulus to get a total of 32 integer values from 0 to 31. Add 1 to the integer value as the vertical mark of the matrix, and there are 32 vertical marks in total. Take out the secret key corresponding to the vertical mark from the public key matrix or private key matrix in turn. , a total of 32 secret keys, and add the 32 secret keys to get a new secret key.
  • the user specifies the file f to be shared on the file sharing client A, encrypts the file f, generates an encrypted shared file F, and shares the shared file F to the file receiving client B.
  • the file receiving client B decrypts the shared file F after receiving it, and obtains the designated shared file f after decryption.
  • the encryption operation in the step S3 includes the following steps:
  • the file sharing client A uses c' as the secret key of the symmetric encryption algorithm SM4, encrypts the file f using the symmetric encryption algorithm SM4, and obtains the ciphertext f';
  • the file sharing client A uses the asymmetric encryption algorithm SM2 and the private key sa to digitally sign the abstract to obtain the signature value s;
  • the file sharing client A combines L + f'+r”+ s into a new shared file F, and shares the shared file F with the file receiving client B.
  • the sharing method can be network transmission or readable media copy;
  • the file sharing client A informs the sharing user of the digital password c through other offline methods.
  • Decryption operation in described step 4 comprises the following steps:
  • the file receiving client B After the file receiving client B receives the shared file F, it specifies the file F and enters the user name a registered at the file sharing client A, and the file receiving client B uses the input user name a to calculate it using a composite algorithm public key pa;
  • the file receiving client B uses the digest algorithm SM3 to perform digest calculation on L + f'+c", and uses the digest value, as well as the asymmetric encryption algorithm SM2 and the public key pa to verify the signature value s. When verifying When it succeeds, proceed to the next step. If the verification fails, it means that the file has a security risk. When the number of verification failures reaches the predetermined number, the file F will be re-encrypted, and the alarm will be prompted to remind the user;
  • the file receiving client B enters the digital password, calculates the digest, and obtains the first 16 bytes of the digest. At the same time, it takes out c” from the L+1th byte in the file F and decrypts c” with the private key sb to obtain the file. c', compare the first 16 bytes of the digest with the value of c', if they are consistent, go to the next step, if not, prompt the user to re-enter the digital password, and perform re-encryption operation on file F when the number of incorrect digital passwords reaches the predetermined number of times , and alert the user;
  • the file receiving client B uses c' as the symmetric key of the symmetric encryption algorithm SM4 to decrypt the content of f', and generates the decrypted plaintext file f to complete the sharing of file f.
  • the re-encryption operation in the steps S4.2 and S4.3 is specifically: when the number of times of verification failures or incorrect input of a digital password reaches a predetermined number of times (the number of times can be remotely configured through the secret key management center), an alarm prompts the user that the file has been damaged, Unable to continue to decrypt, the file receiving client B generates a random number R, uses R as the secret key of the symmetric encryption algorithm SM4, and uses the symmetric encryption algorithm SM4 to encrypt the file F, so that the file F can no longer be decrypted.
  • the file sharing client A when the number of the file receiving client B is multiple, the file sharing client A will share the specified file to multiple file receiving client B, and the multiple file receiving client B
  • the user names of B are respectively b1, ... bn, where n>1, in the encryption operation in step S3, the user names b1, ... bn are respectively input in the file sharing client A, and the user names are calculated using a composite algorithm. Name the public keys pb1, ... pbn of b1, ... bn, and use the public key pb1, ... pbn to encrypt c' respectively to obtain ciphertexts cb1', ...
  • a secure file sharing system based on the national secret algorithm
  • the file sharing system includes: a file sharing client A, a file receiving client B and a key management center, the file sharing client A 1024 public keys are prefabricated in the file receiving client B to form a 32x32 public key matrix; 1024 private keys are prefabricated in the secret key management center to form a 32x32 private key matrix.
  • the 1024 private keys are in one-to-one correspondence with the 1024 public keys in the file sharing client A and the file receiving client B, forming a total of 1024 asymmetric encryption algorithm SM2 public-private key pairs.
  • the sharing system uses the above-mentioned file sharing method to share the specified file.
  • the file sharing client A and the file receiving client B are only used to illustrate the technical solution of the present invention, and the file sharing client A and the file receiving client B themselves may be the same type of client devices , in the actual operation process, the file receiving client B can also use the above file sharing method to share the specified file with the file sharing client A or other file receiving client B.
  • the three types of encryption algorithms used in the present invention are national secret algorithms, and will not be described in detail here.
  • the beneficial effect of the present invention is that the file sharing client A does not need to designate the encryption key by itself, and does not need to memorize or diffuse the encryption key to the file receiving client B through other means, so as to prevent the leakage of the secret key and ensure the transmission of files Security in the process, so that the content of the file is not stolen and tamper-proof. If the shared file is tampered with or the source of the file is illegal, the file receiving client B can know it and make a corresponding judgment. The legal reliability is determined by the characteristics of the asymmetric algorithm and the digest algorithm. After the non-shared user gets the shared file F, it cannot be decrypted to obtain the file content. File sharing client A can be shared with multiple users at the same time, without the need to spread the encryption key to multiple users at the same time, only the designated shared people can see the content of the file, and other people cannot view the content of the file after getting the file .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Power Engineering (AREA)
  • Storage Device Security (AREA)

Abstract

一种基于国密算法的安全的文件共享方法和系统,属于计算机技术安全领域,用于解决用户在分享文件时的安全性和权限控制的问题,文件共享方法包括以下步骤:用户在文件共享用户端A、文件接收用户端B进行注册并将用户的注册信息发送到秘钥管理中心;秘钥管理中心将用户名a和b使用摘要算法SM3计算用户名的摘要值,将摘要值与私钥矩阵进行复合计算出用户的私钥sa、sb,并发给文件共享用户端A和文件接收用户端B;用户在文件共享用户端A指定要共享的文件f进行加密生成共享文件F共享给文件接收用户端B;文件接收用户端B接收到共享文件F后解密得到文件f。本发明的有益效果在于,杜绝秘钥泄露的问题,确保了传输文件的过程中的安全性。

Description

一种基于国密算法的安全的文件共享方法和系统 技术领域
本发明属于计算机技术安全领域,具体涉及一种基于国密算法的安全的文件共享方法和系统。
背景技术
随着网络技术的发展,通过网络上传文件或者网络下载文件已经较为普遍,而在个人电脑端或移动终端上上传文件或下载文件的技术也较为成熟,因此,文件共享技术也随之成长起来,但采用常用的共享技术将加密文件发送给被分享人,仍存在诸多问题,例如用户A将文件f共享给用户B,存在以下的缺点:
(1)用户A需要记录加密文件的秘钥;
(2)用户A需要通过其他方式如电话、信息、邮件等方式将秘钥发送给用户B;
(3)用户A如果需要分享给多个人,则需要将文件f进行多次加密,对用户A的使用造成不便。或者将文件加密一次但是将秘钥分享给多个人,造成秘钥泄露的风险增大。
技术解决方案
为解决用户在分享文件时的安全性和权限控制问题,本发明提供一种基于国密算法的安全的文件共享方法和系统。
本发明采用如下技术方案:
一种基于国密算法的安全的文件共享方法,所述方法应用于包含文件共享用户端A、文件接收用户端B和秘钥管理中心在内的通讯系统中,所述文件共享方法包括以下步骤:
S1、用户分别在文件共享用户端A、文件接收用户端B进行注册并产生相应的用户名a和b,所述文件共享用户端A、文件接收用户端B将用户的注册信息发送到秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对;
S2、所述秘钥管理中心将用户名a和b使用摘要算法SM3计算用户名的摘要值,使用摘要值和私钥矩阵进行复合,通过复合算法计算出用户的私钥sa,sb,并将用户的私钥sa、私钥sb分别发给文件共享用户端A和文件接收用户端B;
S3、用户在文件共享用户端A指定要共享的文件f,并对文件f进行加密,生成加密后的共享文件F,并将共享文件F共享给文件接收用户端B;
S4、文件接收用户端B接受到共享文件F后进行解密,解密后得到指定共享的文件f。
可选地,所述复合算法具体为:将长度为32字节的用户名的摘要值进行分解,将每个字节的二进制数转换成整数,共有32个整数,每个整数除32取模,得到0-31共32个整数值,该整数值加1作为矩阵的竖标,共32个竖标,依次从公钥矩阵或私钥矩阵中取出竖标所对应的秘钥,共32个秘钥,将32个秘钥相加得到一个新的秘钥。
可选地,所述步骤S3中加密操作包括以下步骤:
S3.1、在文件共享用户端A指定要共享的文件f;
S3.2、在文件共享用户端A中输入不超过16位的数字密码c,使用摘要算法SM3计算数字密码摘要,取摘要前16字节为c’;
S3.3、文件共享用户端A将c’作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件f,得到密文f’;
S3.5、计算密文f’的长度L,用4字节长度表示L值;
S3.6、在文件共享用户端A输入用户在文件接收用户端B注册的用户名b,使用复合算法计算出用户名b的公钥pb,并用公钥pb将c’进行加密,得到密文c”;
S3.7、将L、密文f’和密文c”进行组合,文件共享用户端A使用摘要算法SM3对L + f’+c”进行摘要计算,得到摘要;
S3.8、文件共享用户端A使用非对称加密算法SM2和私钥sa对摘要进行数字签名,得到签名值s;
S3.9、文件共享用户端A将L + f’+r”+ s组合成新的共享文件F,并将共享文件F共享给文件接收用户端B;
S3.10、文件共享用户端A通过其他线下方式将数字密码c告知共享用户。
可选地,所述步骤4中解密操作包括以下步骤:
S4.1、文件接收用户端B接收到共享文件F后,指定文件F并输入在文件共享用户端A注册的用户名a,文件接收用户端B使用输入的用户名a,采用复合算法计算出公钥pa;
S4.2、文件接收用户端B使用摘要算法SM3对L + f’+c”进行摘要计算,并使用摘要值、以及非对称加密算法SM2和公钥pa对签名值s进行验证签名,当验证成功时,进行下一步操作,如果验证失败则表示文件存在安全隐患,当验证失败次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
S4.3、文件接收用户端B输入数字密码,并计算摘要,获取摘要前16字节,同时从文件F中的第L+1字节使取出c”并用私钥sb解密c”得到文件中的c’,对比摘要前16字节和c’的值,如果一致,进行下一步,如果不一致,提示用户重新输入数字密码,当输入数字密码错误次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
S4.4、文件接收用户端B使用c’作为对称加密算法SM4的对称秘钥,解密f’的内容,并生成解密后的明文文件f,完成文件f的共享。
可选地,所述步骤S4.2和S4.3中的再加密操作具体为:当验证失败次数或输入数字密码错误达到预定次数后,报警提示用户文件已破坏,不能继续解密,文件接收用户端B生成一个随机数R,将R作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件F,使文件F不能再继续被解密。
可选地,所述文件接收用户端B数量为多个,所述文件共享用户端A要将指定文件共享给多个文件接收用户端B,多个所述文件接收用户端B的用户名分别为b1、...bn,其中n>1,在步骤S3的加密操作中,在文件共享用户端A分别输入用户名b1、...bn,使用复合算法分别计算出用户名b1、...bn的公钥pb1、...pbn,并用公钥公钥pb1、..pbn分别将c’进行加密,得到密文cb1’、...cbn’,将cb1’、...cbn’加入到共享文件F中,并在文件头指定共享文件的用户数,即F=n+L+f’+cB’+s,其中,cB’=cb1’+...+cbn’。
一种基于国密算法的安全的文件共享系统,所述文件共享系统包括:文件共享用户端A、文件接收用户端B和秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对,所述共享系统采用如上任意一项所述的文件共享方法对指定文件进行共享。
有益效果
本发明的有益效果在于,文件共享用户端A不需要自己指定加密秘钥,也不需要记忆或通过其他方式向文件接收用户端B扩散加密秘钥,杜绝秘钥泄露的问题,确保了传输文件的过程中的安全性,使文件内容不被窃取、防篡改,如果共享的文件被篡改或者文件来源不合法,则文件接收用户端B能知晓,并作出相应的判断,发现被篡改或来源不合法的可靠性由非对称算法和摘要算法的特性决定,非被共享用户拿到共享的文件F后,无法解密得到文件内容。文件共享用户端A可以同时分享给多个用户,而不需要同时向多个用户扩散加密秘钥,只有指定的被分享人才能看到文件内容,而其他人拿到文件后也无法查看文件内容。
附图说明
图1为本发明文件共享用户端A、文件接收用户端B和秘钥管理中心通讯关系意图;
图2为本发明公钥矩阵示意图;
图3为本发明私钥矩阵示意图。
本发明的实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。
实施例一:
如图1所示,一种基于国密算法的安全的文件共享方法,所述方法应用于包含文件共享用户端A、文件接收用户端B和秘钥管理中心在内的通讯系统中,所述文件共享方法包括以下步骤:
S1、用户分别在文件共享用户端A、文件接收用户端B进行注册并产生相应的用户名a和b,所述文件共享用户端A、文件接收用户端B将用户的注册信息发送到秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵,如图2所示;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,如图3所示,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对。
S2、所述秘钥管理中心将用户名a和b使用摘要算法SM3计算用户名的摘要值(32字节长度),使用摘要值和私钥矩阵进行复合,通过复合算法计算出用户的私钥sa,sb,并将用户的私钥sa、私钥sb分别发给文件共享用户端A和文件接收用户端B。
所述复合算法具体为:将长度为32字节的用户名的摘要值进行分解,将每个字节的二进制数转换成整数(整数大小为0-255),共有32个整数,每个整数除32取模,得到0-31共32个整数值,该整数值加1作为矩阵的竖标,共32个竖标,依次从公钥矩阵或私钥矩阵中取出竖标所对应的秘钥,共32个秘钥,将32个秘钥相加得到一个新的秘钥。
S3、用户在文件共享用户端A指定要共享的文件f,并对文件f进行加密,生成加密后的共享文件F,并将共享文件F共享给文件接收用户端B。
S4、文件接收用户端B接收到共享文件F后进行解密,解密后得到指定共享的文件f。
所述步骤S3中加密操作包括以下步骤:
S3.1、在文件共享用户端A指定要共享的文件f;
S3.2、在文件共享用户端A中输入不超过16位的数字密码c,使用摘要算法SM3计算数字密码摘要,取摘要前16字节为c’;
S3.3、文件共享用户端A将c’作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件f,得到密文f’;
S3.5、计算密文f’的长度L,用4字节长度表示L值;
S3.6、在文件共享用户端A输入用户在文件接收用户端B注册的用户名b,使用复合算法计算出用户名b的公钥pb,并用公钥pb将c’进行加密,得到密文c”;
S3.7、将L、密文f’和密文c”进行组合,文件共享用户端A使用摘要算法SM3对L + f’+c”进行摘要计算,得到摘要;
S3.8、文件共享用户端A使用非对称加密算法SM2和私钥sa对摘要进行数字签名,得到签名值s;
S3.9、文件共享用户端A将L + f’+r”+ s组合成新的共享文件F,并将共享文件F共享给文件接收用户端B,共享方式可采用网络传输或可读介质拷贝;
S3.10、文件共享用户端A通过其他线下方式将数字密码c告知共享用户。
所述步骤4中解密操作包括以下步骤:
S4.1、文件接收用户端B接收到共享文件F后,指定文件F并输入在文件共享用户端A注册的用户名a,文件接收用户端B使用输入的用户名a,采用复合算法计算出公钥pa;
S4.2、文件接收用户端B使用摘要算法SM3对L + f’+c”进行摘要计算,并使用摘要值、以及非对称加密算法SM2和公钥pa对签名值s进行验证签名,当验证成功时,进行下一步操作,如果验证失败则表示文件存在安全隐患,当验证失败次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
S4.3、文件接收用户端B输入数字密码,并计算摘要,获取摘要前16字节,同时从文件F中的第L+1字节使取出c”并用私钥sb解密c”得到文件中的c’,对比摘要前16字节和c’的值,如果一致,进行下一步,如果不一致,提示用户重新输入数字密码,当输入数字密码错误次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
S4.4、文件接收用户端B使用c’作为对称加密算法SM4的对称秘钥,解密f’的内容,并生成解密后的明文文件f,完成文件f的共享。
所述步骤S4.2和S4.3中的再加密操作具体为:当验证失败次数或输入数字密码错误达到预定次数后(次数可通过秘钥管理中心远程配置),报警提示用户文件已破坏,不能继续解密,文件接收用户端B生成一个随机数R,将R作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件F,使文件F不能再继续被解密。
在另一实施例中,当所述文件接收用户端B数量为多个时,所述文件共享用户端A要将指定文件共享给多个文件接收用户端B,多个所述文件接收用户端B的用户名分别为b1、...bn,其中n>1,在步骤S3的加密操作中,在文件共享用户端A分别输入用户名b1、...bn,使用复合算法分别计算出用户名b1、...bn的公钥pb1、...pbn,并用公钥公钥pb1、..pbn分别将c’进行加密,得到密文cb1’、...cbn’,将cb1’、...cbn’加入到共享文件F中,并在文件头指定共享文件的用户数,即F=n+L+f’+cB’+s,其中,cB’=cb1’+...+cbn’。
如图1所示,一种基于国密算法的安全的文件共享系统,所述文件共享系统包括:文件共享用户端A、文件接收用户端B和秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对,所述共享系统采用如上所述的文件共享方法对指定文件进行共享。
可以理解的是,上述的文件共享用户端A、文件接收用户端B的名称仅用于说明本发明的技术方案,文件共享用户端A和文件接收用户端B本身可以为同类型的用户端设备,在实际操作过程中,文件接收用户端B也可采用如上的文件共享方法将指定文件共享给文件共享用户端A或其它文件接收用户端B。
本发明使用的非对称加密算法SM2、对称加密算法SM4、摘要算法SM3等三种类型的加密算法为国密算法,在此不做赘述。
本发明的有益效果在于,文件共享用户端A不需要自己指定加密秘钥,也不需要记忆或通过其他方式向文件接收用户端B扩散加密秘钥,杜绝秘钥泄露的问题,确保了传输文件的过程中的安全性,使文件内容不被窃取、防篡改,如果共享的文件被篡改或者文件来源不合法,则文件接收用户端B能知晓,并作出相应的判断,发现被篡改或来源不合法的可靠性由非对称算法和摘要算法的特性决定,非被共享用户拿到共享的文件F后,无法解密得到文件内容。文件共享用户端A可以同时分享给多个用户,而不需要同时向多个用户扩散加密秘钥,只有指定的被分享人才能看到文件内容,而其他人拿到文件后也无法查看文件内容。

Claims (7)

  1. 一种基于国密算法的安全的文件共享方法,其特征在于,所述方法应用于包含文件共享用户端A、文件接收用户端B和秘钥管理中心在内的通讯系统中,所述文件共享方法包括以下步骤:
    S1、用户分别在文件共享用户端A、文件接收用户端B进行注册并产生相应的用户名a和b,所述文件共享用户端A、文件接收用户端B将用户的注册信息发送到秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对;
    S2、所述秘钥管理中心将用户名a和b使用摘要算法SM3计算用户名的摘要值,使用摘要值和私钥矩阵进行复合,通过复合算法计算出用户的私钥sa,sb,并将用户的私钥sa、私钥sb分别发给文件共享用户端A和文件接收用户端B;
    S3、用户在文件共享用户端A指定要共享的文件f,并对文件f进行加密,生成加密后的共享文件F,并将共享文件F共享给文件接收用户端B;
    S4、文件接收用户端B接受到共享文件F后进行解密,解密后得到指定共享的文件f。
  2. 根据权利要求1所述的基于国密算法的安全的文件共享方法,其特征在于,所述复合算法具体为:将长度为32字节的用户名的摘要值进行分解,将每个字节的二进制数转换成整数,共有32个整数,每个整数除32取模,得到0-31共32个整数值,该整数值加1作为矩阵的竖标,共32个竖标,依次从公钥矩阵或私钥矩阵中取出竖标所对应的秘钥,共32个秘钥,将32个秘钥相加得到一个新的秘钥。
  3. 根据权利要求2所述的基于国密算法的安全的文件共享方法,其特征在于,所述步骤S3中加密操作包括以下步骤:
    S3.1、在文件共享用户端A指定要共享的文件f;
    S3.2、在文件共享用户端A中输入不超过16位的数字密码c,使用摘要算法SM3计算数字密码摘要,取摘要前16字节为c’;
    S3.3、文件共享用户端A将c’作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件f,得到密文f’;
    S3.5、计算密文f’的长度L,用4字节长度表示L值;
    S3.6、在文件共享用户端A输入用户在文件接收用户端B注册的用户名b,使用复合算法计算出用户名b的公钥pb,并用公钥pb将c’进行加密,得到密文c”;
    S3.7、将L、密文f’和密文c”进行组合,文件共享用户端A使用摘要算法SM3对L + f’+c”进行摘要计算,得到摘要;
    S3.8、文件共享用户端A使用非对称加密算法SM2和私钥sa对摘要进行数字签名,得到签名值s;
    S3.9、文件共享用户端A将L + f’+r”+ s组合成新的共享文件F,并将共享文件F共享给文件接收用户端B;
    S3.10、文件共享用户端A通过其他线下方式将数字密码c告知共享用户。
  4. 根据权利要求2所述的基于国密算法的安全的文件共享方法,其特征在于,所述步骤4中解密操作包括以下步骤:
    S4.1、文件接收用户端B接收到共享文件F后,指定文件F并输入在文件共享用户端A注册的用户名a,文件接收用户端B使用输入的用户名a,采用复合算法计算出公钥pa;
    S4.2、文件接收用户端B使用摘要算法SM3对L + f’+c”进行摘要计算,并使用摘要值、以及非对称加密算法SM2和公钥pa对签名值s进行验证签名,当验证成功时,进行下一步操作,如果验证失败则表示文件存在安全隐患,当验证失败次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
    S4.3、文件接收用户端B输入数字密码,并计算摘要,获取摘要前16字节,同时从文件F中的第L+1字节使取出c”并用私钥sb解密c”得到文件中的c’,对比摘要前16字节和c’的值,如果一致,进行下一步,如果不一致,提示用户重新输入数字密码,当输入数字密码错误次数达到预定次数则对文件F执行再加密操作,并报警提示用户;
    S4.4、文件接收用户端B使用c’作为对称加密算法SM4的对称秘钥,解密f’的内容,并生成解密后的明文文件f,完成文件f的共享。
  5. 根据权利要求4所述的基于国密算法的安全的文件共享方法,其特征在于,所述步骤S4.2和S4.3中的再加密操作具体为:当验证失败次数或输入数字密码错误达到预定次数后,报警提示用户文件已破坏,不能继续解密,文件接收用户端B生成一个随机数R,将R作为对称加密算法SM4的秘钥,使用对称加密算法SM4加密文件F,使文件F不能再继续被解密。
  6. 根据权利要求3所述的基于国密算法的安全的文件共享方法,其特征在于,所述文件接收用户端B数量为多个,所述文件共享用户端A要将指定文件共享给多个文件接收用户端B,多个所述文件接收用户端B的用户名分别为b1、...bn,其中n>1,在步骤S3的加密操作中,在文件共享用户端A分别输入用户名b1、...bn,使用复合算法分别计算出用户名b1、...bn的公钥pb1、...pbn,并用公钥公钥pb1、..pbn分别将c’进行加密,得到密文cb1’、...cbn’,将cb1’、...cbn’加入到共享文件F中,并在文件头指定共享文件的用户数,即F=n+L+f’+cB’+s,其中,cB’=cb1’+...+cbn’。
  7. 一种基于国密算法的安全的文件共享系统,其特征在于,所述文件共享系统包括:文件共享用户端A、文件接收用户端B和秘钥管理中心,所述文件共享用户端A、文件接收用户端B内均预制有1024个公钥,组成32x32的公钥矩阵;所述秘钥管理中心内预制有1024个私钥,组成32x32的私钥矩阵,所述秘钥管理中心的1024个私钥与文件共享用户端A和文件接收用户端B中的1024个公钥一一对应,构成共1024个非对称加密算法SM2公私钥对,所述共享系统采用如权利要求1-6任意一项所述的文件共享方法对指定文件进行共享。
PCT/CN2022/129708 2021-11-30 2022-11-04 一种基于国密算法的安全的文件共享方法和系统 WO2023098390A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2024502244A JP2024511683A (ja) 2021-11-30 2022-11-04 国産暗号化アルゴリズムに基づく安全なファイル共有方法およびシステム
KR1020237031751A KR20230175185A (ko) 2021-11-30 2022-11-04 국가 패스워드 알고리즘의 안전에 기반한 파일 공유 방법과 시스템
US18/553,926 US20240187477A1 (en) 2021-11-30 2022-11-04 Method and system for secure file sharing based on domestic cryptographic algorithm
EP22900195.3A EP4300874A1 (en) 2021-11-30 2022-11-04 Secure file sharing method and system based on domestic cryptographic algorithm

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111438791.2 2021-11-30
CN202111438791.2A CN114205090B (zh) 2021-11-30 2021-11-30 一种基于国密算法的安全的文件共享方法和系统

Publications (1)

Publication Number Publication Date
WO2023098390A1 true WO2023098390A1 (zh) 2023-06-08

Family

ID=80649574

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/129708 WO2023098390A1 (zh) 2021-11-30 2022-11-04 一种基于国密算法的安全的文件共享方法和系统

Country Status (6)

Country Link
US (1) US20240187477A1 (zh)
EP (1) EP4300874A1 (zh)
JP (1) JP2024511683A (zh)
KR (1) KR20230175185A (zh)
CN (1) CN114205090B (zh)
WO (1) WO2023098390A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114205090B (zh) * 2021-11-30 2024-01-30 傲然技术有限公司 一种基于国密算法的安全的文件共享方法和系统
CN114186249A (zh) * 2021-11-30 2022-03-15 傲然技术有限公司 一种计算机文件安全加密方法、解密方法和可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101989984A (zh) * 2010-08-24 2011-03-23 北京易恒信认证科技有限公司 电子文件安全共享系统及方法
US20130185812A1 (en) * 2010-03-25 2013-07-18 David Lie System and method for secure cloud computing
CN108696360A (zh) * 2018-04-16 2018-10-23 北京虎符信息技术有限公司 一种基于cpk密钥的ca证书发放方法及系统
CN114205090A (zh) * 2021-11-30 2022-03-18 傲然技术有限公司 一种基于国密算法的安全的文件共享方法和系统

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101600204B (zh) * 2009-06-30 2011-05-11 中兴通讯股份有限公司 一种文件传输方法及系统
CN102694796A (zh) * 2012-05-10 2012-09-26 深圳市深信服电子科技有限公司 加密文件的管理方法、装置及服务器
JP2015033068A (ja) * 2013-08-06 2015-02-16 日本電信電話株式会社 ファイル共有システム、情報提供装置、情報取得装置、及びその方法、プログラム
FR3022716B1 (fr) * 2014-06-24 2018-05-11 Outscale Procede de partage de fichiers numeriques entre plusieurs ordinateurs, et ordinateur, ensemble de stockage de donnees et systeme de partage de fichiers numeriques associes
CN104917759B (zh) * 2015-05-26 2019-02-22 西安电子科技大学 基于第三方的安全文件存储和共享系统及方法
CN104901968B (zh) * 2015-06-10 2018-01-05 华中科技大学 一种安全云存储系统中的密钥管理分发方法
CN112019540B (zh) * 2020-08-27 2022-03-11 莫毓昌 一种面向云计算环境的数据安全共享方法
CN112118088A (zh) * 2020-09-09 2020-12-22 燕山大学 基于md5、aes和dh算法的文件加密方法、装置及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130185812A1 (en) * 2010-03-25 2013-07-18 David Lie System and method for secure cloud computing
CN101989984A (zh) * 2010-08-24 2011-03-23 北京易恒信认证科技有限公司 电子文件安全共享系统及方法
CN108696360A (zh) * 2018-04-16 2018-10-23 北京虎符信息技术有限公司 一种基于cpk密钥的ca证书发放方法及系统
CN114205090A (zh) * 2021-11-30 2022-03-18 傲然技术有限公司 一种基于国密算法的安全的文件共享方法和系统

Also Published As

Publication number Publication date
CN114205090A (zh) 2022-03-18
JP2024511683A (ja) 2024-03-14
EP4300874A1 (en) 2024-01-03
CN114205090B (zh) 2024-01-30
KR20230175185A (ko) 2023-12-29
US20240187477A1 (en) 2024-06-06

Similar Documents

Publication Publication Date Title
CN109040045B (zh) 一种基于密文策略属性基加密的云存储访问控制方法
US11552792B2 (en) Systems and methods for generating signatures
Zuo et al. Fine-grained two-factor protection mechanism for data sharing in cloud storage
CN106104562B (zh) 机密数据安全储存和恢复系统及方法
CA2590989C (en) Protocol and method for client-server mutual authentication using event-based otp
US5920630A (en) Method of public key cryptography that includes key escrow
US5815573A (en) Cryptographic key recovery system
CN110958219B (zh) 一种面向医疗云共享数据的sm2代理重加密方法与装置
WO2023098390A1 (zh) 一种基于国密算法的安全的文件共享方法和系统
US11870891B2 (en) Certificateless public key encryption using pairings
JP2013539324A5 (zh)
CN114650137B (zh) 一种基于区块链的支持策略隐藏的解密外包方法及系统
CN102185694A (zh) 基于指纹信息的电子文件加密的方法及其系统
CN114039790A (zh) 一种基于区块链的细粒度云存储安全访问控制方法
WO2020155622A1 (zh) 提高影像数据传输安全的方法、装置、系统及存储介质
CN109951276B (zh) 基于tpm的嵌入式设备远程身份认证方法
Varsha et al. Using attribute-based encryption with advanced encryption standard for secure and scalable sharing of personal health records in cloud
JP7059282B6 (ja) ネットワークデバイス及び信頼できるサードパーティデバイス
Senthil Kumari et al. Key derivation policy for data security and data integrity in cloud computing
CN115412236A (zh) 一种密钥管理和密码计算的方法、加密方法及装置
Pushpa Enhancing Data Security by Adapting Network Security and Cryptographic Paradigms
TW202301830A (zh) 群組即時通訊的加密系統和加密方法
CN112989378A (zh) 一种基于属性加密的文件可信中间存储架构
CN111431721A (zh) 一种智能医疗环境下基于ibe的物联网设备加密方法
CN113691373B (zh) 一种基于联盟区块链的抗量子密钥托管系统及方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22900195

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 1020237031751

Country of ref document: KR

WWE Wipo information: entry into national phase

Ref document number: 2024502244

Country of ref document: JP

Ref document number: 22900195.3

Country of ref document: EP

Ref document number: 2022900195

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 18553926

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2022900195

Country of ref document: EP

Effective date: 20230927