WO2020191529A1 - 代码审计方法、装置,以及计算机可读介质 - Google Patents

代码审计方法、装置,以及计算机可读介质 Download PDF

Info

Publication number
WO2020191529A1
WO2020191529A1 PCT/CN2019/079288 CN2019079288W WO2020191529A1 WO 2020191529 A1 WO2020191529 A1 WO 2020191529A1 CN 2019079288 W CN2019079288 W CN 2019079288W WO 2020191529 A1 WO2020191529 A1 WO 2020191529A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
package file
client
virtual machine
directory
Prior art date
Application number
PCT/CN2019/079288
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 PCT/CN2019/079288 priority Critical patent/WO2020191529A1/zh
Publication of WO2020191529A1 publication Critical patent/WO2020191529A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules

Definitions

  • the present invention relates to computer technology, in particular to a code audit (code audit) method, a client and server for code audit, and a computer readable medium.
  • code audit code audit
  • Code audit is the main measure of security assessment, which can help customers find defects and security risks in software products. To reduce the cost of code auditing, code auditing tools can be centrally deployed on the server, but during the audit process, the customer needs to upload the code to be audited to the server.
  • the client's code is exposed during the audit process and the data storage process, and the server administrator, and even network attackers can easily obtain the client's code.
  • the embodiment of the present invention provides a code audit method, a client and server used for code audit, and a computer readable medium to ensure that the code is safe and not leaked when the code is audited on the server.
  • a code audit method which can be executed by a client, including: the client receives from the server the public key in the key pair generated by the server; the client uses the public key Encrypting the code package file to be audited to obtain the encrypted code package file to be audited; the client divides the encrypted code package file to be audited to obtain the first part of the code package file and the second part of the code package file; The client sends the first part of the code package file to the server; the client stores the second part of the code package file in a first directory of the client; the client accepts the server’s A request for the virtual machine to mount the first directory.
  • another code audit method is provided, which can be executed by a server, including: the server generates a key pair, wherein the key pair includes a public key and a private key; the server will The public key is sent to the client; the server generates a virtual machine; the virtual machine receives the first part of the code package file from the client, where the first part of the code package file is used by the client The key is obtained by encrypting and dividing the code package file to be audited; the virtual machine mounts a first directory of the client, and obtains the second part of the code package file from the first directory, wherein the The second part of the code package file is the code package file obtained after the client uses the public key to encrypt and split the code package file to be audited, except for the first part of the code package file; the virtual machine uses The private key decrypts the merged first part code package file and the second part code package file to obtain the code package file to be audited; the virtual machine audits the code package file to be audited and
  • a client for code auditing including: a communication module configured to receive from the server the public key in the key pair generated by the server; and an encryption module configured to use the The public key encrypts the code to be audited to obtain the encrypted code package file to be audited; a segmentation module is configured to split the encrypted code to be audited to obtain the first part of the code package file and the second part of the code package file
  • the communication module is also configured to send the first part of the code package file to the server; a catalog management module is configured to store the second part of the code package file in a first part of the client And accept the request of the virtual machine of the server to mount the first directory.
  • a server for code audit including: a key generation module configured to generate a key pair, wherein the key pair includes a public key and a private key; and a communication module , Configured to send the public key to the client; a virtual machine management module configured to: generate a virtual machine, and configure the virtual machine to perform the following operations: receive the first part of the code package from the client File, wherein the first part of the code package file is obtained by encrypting and dividing the code package file to be audited by the client using the public key; mount a first directory of the client and download it from the The second part of the code package file is obtained from the first directory, where the second part of the code package file is obtained after the client uses the public key to encrypt and divide the code package file to be audited, except for the first Part of the code package file other than the code package file; use the private key in the key pair to decrypt the combined first part of the code package file and the second part of the code package file to obtain the code package file to
  • a client for code auditing including: at least one memory for storing computer-readable code; at least one processor for executing the computer-readable code stored in the at least one memory , Execute the method provided in the first aspect.
  • a server for code auditing including: at least one memory for storing computer-readable codes; at least one processor for executing the computer-readable codes stored in the at least one memory, Perform the methods provided in the second aspect.
  • a computer-readable medium stores computer-readable code.
  • the computer-readable code is executed by at least one processor, the The method provided by the aspect.
  • the code to be audited is divided into two parts on the client side, and one part is encrypted and sent to the outside.
  • the other part of the server is encrypted and stored in a directory on the client side.
  • the virtual machine generated by the server mounts the directory and obtains the other part of the code.
  • the code transmission from the client to the server is encrypted, which ensures that the code is not stolen during transmission between devices.
  • the virtual machine mounts the directory of the client and obtains another part of the code, and the virtual machine is in a closed state, it is difficult for the administrator of the server to obtain the other part of the code, thereby ensuring that the entire code is not stolen by the administrator of the server.
  • the audit report is stored in the first directory of the mounted client; then The client obtains the audit report of the virtual machine stored in the mounted first directory.
  • the virtual machine mounts a second directory of the client, and the virtual machine stores the audit report in the mounted second directory, and the client accepts A request for a virtual machine of the server to mount a second directory of the client, and obtain an audit report of the virtual machine stored in the mounted second directory.
  • the audit report is also sent to the client by mounting the virtual machine, which ensures the secure transmission of the audit report and is not easy to be stolen.
  • the method further includes: uninstalling the first directory by the virtual machine; deleting the virtual machine by the server .
  • the virtual machine is uninstalled The first directory and the second directory; the server deletes the virtual machine. In this way, the code will be leaked after the audit is completed.
  • the file size of the second partial code package file is much smaller than the first partial code package file.
  • the client can upload the larger first part code package file to the server before notifying the server to start the code audit, so that after the code audit, only a very small amount of the second part code package file needs to be transmitted.
  • the transmission time is short, and customers can obtain audit reports faster, which improves the efficiency of code audit and improves customer experience.
  • the virtual machine does not open any ports other than the ports required for mounting the first directory and the second directory; the password of the operating system of the virtual machine is randomly generated.
  • the file system of the virtual machine is encrypted. In this way, it can further ensure that the code security is not stolen during the code audit and code transmission of the virtual machine.
  • Figure 1 is a schematic structural diagram of a code audit system provided by an embodiment of the present invention.
  • Figure 2 is a flowchart of interaction between devices in the code audit method provided by an embodiment of the present invention.
  • Fig. 3 is a processing flowchart of a code audit method provided by an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a structure of a user code auditing client provided by an embodiment of the present invention.
  • Fig. 5 is a schematic diagram of another structure of a client for code audit provided by an embodiment of the present invention.
  • Fig. 6 is a schematic diagram of a structure of a user code audit server provided by an embodiment of the present invention.
  • Fig. 7 is a schematic diagram of another structure of a server for code audit provided by an embodiment of the present invention.
  • the code to be audited is divided into two parts on the client side, and one part is encrypted and sent to the external server , The other part is encrypted and stored in a directory on the client side.
  • the virtual machine generated by the server mounts the directory and obtains the other part of the code.
  • the code transmission from the client to the server is encrypted, which ensures that the code is not stolen during transmission between devices.
  • the virtual machine mounts the directory of the client and obtains another part of the code, and the virtual machine is in a closed state, it is difficult for the administrator of the server to obtain the other part of the code, thereby ensuring that the entire code is not stolen by the administrator of the server.
  • FIG. 1 is a schematic structural diagram of a code audit system provided by an embodiment of the present invention.
  • the code audit system 100 includes a client 30 and a server 40.
  • the client 10 uploads the code package file 20 to be audited to the client 30.
  • the client 30 is located on the side of the client 10, and the server 40 is a server other than the client 30. It can be dedicated to auditing the code of the client 10, or can be used to audit the code for multiple clients.
  • the code package file 20 to be audited may be a source code package file that has not been compiled, or a target code package file generated after compilation and packaging, or an executable program package file.
  • the code package file 20 to be audited may be a compressed file package, or a compiled and packaged software package.
  • the client 30 receives the public key 61 in a key pair generated by the server 40 from the server 40, and uses the public key 61 to encrypt the code package file 20 to be audited.
  • the client 30 may divide the code package file 20 to be audited before or after encryption, and obtain two code package files after the division and encryption: the first part of the code package file 20'a and the second part of the code package file 20'b.
  • the two parts of the code package file are obtained by the server 40 in different ways.
  • the server 40 decrypts the two parts of the code package file after merging to obtain the code package file 20 to be audited.
  • the server 40 audits the code package file 20 to be audited to obtain an audit report 50 and returns it to the client 30.
  • the server 40 generates a virtual machine 90, and the virtual machine 90 performs code audit and transmission to ensure that the code is not leaked.
  • FIG. 2 is a flowchart of interaction between devices in the code audit method provided by an embodiment of the present invention.
  • the method 200 may include the following steps:
  • the client 10 sends a request for uploading a code package file to the server 40 through the client 30.
  • the client 10 can upload the code package file 20 to be audited to the client 30 in advance, or the code package file 20 to be audited already exists in the client 30. Furthermore, the client 10 sends a request for uploading a code package file to the server 40 through the client 30, requesting to upload the code package file 20 to be audited to the server 40.
  • S202 The server 40 sends the public key 61 to the client 30.
  • the server 40 may generate a key pair after receiving a request from the client 30 to upload the code package file.
  • the key pair may include Public key 61 and private key 62.
  • the server 40 sends the public key 61 to the client 30, and retains the private key 62 for subsequent decryption of the encrypted code package file.
  • S203 The client 30 notifies the client 10 that the public key has been allocated, and the code package file can be uploaded.
  • S204 The client 10 instructs the client 30 to start uploading the code package file 20 to be audited.
  • the client 30 uses the public key 61 to encrypt the code package file 20 to be audited to obtain the encrypted code package file 20' to be audited.
  • S206 The client 30 divides the encrypted code package file 20' to be audited into the first part of the code package file 20'a and the second part of the code package file 20'b.
  • the code package file 20 to be audited may be encrypted first, and then the encrypted code package file 20 to be audited may be divided, or the code package file 20 to be audited may be divided first, and then the division After each part of the code package file is encrypted.
  • the server 40 when the server 40 generates a key pair, it can generate N key pairs, where N is an integer not less than 2.
  • Each key pair includes a public key 61, and the client 30 can divide the code package file 20 to be audited into N parts, and each part is encrypted with a public key 61.
  • Part of the divided code package file is sent to the server 40, and the other part is stored in the first directory 71 of the client 30.
  • the code package file sent to the server 40 is collectively referred to as the "first part code package file 20'a", and the code package file stored in the first directory 71 of the client 30
  • the code package files are collectively referred to as "Part 2 code package file 20'b”.
  • the client 30 stores the second part of the code package file 20'b in the first directory 71 of the client 30.
  • S208 The client 30 sends the first part of the code package file 20'a to the server 40.
  • step S207 and step S208 is not limited. Step S208 may be executed first and then step S207 may be executed, step S207 may be executed first and then step S208 may be executed, or both steps may be executed simultaneously.
  • the server 40 stores the received first part code package file 20'a in the memory 80.
  • the client 10 informs the server 30 through the client 30 to start the code audit. This step is optional.
  • the client 10 can upload the code package file through step S201 and notify the server 40 to start the code audit after receiving the first part of the code package file 20'a. It is also possible to notify the client 30 to upload the code package file 20 to be audited only through step S201, and then notify the server 40 to start the code audit through step S210 when the code audit is required.
  • the first part of the code package file 20'a can be made much larger than the second part of the code package file 20'b.
  • the first part of the code package file 20'a is 10M bytes
  • the second part of the code package file 20'b is 20k bytes.
  • the proportion of the first part of the code package file 20'a and the second part of the code package file 20'b in the entire code package file 20 to be audited can be preset, which can be set according to different application scenarios or customer needs. It is defined that the first part of the code package file 20'a is much larger than the second part of the code package file 20'b.
  • the server 30 generates a virtual machine 90 and starts the virtual machine 90.
  • the server 40 generates a virtual machine 90 after determining to start the code audit.
  • the server 40 may have a built-in virtual machine management module 403 for generating and managing the virtual machine 90. Among them, a closed virtual environment can be formed by the virtual machine 90. Except for the ports required for mounting the directory, any ports other than the ports required for mounting the first directory 71 and the second directory 72 are not opened to the outside world.
  • the password of the operating system of the machine 90 can be randomly generated, and even the administrator of the server 40 cannot obtain the password.
  • the file system of the virtual machine 90 can be encrypted, and no one or device can obtain the files in the virtual machine 90.
  • the virtual machine 90 may be a VM (Virtual Machine), or may be Docker, etc., as long as a closed virtual environment can be formed.
  • the virtual machine 90 also needs to have conditions for code auditing, such as sufficient storage resources and processing resources. If the code package file 20 to be audited is JAVA code, a JDK or JRE is also required; if the code package file 20 to be audited is a .NET code, the .NET framework is also required.
  • the virtual machine 90 mounts the first directory 71 of the client 30 and obtains the second part of the code package file 20'b. Among them, the virtual machine 90 can mount the first directory 71 of the client 30 using the aforementioned public key 61.
  • the virtual machine 90 merges the first part of the code package file 20'a and the second part of the code package file 20'b, and decrypts the merged code package file to obtain the code package file 20 to be audited.
  • S215 The virtual machine 90 audits the code package file 20 to be audited to obtain an audit report 50.
  • the virtual machine 90 stores the audit report 50 in the first directory 71 of the client 30.
  • the audit report 50 can be mounted in the same first directory 71 where the second part of the code package file 20'b is stored, or can be mounted in the second directory 72 on the client 30.
  • S217 The client 30 presents the audit report 50 to the client 10.
  • S219 The client 30 notifies the server 30 of the end of the audit.
  • S220 The server 30 uninstalls the first directory 71 and permanently deletes the virtual machine 90. Once the virtual machine 90 is deleted, it cannot be restored.
  • step S220 the second directory 72 is also unmounted.
  • step S220 By uninstalling the directory of the client 30 in step S220, deleting the first part of the code package file 20'a stored in the server 40, and deleting the virtual machine 90, the code package file 20 to be audited can be further prevented from being stolen.
  • FIG. 3 is a processing flowchart of a code audit method 200 provided by an embodiment of the present invention. It can be seen from Figure 3.
  • the code package file 20 to be audited is encrypted by the public key 61 and then divided into a first part of code package file 20'a and a second part of code package file 20'b, of which the first part of code package file 20'a It is transmitted to the server 40 and stored in the memory 80 by the server 40; and the second part of the code package file 20'b is stored in the first directory 71 of the client 30.
  • the virtual machine 90 generated by the server 40 is mounted in the first directory 71 to obtain the second part of the code package file 20'b.
  • the virtual machine 90 uses the private key 62 to decrypt the combined two-part code package file to obtain the code package file 20 to be audited.
  • the virtual machine 90 audits the code package file 20 to be audited to obtain an audit report 50.
  • the virtual machine 90 mounts the first directory 71 or the second directory 72 of the client 30 and places the audit report 50 in the directory.
  • FIG. 4 is a schematic structural diagram of a client 30 for user code audit provided by an embodiment of the present invention. As shown in FIG. 4, the client 30 may include:
  • a communication module 301 configured to receive the public key 61 in the key pair generated by the server 40 from the server 40;
  • An encryption module 302 is configured to use the public key 61 to encrypt the code package file 20 to be audited to obtain the encrypted code package file 20' to be audited;
  • a segmentation module 303 is configured to segment the encrypted code package file 20' to be audited to obtain the first part of the code package file 20'a and the second part of the code package file 20'b;
  • the communication module 301 is also configured to send the first part of the code package file 20'a to the server 40;
  • a directory management module 304 is configured to store the second part of the code package file 20'b in a first directory 71 of the client 30 and accept a request from the virtual machine 90 of the server 40 to mount the first directory 71.
  • the directory management module 304 is further configured to:
  • the file size of the second partial code package file 20'b is much smaller than the first partial code package file 20'a.
  • Fig. 5 is a schematic diagram of another structure of a client for code audit provided by an embodiment of the present invention.
  • the client 30 may include: at least one memory 305 for storing computer-readable codes; at least one processor 306 for executing the computer-readable codes stored in the memory 305 to execute The operation of the client 30 in the code audit process shown in FIG. 2 or FIG. 3.
  • the modules shown in FIG. 4 can be regarded as program modules written by computer readable codes stored in the memory 305. When these program modules are called by the processor 306, the processing procedures of the client 30 in the foregoing method can be executed.
  • the client 30 can also include an I/O interface 307, which can be connected to external devices such as a mouse and a display, and can also be connected to the server 40.
  • the at least one memory 305, the at least one processor 306, and the I/O interface 307 can communicate through the bus 308.
  • FIG. 6 is a schematic structural diagram of a user code audit server 40 provided by an embodiment of the present invention. As shown in FIG. 6, the server 40 may include:
  • a key generation module 401 is configured to generate a key pair, where the key pair includes a public key 61 and a private key 62;
  • a communication module 402 configured to send the public key 61 to the client 30;
  • a virtual machine management module 403 is configured to generate a virtual machine 90, and configure the virtual machine 90 to perform the following operations:
  • the code package file 20 to be audited is audited and an audit report 50 is obtained.
  • the virtual machine management module 403 is further configured to: configure the virtual machine 90 to audit the code package file 20 to be audited and obtain the audit report 50, and then store the audit report 50 to the mounted client 30 In the first directory 71; or configure the virtual machine 90 to mount a second directory 72 of the client 30, and mount the audit report 50 to the second directory 72.
  • the virtual machine management module 403 is further configured to: configure the virtual machine 90 to uninstall the first directory 71 after storing the audit report 50 in the first directory 71 of the mounted client 30; the server 30 deletes the virtual machine ⁇ 90; Delete the first part of the code package file 20'a.
  • the virtual machine management module 403 is further configured to: configure the virtual machine 90 to uninstall the first directory 71 and the second directory 72 after storing the audit report 50 in the second directory 72 of the mounted client 30 ; Delete the virtual machine 90; Delete the first part of the code package file 20'a.
  • the file size of the second partial code package file 20'b is much smaller than the first partial code package file 20'a.
  • FIG. 7 is a schematic diagram of another structure of a server 40 for code audit provided by an embodiment of the present invention.
  • the server 40 may include: at least one memory 404 for storing computer-readable codes; at least one processor 405 for executing the computer-readable codes stored in the memory 404, thereby executing the graph 2 or the operation of the server 40 in the code audit flow shown in FIG. 3.
  • the modules shown in FIG. 6 can be regarded as program modules written by computer readable codes stored in the memory 404, and when these program modules are called by the processor 405, the processing procedures of the server 40 in the foregoing method can be executed.
  • the server 40 can also include an I/O interface 406, which can be connected to external devices such as a mouse and a display, and can also be connected to the client 30.
  • the at least one memory 404, the at least one processor 405, and the I/O interface 406 may communicate with each other through the bus 407.
  • an embodiment of the present invention also provides a computer-readable medium that stores computer-readable code, and when the computer-readable code is executed by at least one processor, the computer-readable code shown in FIG. 2 or FIG. Methods.
  • the embodiments of the present invention provide a code audit method, a client and server used for code audit, and a computer-readable medium to ensure that the code is safe and protected when it is audited on the server and when it is stored on the server. Give way.
  • the server in the code storage process, the server can only obtain a part of the encrypted code, and it is difficult to obtain the original entire code, which can effectively prevent the client's code from being leaked, even during the code transmission process.
  • the virtual machine provides a closed environment and only exists for a short time. It is difficult for an attacker or even a server administrator to enter the virtual machine to obtain the code.
  • system structure described in the foregoing embodiments may be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by at least two physical entities, or at least Some components in two independent devices are implemented together.
  • the hardware unit can be implemented mechanically or electrically.
  • a hardware unit may include permanent dedicated circuits or logic (such as dedicated processors, Field-Programmable Gate Array (FPGA) or Application Specific Integrated Circuits (ASIC), etc.). Complete the corresponding operation.
  • the hardware unit may also include programmable logic or circuits (such as general-purpose processors or other programmable processors), which may be temporarily set by software to complete corresponding operations.
  • the specific implementation mode mechanical method, or dedicated permanent circuit, or temporarily set circuit

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

涉及计算机技术,尤其涉及一种代码审计方法、用于代码审计的客户端和服务器,以及计算机可读介质。本发明实施例提供的一种代码审计方法包括:客户端对待审计的代码包文件加密后分割,将分割得到的一部分代码包文件放在自身的目录中,将分割得到的另一部分代码包文件发送至服务器。服务器生成的虚拟机对两部分代码包文件合并后进行解密后得到待审计的代码包文件并进行审计得到审计报告返回给客户端。由虚拟机90进行代码审计和传送,保证了代码不被泄露。

Description

代码审计方法、装置,以及计算机可读介质 技术领域
本发明涉及计算机技术,尤其涉及一种代码审计(code audit)方法、用于代码审计的客户端和服务器,以及计算机可读介质。
背景技术
代码审计是安全评估的主要措施,可帮助客户发现软件产品中的缺陷和安全隐患。,为降低代码审计成本,代码审计工具可集中部署在服务器上,但审计过程中需要客户要将待审计的代码上传至服务器。
目前,在服务器上审计代码的方法中,客户的代码在审计过程中以及数据存储过程中被暴露在外,服务器的管理员,甚至网络攻击者可以较容易地获取客户的代码。
考虑到代码的安全,如何避免代码在集中化审计的过程中不会被泄露成为了一个亟待解决的问题。
发明内容
本发明实施例提供了一种代码审计方法,用于代码审计的客户端和服务器,以及计算机可读介质,用以保证代码在服务器上被审计时安全、不被泄露。
第一方面,提供一种代码审计方法,该方法可由一个客户端来执行,其中包括:客户端从服务器处接收服务器所生成的密钥对中的公钥;所述客户端使用所述公钥加密待审计的代码包文件以得到加密后待审计的代码包文件;所述客户端将加密后待审计的代码包文件进行分割,得到第一部分代码包文件和第二部分代码包文件;所述客户端将所述第一部分代码包文件发送至所述服务器;所述客户端将所述第二部分代码包文件存储在所述客户端的一个第一目录中;所述客户端接受所述服务器的虚拟机挂载所述第一目录的请求。
第二方面,提供另一种代码审计方法,该方法可由一个服务器来执行,其中包括:服务器生成一个密钥对,其中,所述密钥对包括一个公钥和一个私钥;服务器将所述公钥发送至客户端;所述服务器生成一个虚拟机;所述虚拟机从所述客户端处接收第一部分代码包文件,其中,所述第一部分代码包文件是所述客户端使用所述公钥对待审计的代码包文件进行加密 并分割后得到的;所述虚拟机挂载所述客户端的一个第一目录,并从所述第一目录中获取第二部分代码包文件,其中,所述第二部分代码包文件是所述客户端使用所述公钥对待审计的代码包文件进行加密并分割后得到的、除所述第一部分代码包文件之外的代码包文件;所述虚拟机使用所述私钥解密合并后的所述第一部分代码包文件和所述第二部分代码包文件得到所述待审计的代码包文件;所述虚拟机对所述待审计的代码包文件进行审计并得到审计报告。
第三方面,提供一种用于代码审计的客户端,包括:一个通信模块,被配置为从服务器处接收服务器所生成的密钥对中的公钥;一个加密模块,被配置为使用所述公钥加密待审计的代码以得到加密后的待审计的代码包文件;一个分割模块,被配置为将加密后的待审计的代码进行分割,得到第一部分代码包文件和第二部分代码包文件;所述通信模块,还被配置为将所述第一部分代码包文件发送至所述服务器;一个目录管理模块,被配置为将所述第二部分代码包文件存储在所述客户端的一个第一目录中,以及接受所述服务器的虚拟机挂载所述第一目录的请求。
第四方面,提供一种用于代码审计的服务器,包括:一个密钥生成模块,被配置为生成一个密钥对,其中,所述密钥对包括一个公钥和一个私钥;一个通信模块,被配置为将所述公钥发送至客户端;一个虚拟机管理模块,被配置为:生成一个虚拟机,并配置所述虚拟机执行如下操作:从所述客户端处接收第一部分代码包文件,其中,所述第一部分代码包文件是所述客户端使用所述公钥对待审计的代码包文件进行加密并分割后得到的;挂载所述客户端的一个第一目录,并从所述第一目录中获取第二部分代码包文件,其中,所述第二部分代码包文件是所述客户端使用所述公钥对待审计的代码包文件进行加密并分割后得到的、除所述第一部分代码包文件之外的代码包文件;使用所述密钥对中的私钥解密合并后的所述第一部分代码包文件和所述第二部分代码包文件得到所述待审计的代码包文件;对所述待审计的代码包文件进行审计并得到审计报告。
第五方面,提供一种用于代码审计的客户端,包括:至少一个存储器,用于存放计算机可读代码;至少一个处理器,用于执行所述至少一个存储器存放的所述计算机可读代码,执行第一方面所提供的方法。
第六方面,提供一种用于代码审计的服务器,包括:至少一个存储器,用于存放计算机可读代码;至少一个处理器,用于执行所述至少一个存储器存放的所述计算机可读代码,执行第二方面所提供的方法。
第七方面,提供一种计算机可读介质,所述计算机可读介质存储有计算机可读代码,当所述计算机可读代码被至少一个处理器执行时,执行如权利要求第一方面或第二方面提供的方法。
其中,为了避免客户的代码在外部的服务器上审计的过程中,代码被窃取的风险,本发明实施例中,待审计的代码在客户端侧被分为两部分,一部分在加密后发送至外部的服务器,另一部分加密后被存储在客户端侧的一个目录中,待执行代码审计时,由服务器生成的虚拟机挂载该目录并获取该另一部分代码。从客户端到服务器的代码传输由于进行了加密,从而保证了代码在设备间传输时不被窃取。并且,由于虚拟机挂载客户端的目录并获取另一部分代码,并且虚拟机处于封闭状态,即使是服务器的管理员也难以得到该另一部分代码,从而保证了整个代码不被服务器的管理员窃取。
可选地,在所述虚拟机对所述待审计的代码包文件进行审计并得到审计报告之后,将所述审计报告存放到所挂载的所述客户端的所述第一目录中;则所述客户端获取所述虚拟机存放到所挂载的所述第一目录中的审计报告。或者,可选地,所述虚拟机挂载所述客户端的一个第二目录,以及所述虚拟机将所述审计报告存放到所挂载的所述第二目录中,所述客户端接受所述服务器的虚拟机挂载所述客户端的一个第二目录的请求,并获取所述虚拟机存放到所挂载的所述第二目录中的审计报告。其中,审计报告也通过虚拟机挂载的方式发送至客户端,保证了审计报告安全传输,不易被窃取。
可选地,在所述虚拟机挂载所述审计报告到所述客户端的所述第一目录中之后,还包括:所述虚拟机卸载所述第一目录;所述服务器删除所述虚拟机。或者,对于审计报告和第二部分代码包文件分开两个目录存储的情况下,在所述虚拟机挂载所述审计报告到所述客户端的所述第二目录中之后,所述虚拟机卸载所述第一目录和所述第二目录;所述服务器删除所述虚拟机。这样,可有效避免审计完成后代码会被泄露。
可选地,所述第二部分代码包文件的文件大小远小于所述第一部分代码包文件。这样,客户端可在通知服务器开始进行代码审计之前,将较大的第一部分代码包文件预先上传至服务器,从而在进行代码审计后,仅需要传送非常少量的第二部分代码包文件,所需的传输时间短,客户可较快地获得审计报告,提高了代码审计的效率,改善了客户体验。
可选地,所述虚拟机不对外开放除挂载所述第一目录和所述第二目录所需端口之外的任何端口;所述虚拟机的操作系统的密码是随机生成的。所述虚拟机的文件系统被加密。这样,可进一步保证虚拟机在进行代码审计和代码传输的过程中,代码安全不被窃取。
附图说明
图1为本发明实施例提供的代码审计系统的结构示意图。
图2为本发明实施例提供的代码审计方法中各设备之间交互的流程图。
图3为本发明实施例提供的代码审计方法的处理流程图。
图4为本发明实施例提供的用户代码审计的客户端的一种结构示意图。
图5为本发明实施例提供的用于代码审计的客户端的另一种结构示意图。
图6为本发明实施例提供的用户代码审计的服务器的一种结构示意图。
图7为本发明实施例提供的用于代码审计的服务器的另一种结构示意图。
附图标记列表:
Figure PCTCN2019079288-appb-000001
Figure PCTCN2019079288-appb-000002
具体实施方式
为了避免客户的代码在外部的服务器上审计的过程中,代码被窃取的风险,本发明实施例中,待审计的代码在客户端侧被分为两部分,一部分在加密后发送至外部的服务器,另一部分加密后被存储在客户端侧的一个目录中,待执行代码审计时,由服务器生成的虚拟机挂载该目录并获取该另一部分代码。从客户端到服务器的代码传输由于进行了加密,从而保证了代码在设备间传输时不被窃取。并且,由于虚拟机挂载客户端的目录并获取另一部分代码,并且虚拟机处于封闭状态,即使是服务器的管理员也难以得到该另一部分代码,从而保证了整个代码不被服务器的管理员窃取。
为了使本发明实施例的目的、技术方案和优点更加清楚明白,以下参照附图对本发明实施例进一步详细说明。其中,后续描述的实施例仅仅是本发明实施例的一部分,而非全部的实施例。
图1为本发明实施例提供的代码审计系统的结构示意图。如图1所示,该代码审计系统100包括一个客户端30和一个服务器40。客户10将待审计的代码包文件20上传至客户端30。这里,客户端30位于客户10一侧,而服务器40是客户端30之外的服务器,其可专用于对该客户10的代码进行审计,也可用于为多名客户进行代码审计。待审计的代码包文件20可以为未经过编译的源代码包文件,也可为编译打包后生成的目标代码包文件,或者还可以为可执行的程序包文件。待审计的代码包文件20可以是压缩处理后的文件包,也可以是编译打包后的软件包。客户端30从服务器40处接收服务器40生成的一个密钥对中的公钥61,并使用该公钥61对待审计的代码包文件20进行加密。客户端30可在加密前或加密后对待审计的代码包文件20进行分割,分割且加密后得到两份代码包文件:第一部分代码包文件20’a和第二部分代码包文件20’b。两部分代码包文件通过不同方式由服务器40获取。服务器40对两部分代码包文件合并后进行解密后得到待审计的代码包文件20。服务器40对待审计的代码包文件20进行审计得到审计报告50并返回给客户端30。其中服务器40生成一个虚拟机90,由该虚拟机90进行代码审计和传送,保证了代码不被泄露。
图2为本发明实施例提供的代码审计方法中各设备之间交互的流程图。该方法200可包括如下步骤:
S201:客户10通过客户端30向服务器40发送上传代码包文件的请求。
客户10可预先将待审计的代码包文件20上传至客户端30,或者待审计的代码包文件20已存在于客户端30中。进而客户10通过客户端30向服务器40发送上传代码包文件的请求,请求将待审计的代码包文件20上传至服务器40。
S202:服务器40向客户端30发送公钥61。
为了保证待审计的代码包文件20在设备间传输时不被窃取,服务器40可在收到来自客户端30的上传代码包文件的请求后,生成一个密钥对,该密钥对中可包括公钥61和私钥62。其中,服务器40将公钥61发送至客户端30,而保留该私钥62以待后续对加密后的代码包文件进行解密。
S203:客户端30通知客户10公钥已分配,可以上传代码包文件。
S204:客户10指示客户端30开始上传待审计的代码包文件20。
S205:客户端30使用公钥61对待审计的代码包文件20进行加密,得到加密后的待审计的代码包文件20’。
S206:客户端30分割加密后的待审计的代码包文件20’为第一部分代码包文件20’a和第二部分代码包文件20’b。
当且仅当两部分代码包文件均被窃取并知晓加密等运算处理方法时才有可能还原完整的代码包文件。待审计的代码包文件20在分割时,并不是按照代码行进行分割的,可对整个待审计的代码20进行一定的运算处理后,再进行分割,即使其中一部分代码被窃取,由于窃取方不了解运算处理的方法,也无法还原整个代码中的任何一部分。
对于步骤S205和步骤S206,可以先对待审计的代码包文件20进行加密,再对加密后的待审计的代码包文件20进行分割,也可以先对待审计的代码包文件20进行分割,再对分割后的每一部分代码包文件进行加密。若是后一种情况,服务器40在生成密钥对时,可生成N个密钥对,其中,N为不小于2的整数。每一个密钥对都包含一个公钥61,而客户端30可将待审计的代码包文件20分割成N个部分,每一个部分用一个公钥61进行加密。
分割后的代码包文件,一部分发送至服务器40,另一部分存储在客户端30的第一目录71中。其中,无论待审计的代码包文件20被分割为多少份,发送至服务器40的代码包文件统称为“第一部分代码包文件20’a”,而存储在客户端30的第一目录71中的代码包文件统称为“第二部分代码包文件20’b”。
S207:客户端30将第二部分代码包文件20’b存储在客户端30的第一目录71中。
S208:客户端30将第一部分代码包文件20’a发送至服务器40。
这里,对步骤S207和步骤S208的先后顺序不做限定,可先执行步骤S208再执行步骤S207,也可先执行步骤S207再执行步骤S208,也可两步骤同时执行。
S209:服务器40将收到的第一部分代码包文件20’a存储在存储器80中。
S210:客户10通过客户端30通知服务器30开始进行代码审计。该步骤为可选步骤,客户10可以通过步骤S201上传代码包文件并通知服务器40在收到第一部分代码包文件20’a后即开始进行代码审计。也可仅通过步骤S201通知客户端30上传待审计的代码包文件20,再在需要进行代码审计时,通过步骤S210通知服务器40开始进行代码审计。
其中,步骤S206中,在进行代码包文件分割时,可使得第一部分代码包文件20’a远大于第二部分代码包文件20’b。比如:第一部分代码包文件20’a为10M字节,而第二部分代码包文件20’b为20k字节。在通过步骤S210通知服务器40开始进行代码审计之前,将较大的一部分代码包文件预先上传至服务器40,从而在进行代码审计后,仅需要传送非常少量的代码包文件,所需的传输时间短,客户10可较快地获得审计报告50,提高了代码审计的效率,改善了客户体验。需要说明的是,第一部分代码包文件20’a和第二部分代码包文件20’b在整个待审计的代码包文件20中的比例可预先设定,可根据不同的应用场景或者客户需求来定义第一部分代码包文件20’a远大于第二部分代码包文件20’b的程度。
S211:服务器30生成虚拟机90并启动该虚拟机90。服务器40在确定开始代码审计后,生成一个虚拟机90。服务器40可内置一个虚拟机管理模块403,用于生成虚拟机90和对虚拟机90进行管理。其中,通过虚拟机90可形成一个封闭的虚拟环境,除挂载目录所需端口外,不向外开放除挂载第一目录71和第二目录72所需端口之外的任何端口,该虚拟机90的操作系统的密码可随机生成,即使是服务器40的管理员也无法获得该密码。虚拟机90的文件系统可被加密,任何人或设备都无法获取虚拟机90中的文件。包括服务器40在内的设备都无法控制该虚拟机90以获取待审计的代码包文件20。在实现上该虚拟机90可为VM(Virtual Machine),也可为Docker等,只要能够形成一个封闭的虚拟环境即可。此外,虚拟机90还需要具备进行代码审计的条件,比如足够的存储资源和处理资源。若待审计的代码包文件20为JAVA代码,则还需要JDK或JRE;若待审计的代码包文件20为.NET代码,则还需要.NETframework。
S212:虚拟机90挂载客户端30的第一目录71并获取第二部分代码包文件20’b。其中,虚拟机90可使用前述的公钥61挂载该客户端30的第一目录71。
S213:虚拟机90挂载到存储器80上获取第一部分代码包文件20’a。
S214:虚拟机90合并第一部分代码包文件20’a和第二部分代码包文件20’b,并对合并 后的代码包文件进行解密,得到待审计的代码包文件20。
S215:虚拟机90对待审计的代码包文件20进行审计得到审计报告50。
S216:虚拟机90存放审计报告50到客户端30的第一目录71中。
其中,审计报告50可挂载到与存储第二部分代码包文件20’b相同的第一目录71中,也可挂载到客户端30上的第二目录72中。
S217:客户端30将审计报告50呈现给客户10。
S218:客户10向客户端30反馈确认审计报告50的消息。
S219:客户端30通知服务器30审计结束。
S220:服务器30卸载第一目录71,以及永久删除虚拟机90,该虚拟机90一旦被删除即无法恢复。
其中,若审计报告50被存放到挂载的第二目录72,则步骤S220中,还要卸载第二目录72。
通过步骤S220卸载客户端30的目录,删除存储在服务器40中的第一部分代码包文件20’a,删除虚拟机90,可进一步避免待审计的代码包文件20被窃取。
图3为本发明实施例提供的代码审计方法200的处理流程图。由图3可以看出。在客户端30侧,待审计的代码包文件20由公钥61进行加密后分割为第一部分代码包文件20’a和第二部分代码包文件20’b,其中第一部分代码包文件20’a被传送至服务器40,并被服务器40存储在存储器80中;而第二部分代码包文件20’b被存储在客户端30的第一目录71中。由服务器40生成的虚拟机90挂载到该第一目录71中获取该第二部分代码包文件20’b。虚拟机90使用私钥62对合并后的两部分代码包文件进行解密得到待审计的代码包文件20。虚拟机90对待审计的代码包文件20进行审计得到审计报告50。虚拟机90挂载客户端30的第一目录71或第二目录72并将审计报告50放置于该目录中。
图4为本发明实施例提供的用户代码审计的客户端30的一种结构示意图。如图4所示,该客户端30可包括:
一个通信模块301,被配置为从服务器40处接收服务器40所生成的密钥对中的公钥61;
一个加密模块302,被配置为使用公钥61加密待审计的代码包文件20以得到加密后的待审计的代码包文件20’;
一个分割模块303,被配置为将加密后的待审计的代码包文件20’进行分割,得到第一部 分代码包文件20’a和第二部分代码包文件20’b;
通信模块301,还被配置为将第一部分代码包文件20’a发送至服务器40;
一个目录管理模块304,被配置为将第二部分代码包文件20’b存储在客户端30的一个第一目录71中,以及接受服务器40的虚拟机90挂载第一目录71的请求。
可选地,目录管理模块304还被配置为:
在接受服务器40的虚拟机90挂载第一目录71的请求之后,获取虚拟机90存放到所挂载的第一目录71中的审计报告50;或者
接受服务器40的虚拟机90挂载客户端30的一个第二目录72的请求,以及获取虚拟机90存放到所挂载的第二目录72中的审计报告50。
可选地,第二部分代码包文件20’b的文件大小远小于第一部分代码包文件20’a。
该客户端30的其他可选实现方式可参照前述图2和图3流程中客户端30的操作,这里不再赘述。
图5为本发明实施例提供的用于代码审计的客户端的另一种结构示意图。如图5所示,在此结构下,客户端30可包括:至少一个存储器305,用于存放计算机可读代码;至少一个处理器306,用于执行存储器305存放的计算机可读代码,从而执行图2或图3中所示的代码审计流程中客户端30的操作。其中,图4中示出的各个模块可视为存储器305中存储的计算机可读代码编写的程序模块,当这些程序模块被处理器306调用时,能够执行前述方法中客户端30的处理流程。此外,客户端30还可包块一个I/O接口307,该I/O接口可连接鼠标、显示器等外部设备,也可连接服务器40。可选地,至少一个存储器305,至少一个处理器306以及I/O接口307之间可通过总线308通信。
图6为本发明实施例提供的用户代码审计的服务器40的一种结构示意图。如图6所示,该服务器40可包括:
一个密钥生成模块401,被配置为生成一个密钥对,其中,密钥对包括一个公钥61和一个私钥62;
一个通信模块402,被配置为将公钥61发送至客户端30;
一个虚拟机管理模块403,被配置为:生成一个虚拟机90,并配置虚拟机90执行如下操作:
从客户端30处接收第一部分代码包文件20’a,其中,第一部分代码包文件20’a是客 户端30使用公钥61对待审计的代码包文件20进行加密并分割后得到的;
挂载客户端30的一个第一目录71,并从第一目录71中获取第二部分代码包文件20’b,其中,第二部分代码包文件20’b是客户端30使用公钥61对待审计的代码包文件20进行加密并分割后得到的、除第一部分代码包文件20’a之外的代码包文件;
使用密钥对中的私钥62解密合并后的第一部分代码包文件20’a和第二部分代码包文件20’b得到待审计的代码包文件20;
对待审计的代码包文件20进行审计并得到审计报告50。
可选地,虚拟机管理模块403还被配置为:配置虚拟机90在对待审计的代码包文件20进行审计并得到审计报告50之后,将审计报告50存放到到所挂载的客户端30的第一目录71中;或者配置虚拟机90挂载客户端30的一个第二目录72,以及挂载审计报告50到第二目录72中。
可选地,虚拟机管理模块403还被配置为:配置虚拟机90在将审计报告50存放到所挂载的客户端30的第一目录71中之后,卸载第一目录71;服务器30删除虚拟机90;删除第一部分代码包文件20’a。
可选地,虚拟机管理模块403还被配置为:配置虚拟机90在将审计报告50存放到所挂载的客户端30的第二目录72中之后,卸载第一目录71和第二目录72;删除虚拟机90;删除第一部分代码包文件20’a。
可选地,第二部分代码包文件20’b的文件大小远小于第一部分代码包文件20’a。
该服务器40的其他可选实现方式可参照前述图2和图3流程中服务器40的操作,这里不再赘述。
图7为本发明实施例提供的用于代码审计的服务器40的另一种结构示意图。如图5所示,在此结构下,服务器40可包括:至少一个存储器404,用于存放计算机可读代码;至少一个处理器405,用于执行存储器404存放的计算机可读代码,从而执行图2或图3中所示的代码审计流程中服务器40的操作。其中,图6中示出的各个模块可视为存储器404中存储的计算机可读代码编写的程序模块,当这些程序模块被处理器405调用时,能够执行前述方法中服务器40的处理流程。此外,服务器40还可包块一个I/O接口406,该I/O接口可连接鼠标、显示器等外部设备,也可连接客户端30。可选地,至少一个存储器404,至少一个处理器405以及I/O接口406之间可通过总线407通信。
此外,本发明实施例还提供一种计算机可读介质,该计算机可读介质存储有计算机可读代码,当该计算机可读代码被至少一个处理器执行时,实现前述图2或图3所示的方法。
综上,本发明实施例提供一种代码审计方法,用于代码审计的客户端和服务器,以及计算机可读介质,用以保证代码在服务器上被审计时以及在服务器上存储时安全、不被泄露。
其中,在代码存储过程中,服务器仅能获取加密代码中的一部分,其很难获得原始的整个代码,这可有效防止客户的代码被泄露,即使是在代码的传输过程中。
此外,在代码审计过程中,虚拟机提供了一个封闭的环境,并且仅存在较短的时间。攻击者甚至是服务器的管理员都难以进入虚拟机以获取代码。
需要说明的是,上述各流程和各系统结构图中不是所有的步骤和模块都是必须的,可以根据实际的需要忽略某些步骤或模块。各步骤的执行顺序不是固定的,可以根据需要进行调整。上述各实施例中描述的系统结构可以是物理结构,也可以是逻辑结构,即,有些模块可能由同一物理实体实现,或者,有些模块可能分由至少两个物理实体实现,或者,可以由至少两个独立设备中的某些部件共同实现。
以上各实施例中,硬件单元可以通过机械方式或电气方式实现。例如,一个硬件单元可以包括永久性专用的电路或逻辑(如专门的处理器,现场可编程门阵列(Field-Programmable Gate Array,FPGA)或专用集成电路(Application Specific Integrated Circuits,ASIC)等)来完成相应操作。硬件单元还可以包括可编程逻辑或电路(如通用处理器或其它可编程处理器),可以由软件进行临时的设置以完成相应操作。具体的实现方式(机械方式、或专用的永久性电路、或者临时设置的电路)可以基于成本和时间上的考虑来确定。
上文通过附图和优选实施例对本发明实施例进行了详细展示和说明,然而本发明实施例不限于这些已揭示的实施例,基于上述实施例本领域技术人员可以知晓,可以组合上述不同实施例中的代码审核手段得到本发明更多的实施例,这些实施例也在本发明实施例的保护范围之内。

Claims (17)

  1. 代码审计方法,其特征在于,包括:
    客户端(30)从服务器(40)处接收服务器(40)所生成的密钥对中的公钥(61);
    所述客户端(30)使用所述公钥(61)加密待审计的代码包文件(20)以得到加密后待审计的代码包文件(20’);
    所述客户端(30)将加密后待审计的代码包文件(20’)进行分割,得到第一部分代码包文件20’a)和第二部分代码包文件20’b);
    所述客户端(30)将所述第一部分代码包文件(20’a)发送至所述服务器(40);
    所述客户端(30)将所述第二部分代码包文件(20’b)存储在所述客户端(30)的一个第一目录(71)中;
    所述客户端(30)接受所述服务器(40)的虚拟机(90)挂载所述第一目录(71)的请求。
  2. 如权利要求1所述的方法,其特征在于,
    在所述客户端(30)接受所述服务器(40)的虚拟机(90)挂载所述第一目录(71)的请求之后,还包括:所述客户端(30)获取所述虚拟机(90)存放到所挂载的所述第一目录(71)中的审计报告(50);或者
    所述方法还包括:所述客户端(30)接受所述服务器(40)的虚拟机(90)挂载所述客户端(30)的一个第二目录(72)的请求,以及所述客户端(30)获取所述虚拟机(90)存放到所挂载的所述第二目录(72)中的审计报告(50)。
  3. 代码审计方法,其特征在于,包括:
    服务器(40)生成一个密钥对,其中,所述密钥对包括一个公钥(61)和一个私钥(62);
    所述服务器(40)将所述公钥(61)发送至客户端(30);
    所述服务器(40)生成一个虚拟机(90);
    所述虚拟机(90)从所述客户端(30)处接收第一部分代码包文件(20’a),其中,所述第一部分代码包文件(20’a)是所述客户端(30)使用所述公钥(61)对待审计的代码包文件(20)进行加密并分割后得到的;
    所述虚拟机(90)挂载所述客户端(30)的一个第一目录(71),并从所述第一目录(71)中获取第二部分代码包文件(20’b),其中,所述第二部分代码包文件(20’b)是所述客户端(30)使用所述公钥(61)对待审计的代码包文件(20)进行加密并分割后得到的、除所述第一部分代码包文件(20’a)之外的代码包文件;
    所述虚拟机(90)使用所述私钥(62)解密合并后的所述第一部分代码包文件(20’a)和所述第二部分代码(20’b)包文件得到所述待审计的代码包文件(20);
    所述虚拟机(90)对所述待审计的代码包文件(20)进行审计并得到审计报告(50)。
  4. 如权利要求3所述的方法,其特征在于,
    在所述虚拟机(90)对所述待审计的代码包文件(20)进行审计并得到审计报告(50)之后,还包括:所述虚拟机(90)将所述审计报告(50)存放到所挂载的所述客户端(30)的所述第一目录(71)中;或者
    所述方法还包括:所述虚拟机(90)挂载所述客户端(30)的一个第二目录(72),以及所述虚拟机(90)将所述审计报告(50)存放到所挂载的所述第二目录(72)中。
  5. 如权利要求4所述的方法,其特征在于,
    在所述虚拟机(90)挂载所述审计报告(50)到所述客户端(30)的所述第一目录(71)中之后,还包括:
    所述虚拟机(90)卸载所述第一目录(71);
    所述服务器(30)删除所述虚拟机(90);
    在所述虚拟机(90)挂载所述审计报告(50)到所述客户端(30)的所述第二目录(72)中之后,还包括:
    所述虚拟机(90)卸载所述第一目录(71)和所述第二目录(72);
    所述服务器(30)删除所述虚拟机(90)。
  6. 如权利要求1~5任一项所述的审计方法,其特征在于,所述第二部分代码包文件(20’b)的文件大小远小于所述第一部分代码包文件(20’a)。
  7. 用于代码审计的客户端(30),其特征在于,包括:
    一个通信模块(301),被配置为从服务器(40)处接收服务器(40)所生成的密钥对中的公钥(61);
    一个加密模块(302),被配置为使用所述公钥(61)加密待审计的代码(20)以得到加密后的待审计的代码包文件(20’);
    一个分割模块(303),被配置为将加密后的待审计的代码(20’)进行分割,得到第一部分代 码包文件(20’a)和第二部分代码包文件(20’b);
    所述通信模块(301),还被配置为将所述第一部分代码包文件(20’a)发送至所述服务器(40);一个目录管理模块(304),被配置为
    将所述第二部分代码包文件(20’b)存储在所述客户端(30)的一个第一目录(71)中,以及
    接受所述服务器(40)的虚拟机(90)挂载所述第一目录(71)的请求。
  8. 如权利要求7所述的客户端(30),其特征在于,所述目录管理模块(304)还被配置为:
    在接受所述服务器(40)的虚拟机(90)挂载所述第一目录(71)的请求之后,获取所述虚拟机(90)存放到所挂载的所述第一目录(71)中的审计报告(50);或者
    接受所述服务器(40)的虚拟机(90)挂载所述客户端(30)的一个第二目录(72)的请求,以及获取所述虚拟机(90)存放到所挂载的所述第二目录(72)中的审计报告(50)。
  9. 如权利要求7或8所述的客户端(30),其特征在于,所述第二部分代码包文件(20’b)的文件大小远小于所述第一部分代码包文件(20’a)。
  10. 用于代码审计的服务器(40),其特征在于,包括:
    一个密钥生成模块(401),被配置为生成一个密钥对,其中,所述密钥对包括一个公钥(61)和一个私钥(62);
    一个通信模块(402),被配置为将所述公钥(61)发送至客户端(30);
    一个虚拟机管理模块(403),被配置为:生成一个虚拟机(90),并配置所述虚拟机(90)执行如下操作:
    从所述客户端(30)处接收第一部分代码包文件(20’a),其中,所述第一部分代码包文件(20’a)是所述客户端(30)使用所述公钥(61)对待审计的代码包文件(20)进行加密并分割后得到的;
    挂载所述客户端(30)的一个第一目录(71),并从所述第一目录(71)中获取第二部分代码包文件(20’b),其中,所述第二部分代码包文件(20’b)是所述客户端(30)使用所述公钥(61)对待审计的代码包文件(20)进行加密并分割后得到的、除所述第一部分代码包文件(20’a)之外的代码包文件;
    使用所述密钥对中的私钥(62)解密合并后的所述第一部分代码包文件(20’a)和所述第二部分代码包文件(20’b)得到所述待审计的代码包文件(20);
    对所述待审计的代码包文件(20)进行审计并得到审计报告(50)。
  11. 如权利要求10所述的服务器(40),其特征在于,所述虚拟机管理模块(403)还被配置为:
    配置所述虚拟机(90)在对所述待审计的代码包文件(20)进行审计并得到审计报告(50)之后,将所述审计报告(50)存放到所挂载的所述客户端(30)的所述第一目录(71)中;或者
    配置所述虚拟机(90)挂载所述客户端(30)的一个第二目录(72),以及将所述审计报告(50)存放到所挂载的所述第二目录(72)中。
  12. 如权利要求11所述的服务器(40),其特征在于,所述虚拟机管理模块(403)还被配置为:
    配置所述虚拟机(90)在将所述审计报告(50)存放到所挂载的所述客户端(30)的所述第一目录(71)中之后,
    卸载所述第一目录(71);
    所述服务器(30)删除所述虚拟机(90);
    配置所述虚拟机(90)在将所述审计报告(50)存放到所挂载的所述客户端(30)的所述第二目录(72)中之后,
    卸载所述第一目录(71)和所述第二目录(72);
    删除所述虚拟机(90)。
  13. 如权利要求10~12任一项所述的服务器(40),其特征在于,所述第二部分代码包文件(20’b)的文件大小远小于所述第一部分代码包文件(20’a)。
  14. 用于代码审计的客户端(30),其特征在于,包括:
    至少一个存储器(305),用于存放计算机可读代码;
    至少一个处理器(306),用于执行所述至少一个存储器(305)存放的所述计算机可读代码,执行如权利要求1或2所述的方法。
  15. 用于代码审计的服务器(40),其特征在于,包括:
    至少一个存储器(404),用于存放计算机可读代码;
    至少一个处理器(405),用于执行所述至少一个存储器(404)存放的所述计算机可读代码,执行如权利要求3~6任一项所述的方法。
  16. 计算机可读介质,其特征在于,所述计算机可读介质存储有计算机可读代码,当所述计算机可读代码被至少一个处理器执行时,执行如权利要求1~6任一项所述的方法。
  17. 如权利要求1~16任一项所述的方法或装置,其特征在于,所述虚拟机(90)具有如下性质中的至少一个:
    所述虚拟机(90)不对外开放除挂载所述第一目录(71)和所述第二目录(72)所需端口之外的任何端口;
    所述虚拟机(90)的操作系统的密码是随机生成的。
    所述虚拟机(90)的文件系统被加密。
PCT/CN2019/079288 2019-03-22 2019-03-22 代码审计方法、装置,以及计算机可读介质 WO2020191529A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/079288 WO2020191529A1 (zh) 2019-03-22 2019-03-22 代码审计方法、装置,以及计算机可读介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/079288 WO2020191529A1 (zh) 2019-03-22 2019-03-22 代码审计方法、装置,以及计算机可读介质

Publications (1)

Publication Number Publication Date
WO2020191529A1 true WO2020191529A1 (zh) 2020-10-01

Family

ID=72610385

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/079288 WO2020191529A1 (zh) 2019-03-22 2019-03-22 代码审计方法、装置,以及计算机可读介质

Country Status (1)

Country Link
WO (1) WO2020191529A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546822A (zh) * 2012-02-17 2012-07-04 潘燕辉 一种确保文件不被盗取的网盘利用方法
CN103902922A (zh) * 2013-10-24 2014-07-02 哈尔滨安天科技股份有限公司 一种防止文件盗取的方法及系统
CN105027498A (zh) * 2013-06-11 2015-11-04 章寅生 一种通过远程分隔和组装数据文件实现安全存储的方法及其系统和装置
CN105760772A (zh) * 2015-01-06 2016-07-13 三星电子株式会社 用于管理数据的方法和电子设备
CN106022158A (zh) * 2016-05-09 2016-10-12 福建南威软件有限公司 一种文件资料的外带管理系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546822A (zh) * 2012-02-17 2012-07-04 潘燕辉 一种确保文件不被盗取的网盘利用方法
CN105027498A (zh) * 2013-06-11 2015-11-04 章寅生 一种通过远程分隔和组装数据文件实现安全存储的方法及其系统和装置
CN103902922A (zh) * 2013-10-24 2014-07-02 哈尔滨安天科技股份有限公司 一种防止文件盗取的方法及系统
CN105760772A (zh) * 2015-01-06 2016-07-13 三星电子株式会社 用于管理数据的方法和电子设备
CN106022158A (zh) * 2016-05-09 2016-10-12 福建南威软件有限公司 一种文件资料的外带管理系统

Similar Documents

Publication Publication Date Title
US9735962B1 (en) Three layer key wrapping for securing encryption keys in a data storage system
US8687814B2 (en) Securing encrypted virtual hard disks
WO2019218919A1 (zh) 区块链场景下的私钥管理方法、装置及系统
US10255450B2 (en) Customer load of field programmable gate arrays
US11716206B2 (en) Certificate based security using post quantum cryptography
TW201642135A (zh) 文件檢測方法、裝置及系統
US10255089B2 (en) Self-deleting virtual machines
US20220029820A1 (en) Validated payload execution
US20190036713A1 (en) Methods for facilitating secure cloud compute environments and devices thereof
CN104618096A (zh) 保护密钥授权数据的方法、设备和tpm密钥管理中心
CN112804217B (zh) 一种基于区块链技术的存证方法和装置
US11075753B2 (en) System and method for cryptographic key fragments management
AU2018391625A1 (en) Re-encrypting data on a hash chain
CN111404892B (zh) 数据监管方法、装置和服务器
US9607176B2 (en) Secure copy and paste of mobile app data
CN112182518A (zh) 一种软件部署方法和装置
WO2020191529A1 (zh) 代码审计方法、装置,以及计算机可读介质
CN111831978A (zh) 一种对配置文件进行保护的方法及装置
CN114615087B (zh) 数据共享方法、装置、设备及介质
CN113574837A (zh) 跟踪客户端设备上的图像发送者
US20190147150A1 (en) Digital certificate containing multimedia content
US11513913B2 (en) Method for storage management, electronic device, and computer program product
US11683182B2 (en) Message embedment in random values
US11232219B1 (en) Protection of electronic designs
US20210200890A1 (en) Client-side encryption and processing of telemetry data

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: 19922052

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19922052

Country of ref document: EP

Kind code of ref document: A1