CN113342467B - Virtual machine snapshot saving, reading methods, devices and related equipment - Google Patents
Virtual machine snapshot saving, reading methods, devices and related equipment Download PDFInfo
- Publication number
- CN113342467B CN113342467B CN202110694868.6A CN202110694868A CN113342467B CN 113342467 B CN113342467 B CN 113342467B CN 202110694868 A CN202110694868 A CN 202110694868A CN 113342467 B CN113342467 B CN 113342467B
- Authority
- CN
- China
- Prior art keywords
- key
- virtual machine
- information
- snapshot
- tek
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 121
- 230000008569 process Effects 0.000 claims description 50
- 230000005540 biological transmission Effects 0.000 claims description 11
- 238000011084 recovery Methods 0.000 claims description 7
- 238000004321 preservation Methods 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 20
- 238000005516 engineering process Methods 0.000 description 18
- 230000006870 function Effects 0.000 description 11
- 238000013507 mapping Methods 0.000 description 6
- 238000009795 derivation Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 3
- 230000006872 improvement Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000001568 sexual effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/128—Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/572—Secure firmware programming, e.g. of basic input output system [BIOS]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0667—Virtualisation aspects at data level, e.g. file, record or object virtualisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Storage Device Security (AREA)
Abstract
本申请实施例提供一种虚拟机快照保存、读取方法、装置及相关设备,其中虚拟机快照保存方法包括:生成TEK,以及生成KEK;基于KEK至少对TEK进行加密,得到密钥加密信息;以及,基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容;将所述密钥加密信息和加密快照内容保存在目标虚拟机的虚拟机快照中,所述虚拟机快照写入目标虚拟机的虚拟机镜像文件中。本申请实施例可提升虚拟机快照的安全性。
Embodiments of the present application provide a virtual machine snapshot saving and reading method, device, and related equipment. The virtual machine snapshot saving method includes: generating TEK, and generating KEK; encrypting at least the TEK based on the KEK to obtain key encryption information; And, encrypt the snapshot content of the target virtual machine based on TEK to obtain the encrypted snapshot content of the target virtual machine; save the key encryption information and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine, and the virtual machine snapshot Write to the virtual machine image file of the target virtual machine. The embodiments of this application can improve the security of virtual machine snapshots.
Description
技术领域Technical field
本申请实施例涉及虚拟机技术领域,具体涉及一种虚拟机快照保存、读取方法、装置及相关设备。The embodiments of the present application relate to the field of virtual machine technology, and specifically relate to a method, device and related equipment for saving and reading virtual machine snapshots.
背景技术Background technique
通过虚拟化技术(Virtualization),物理主机可虚拟化出多台虚拟机(VirtualMachine,VM),从而高效利用物理主机的硬件资源。虚拟化出的虚拟机可在物理内存中分配虚拟机内存,每台虚拟机的虚拟机内存主要用于任务消耗及支持虚拟化。Through virtualization technology (Virtualization), a physical host can virtualize multiple virtual machines (VirtualMachine, VM), thereby efficiently utilizing the hardware resources of the physical host. The virtualized virtual machine can allocate virtual machine memory in physical memory. The virtual machine memory of each virtual machine is mainly used for task consumption and support for virtualization.
虚拟机在某一时间点的状态可通过虚拟机快照保存,以用于虚拟机数据的备份和恢复。因此在保存虚拟机快照时,需要提供虚拟机快照的安全保护方案,以提升虚拟机快照的安全性。The state of a virtual machine at a certain point in time can be saved through virtual machine snapshots for backup and recovery of virtual machine data. Therefore, when saving a virtual machine snapshot, a security protection solution for the virtual machine snapshot needs to be provided to improve the security of the virtual machine snapshot.
发明内容Contents of the invention
有鉴于此,本申请实施例提供一种虚拟机快照保存、读取方法、装置及相关设备,以提升虚拟机快照的安全性。In view of this, embodiments of the present application provide a method, device, and related equipment for saving and reading virtual machine snapshots to improve the security of virtual machine snapshots.
为实现上述目的,本申请实施例提供如下技术方案。To achieve the above objectives, embodiments of the present application provide the following technical solutions.
第一方面,本申请实施例提供一种虚拟机快照保存方法,应用于安全处理器,所述方法包括:In the first aspect, embodiments of the present application provide a method for saving a virtual machine snapshot, which is applied to a security processor. The method includes:
生成TEK,以及生成KEK;Generate TEK, and generate KEK;
基于KEK至少对TEK进行加密,得到密钥加密信息;以及,基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容;Encrypt at least TEK based on KEK to obtain key encryption information; and encrypt snapshot content of the target virtual machine based on TEK to obtain encrypted snapshot content of the target virtual machine;
将所述密钥加密信息和加密快照内容保存在目标虚拟机的虚拟机快照中,所述虚拟机快照写入目标虚拟机的虚拟机镜像文件中。The key encryption information and the encrypted snapshot content are saved in the virtual machine snapshot of the target virtual machine, and the virtual machine snapshot is written into the virtual machine image file of the target virtual machine.
第二方面,本申请实施例提供一种虚拟机快照读取方法,应用于安全处理器,所述方法包括:In the second aspect, embodiments of the present application provide a method for reading a virtual machine snapshot, which is applied to a security processor. The method includes:
获取目标虚拟机的虚拟机快照,所述虚拟机快照包括加密快照内容和密钥加密信息;Obtain a virtual machine snapshot of the target virtual machine, where the virtual machine snapshot includes encrypted snapshot content and key encryption information;
恢复KEK;Restore KEK;
基于KEK对所述密钥加密信息进行解密,得到TEK;Decrypt the key encryption information based on KEK to obtain TEK;
基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容。Decrypt the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine.
第三方面,本申请实施例提供一种虚拟机快照保存装置,应用于安全处理器,所述装置包括:In a third aspect, embodiments of the present application provide a device for saving virtual machine snapshots, which is applied to a security processor. The device includes:
密钥生成模块,用于生成TEK,以及生成KEK;Key generation module, used to generate TEK and KEK;
加密模块,用于基于KEK至少对TEK进行加密,得到密钥加密信息;以及,基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容;The encryption module is used to encrypt at least TEK based on KEK to obtain key encryption information; and to encrypt the snapshot content of the target virtual machine based on TEK to obtain the encrypted snapshot content of the target virtual machine;
保存模块,用于将所述密钥加密信息和加密快照内容保存在目标虚拟机的虚拟机快照中,所述虚拟机快照写入目标虚拟机的虚拟机镜像文件中。A saving module, configured to save the key encryption information and the encrypted snapshot content in a virtual machine snapshot of the target virtual machine, and write the virtual machine snapshot into the virtual machine image file of the target virtual machine.
第四方面,本申请实施例提供一种虚拟机快照读取装置,应用于安全处理器,所述装置包括:In the fourth aspect, embodiments of the present application provide a virtual machine snapshot reading device, which is applied to a security processor. The device includes:
获取模块,用于获取目标虚拟机的虚拟机快照,所述虚拟机快照包括加密快照内容和密钥加密信息;An acquisition module, configured to acquire a virtual machine snapshot of the target virtual machine, where the virtual machine snapshot includes encrypted snapshot content and key encryption information;
恢复模块,用于恢复KEK;Recovery module, used to recover KEK;
密钥解密模块,用于基于KEK对所述密钥加密信息进行解密,得到TEK;A key decryption module, used to decrypt the key encryption information based on KEK to obtain TEK;
快照解密模块,用于基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容。A snapshot decryption module is used to decrypt the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine.
第五方面,本申请实施例提供一种安全处理器,所述安全处理器被配置为执行如第一方面所述的虚拟机快照保存方法,以及如第二方面所述的虚拟机快照读取方法。In the fifth aspect, embodiments of the present application provide a security processor configured to perform the virtual machine snapshot saving method as described in the first aspect, and the virtual machine snapshot reading as described in the second aspect. method.
第六方面,本申请实施例提供一种电子设备,包括如第五方面所述的安全处理器。In a sixth aspect, embodiments of the present application provide an electronic device, including the security processor described in the fifth aspect.
本申请实施例提供的虚拟机快照保存方法,可由安全处理器生成用于加密快照内容的TEK,以及用于加密TEK的KEK;从而,在需要保存目标虚拟机的虚拟机快照时,安全处理器可基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容。为实现TEK的加密保护,安全处理器还可基于KEK至少对TEK进行加密,得到密钥加密信息。进而,加密快照内容和密钥加密信息可保存在目标虚拟机的虚拟机快照中,且虚拟机快照可写入目标虚拟机的虚拟机镜像文件中,以实现保存目标虚拟机的虚拟机快照。可见,本申请实施例提供的虚拟机快照保存方法,可在虚拟机快照中以密文形式保存快照内容,减少了通过虚拟机的快照内容来窃取虚拟机相关的配置和数据的情况,有效降低了虚拟机数据被篡改的情况。同时,通过将至少加密TEK所得到的加密密钥信息保存在虚拟机快照中,可实现TEK的安全保护,并便于后续读取虚拟机快照时,能够通过解密加密密钥信息来恢复TEK,以实现加密快照内容的解密和读取。The virtual machine snapshot saving method provided by the embodiment of the present application can use the security processor to generate the TEK used to encrypt the snapshot content, and the KEK used to encrypt the TEK; thus, when it is necessary to save the virtual machine snapshot of the target virtual machine, the security processor The snapshot content of the target virtual machine can be encrypted based on TEK to obtain the encrypted snapshot content of the target virtual machine. In order to realize the encryption protection of TEK, the security processor can also encrypt at least TEK based on KEK to obtain key encryption information. Furthermore, the encrypted snapshot content and key encryption information can be saved in the virtual machine snapshot of the target virtual machine, and the virtual machine snapshot can be written into the virtual machine image file of the target virtual machine, so as to save the virtual machine snapshot of the target virtual machine. It can be seen that the virtual machine snapshot saving method provided by the embodiment of the present application can save the snapshot content in the form of ciphertext in the virtual machine snapshot, reducing the situation of stealing virtual machine-related configuration and data through the virtual machine snapshot content, and effectively reducing the number of virtual machine snapshots. The virtual machine data has been tampered with. At the same time, by saving at least the encryption key information obtained by encrypting the TEK in the virtual machine snapshot, the security protection of the TEK can be achieved, and when the virtual machine snapshot is subsequently read, the TEK can be restored by decrypting the encryption key information, so as to Implement decryption and reading of encrypted snapshot content.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present application or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only This is an embodiment of the present application. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without exerting creative efforts.
图1a为虚拟化技术的系统架构示意图。Figure 1a is a schematic diagram of the system architecture of virtualization technology.
图1b为安全虚拟化技术的系统架构示意图。Figure 1b is a schematic diagram of the system architecture of secure virtualization technology.
图2a为本申请实施例提供的虚拟机快照保存方法的流程图。Figure 2a is a flow chart of a virtual machine snapshot saving method provided by an embodiment of the present application.
图2b为本申请实施例提供的虚拟机快照的数据结构的示意图。Figure 2b is a schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图3a为本申请实施例提供的生成KEK的流程图。Figure 3a is a flow chart for generating KEK provided by the embodiment of the present application.
图3b为本申请实施例提供的虚拟机快照的数据结构的另一示意图。Figure 3b is another schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图3c为本申请实施例提供的虚拟机快照的数据结构的再一示意图。Figure 3c is another schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图3d为本申请实施例对密钥加密信息进行完整性保护的流程图。Figure 3d is a flow chart for integrity protection of key encryption information according to an embodiment of the present application.
图3e为本申请实施例提供的虚拟机快照的数据结构的又一示意图。Figure 3e is another schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图4a为本申请实施例对目标虚拟机的策略信息进行完整性保护的流程图。Figure 4a is a flow chart for integrity protection of policy information of a target virtual machine according to an embodiment of the present application.
图4b为本申请实施例提供的虚拟机快照的数据结构的又另一示意图。Figure 4b is another schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图4c为本申请实施例提供的虚拟机快照的数据结构的又再一示意图。Figure 4c is yet another schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application.
图5为本申请实施例提供的虚拟机快照保存方法的另一流程图。Figure 5 is another flowchart of a virtual machine snapshot saving method provided by an embodiment of the present application.
图6a为本申请实施例提供的虚拟机快照读取方法的流程图。Figure 6a is a flow chart of a virtual machine snapshot reading method provided by an embodiment of the present application.
图6b为本申请实施例提供的虚拟机快照读取方法的另一流程图。Figure 6b is another flow chart of a virtual machine snapshot reading method provided by an embodiment of the present application.
图7为本申请实施例提供的虚拟机快照保存装置的框图。Figure 7 is a block diagram of a virtual machine snapshot saving device provided by an embodiment of the present application.
图8为本申请实施例提供的虚拟机快照读取装置的框图。Figure 8 is a block diagram of a virtual machine snapshot reading device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
图1a示例性的示出了虚拟化技术的系统架构示意图,如图1a所示,该系统架构可以包括:CPU(Central Processing Unit,中央处理器)110、内存控制器120、物理内存130和存储介质140(存储介质例如磁盘)。Figure 1a exemplarily shows a schematic diagram of the system architecture of virtualization technology. As shown in Figure 1a, the system architecture may include: CPU (Central Processing Unit, central processing unit) 110, memory controller 120, physical memory 130 and storage Media 140 (storage media such as disks).
其中,CPU110可通过软件形式配置虚拟机平台111(例如虚拟机管理器),并通过虚拟化技术虚拟化出多台虚拟机112。该多台虚拟机可由虚拟机平台进行管理,例如由虚拟机平台管理虚拟机在物理内存130中的虚拟机内存。The CPU 110 can configure the virtual machine platform 111 (such as a virtual machine manager) through software, and virtualize multiple virtual machines 112 through virtualization technology. The multiple virtual machines can be managed by a virtual machine platform. For example, the virtual machine platform manages the virtual machine memory of the virtual machines in the physical memory 130 .
内存控制器120是控制物理内存130,并且使物理内存130与CPU110之间交换数据的硬件。物理内存130的部分或全部空间可作为为虚拟机分配的虚拟机内存。The memory controller 120 is hardware that controls the physical memory 130 and enables data exchange between the physical memory 130 and the CPU 110 . Some or all of the physical memory 130 may serve as virtual machine memory allocated for the virtual machine.
存储介质140可存储虚拟机的虚拟机快照,以保存虚拟机120在某一时间点的状态。在一些实施例中,虚拟机快照主要包括快照内容,快照内容可以描述虚拟机在某一时间点的状态;并且,虚拟机快照可包含在存储介质140的虚拟机镜像文件中,即,虚拟机快照为虚拟机镜像文件中的快照部分。The storage medium 140 may store a virtual machine snapshot of the virtual machine to save the state of the virtual machine 120 at a certain point in time. In some embodiments, the virtual machine snapshot mainly includes snapshot content, which can describe the state of the virtual machine at a certain point in time; and the virtual machine snapshot can be included in the virtual machine image file of the storage medium 140, that is, the virtual machine A snapshot is the snapshot part of a virtual machine image file.
在保存虚拟机快照时,主要是将虚拟机快照的快照内容保存到虚拟机镜像文件中实现;而在读取虚拟机快照时,主要是从虚拟机镜像文件中读取虚拟机快照的快照内容。在一些实施例中,存储介质140可以存储虚拟机镜像文件的镜像文件头(Image Header),虚拟机平台111可通过解析镜像文件头获得快照文件头(snapshot header),进而通过解析快照头(snapshot header),获得虚拟机快照。When saving a virtual machine snapshot, the snapshot content of the virtual machine snapshot is mainly saved to the virtual machine image file; when reading the virtual machine snapshot, the snapshot content of the virtual machine snapshot is mainly read from the virtual machine image file. . In some embodiments, the storage medium 140 can store the image header (Image Header) of the virtual machine image file. The virtual machine platform 111 can obtain the snapshot header (snapshot header) by parsing the image file header, and then parsing the snapshot header (snapshot header). header) to obtain a virtual machine snapshot.
在一些实施例中,镜像文件头可保存在虚拟机镜像文件的开头。在另一些实施例中,镜像文件头也可不保存在虚拟机镜像文件的开头,而是将镜像文件头与虚拟机镜像文件分开存储。在镜像文件头与虚拟机镜像文件分开存储的情况下,可使用数据库文件、配置文件等文件记录镜像文件头与虚拟机镜像文件之间的映射关系或者对应关系,以便在读取虚拟机快照时,能够通过该文件记录的映射关系或者对应关系寻找到虚拟机镜像文件的镜像文件头。也就是说,在可能的实现中,可通过从虚拟机镜像文件的开头或者其他存储位置读取镜像文件头(在镜像文件头与虚拟机镜像文件分开存储的情况下),获得镜像文件头所对应的虚拟机镜像文件的格式、版本、大小、磁盘扇区映射信息、磁盘扇区引用信息、虚拟机快照数量、快照头偏移量等信息。In some embodiments, the image file header may be saved at the beginning of the virtual machine image file. In other embodiments, the image file header may not be stored at the beginning of the virtual machine image file, but the image file header may be stored separately from the virtual machine image file. When the image file header and the virtual machine image file are stored separately, you can use database files, configuration files and other files to record the mapping relationship or correspondence between the image file header and the virtual machine image file, so that when reading the virtual machine snapshot , the image file header of the virtual machine image file can be found through the mapping relationship or correspondence relationship recorded in the file. That is to say, in a possible implementation, the image file header can be obtained by reading the image file header from the beginning of the virtual machine image file or other storage locations (in the case where the image file header is stored separately from the virtual machine image file). The format, version, size, disk sector mapping information, disk sector reference information, number of virtual machine snapshots, snapshot header offset and other information of the corresponding virtual machine image file.
可以看出,虚拟机平台111通过对镜像文件头的解析,可获取快照头偏移量;从而根据快照头偏移量在存储介质中找到快照头;进而基于快照头的内容,进一步获取到虚拟机快照。其中,快照头可对应虚拟机快照格式、大小、版本、磁盘扇区映射信息、磁盘扇区引用信息、虚拟机状态信息等内容。It can be seen that the virtual machine platform 111 can obtain the snapshot header offset by parsing the image file header; thereby finding the snapshot header in the storage medium based on the snapshot header offset; and then further obtaining the virtual file based on the content of the snapshot header. Machine snapshot. Among them, the snapshot header can correspond to the virtual machine snapshot format, size, version, disk sector mapping information, disk sector reference information, virtual machine status information, etc.
需要说明的是,与镜像文件头和虚拟机镜像文件可分开存储同理,快照头偏移量等内容也可与镜像文件头分开存储,并通过数据库文件、配置文件等文件记录快照头偏移量与镜像文件头的映射关系或者对应关系。类似的,快照头对应的内容、虚拟机快照对应的内容等也可与快照头、虚拟机快照分开存储,并通过类似的文件记录映射关系或者对应关系。It should be noted that in the same way that the image file header and the virtual machine image file can be stored separately, the snapshot header offset and other contents can also be stored separately from the image file header, and the snapshot header offset can be recorded through database files, configuration files and other files. The mapping relationship or corresponding relationship between the quantity and the image file header. Similarly, the content corresponding to the snapshot header, the content corresponding to the virtual machine snapshot, etc. can also be stored separately from the snapshot header and virtual machine snapshot, and the mapping relationship or corresponding relationship can be recorded through similar files.
在另外的可能实现中,虚拟机快照也可存储在物理内存130中,而不限于存储在存储介质140中。例如,出于加快读写速度的需求,虚拟机镜像文件可存储在物理内存130中。In another possible implementation, the virtual machine snapshot may also be stored in the physical memory 130 and is not limited to being stored in the storage medium 140 . For example, to speed up reading and writing, the virtual machine image file may be stored in the physical memory 130 .
由于虚拟机快照保存了虚拟机在某一时间点的状态(例如虚拟机在某一时间点的硬件状态、软件状态、操作系统状态、文件系统状态、内存状态等),因此如果虚拟机快照是以明文形式进行保存,则攻击者(例如物理主机中的恶意软件)极易通过虚拟机快照获取到虚拟机相关的配置和数据,从而对虚拟机数据进行监视、复制、窃取或者篡改。可见,虚拟机快照以明文形式进行保存存在极大的安全隐患,需要提供虚拟机快照的安全保护方案,以对虚拟机快照进行加密保存,提升虚拟机快照的安全性。Since a virtual machine snapshot saves the state of the virtual machine at a certain point in time (such as the virtual machine's hardware status, software status, operating system status, file system status, memory status, etc.) at a certain point in time, if the virtual machine snapshot is If stored in clear text, attackers (such as malware in the physical host) can easily obtain the configuration and data related to the virtual machine through the virtual machine snapshot, thereby monitoring, copying, stealing or tampering with the virtual machine data. It can be seen that saving virtual machine snapshots in plain text has great security risks. It is necessary to provide a security protection solution for virtual machine snapshots to encrypt and save virtual machine snapshots to improve the security of virtual machine snapshots.
在一些实施例中,安全虚拟化技术可用于对虚拟机内存中的虚拟机数据进行安全保护。在安全虚拟化技术的基础上,本申请实施例可通过技术完善,来实现虚拟机快照的加密保存。图1b示例性的示出了安全虚拟化技术的系统架构示意图。结合图1a和图1b所示,图1b所示系统架构相比于图1a所示系统架构还可以包括:安全处理器(Platform SecureProcessor,PSP)150,安全处理器150是安全虚拟化技术专门设置的负责数据安全的处理器。In some embodiments, secure virtualization technology can be used to securely protect virtual machine data in the virtual machine memory. On the basis of secure virtualization technology, embodiments of the present application can achieve encrypted storage of virtual machine snapshots through technical improvements. Figure 1b exemplarily shows a schematic diagram of the system architecture of the secure virtualization technology. Combined with what is shown in Figure 1a and Figure 1b, compared with the system architecture shown in Figure 1a, the system architecture shown in Figure 1b can also include: a security processor (Platform SecureProcessor, PSP) 150. The security processor 150 is specially configured for security virtualization technology. The processor responsible for data security.
如图1b所示,虚拟机平台111可配置与安全处理器150相通信的API(ApplicationProgramming Interface,应用程序接口)接口,实现虚拟机平台111与安全处理器150的数据交互。同时,内存控制器120可配置加解密引擎121,加解密引擎121可存储各虚拟机对应的VEK(VM Encryption Key,虚拟机加密密钥),以对各虚拟机在虚拟机内存中的虚拟机数据进行加解密,实现对虚拟机数据的安全保护。例如,当虚拟机的虚拟机数据需要读取到内存中时,加解密引擎121可使用对应的VEK进行加密,而虚拟机的虚拟机数据需从内存送到CPU进行处理时,加解密引擎121可使用对应的VEK进行解密。As shown in Figure 1b, the virtual machine platform 111 can configure an API (Application Programming Interface, application program interface) interface to communicate with the security processor 150 to realize data interaction between the virtual machine platform 111 and the security processor 150. At the same time, the memory controller 120 can be configured with an encryption and decryption engine 121. The encryption and decryption engine 121 can store the VEK (VM Encryption Key, virtual machine encryption key) corresponding to each virtual machine to store the virtual machine encryption key of each virtual machine in the virtual machine memory. Data is encrypted and decrypted to achieve security protection of virtual machine data. For example, when the virtual machine data of the virtual machine needs to be read into the memory, the encryption and decryption engine 121 can use the corresponding VEK to encrypt, and when the virtual machine data of the virtual machine needs to be sent from the memory to the CPU for processing, the encryption and decryption engine 121 The corresponding VEK can be used for decryption.
在安全虚拟化技术中,不同的虚拟机可对应不同的VEK,并且各个虚拟机对应的VEK可由安全处理器150进行分配和管理,并保存在加解密引擎121中。例如,可由运行在安全处理器150中的安全固件完成VEK的管理,以此来保证物理内存中的虚拟机数据被加密后只有虚拟机本身能够访问,虚拟机平台和其他虚拟机均无法访问。In secure virtualization technology, different virtual machines can correspond to different VEKs, and the VEKs corresponding to each virtual machine can be allocated and managed by the security processor 150 and stored in the encryption and decryption engine 121 . For example, the security firmware running in the security processor 150 can complete the management of VEK to ensure that after the virtual machine data in the physical memory is encrypted, only the virtual machine itself can access it, and neither the virtual machine platform nor other virtual machines can access it.
安全虚拟化技术是用于对虚拟机内存中的虚拟机数据进行安全保护的技术,目前并不适用于对虚拟机快照进行加密保护。基于此,本申请实施例在安全虚拟化技术的基础上,通过技术完善,以使得安全虚拟化技术支持对虚拟机快照进行加密保护。Secure virtualization technology is a technology used to securely protect virtual machine data in virtual machine memory. It is currently not suitable for encrypting and protecting virtual machine snapshots. Based on this, the embodiment of the present application is based on the secure virtualization technology and improves the technology, so that the secure virtualization technology supports encryption and protection of virtual machine snapshots.
作为一种可选实现,图2a示例性的示出了本申请实施例提供的虚拟机快照保存方法的可选流程图。在一些实施例中,该流程可由安全处理器(例如安全处理器中的安全固件)和虚拟机平台结合执行。如图2a所示,该流程可以包括如下步骤。As an optional implementation, FIG. 2a exemplarily shows an optional flow chart of the virtual machine snapshot saving method provided by the embodiment of the present application. In some embodiments, this process may be executed by a secure processor (eg, secure firmware in the secure processor) in conjunction with the virtual machine platform. As shown in Figure 2a, the process may include the following steps.
在步骤S210中,安全处理器生成TEK(Transport Encryption Key,传输加密密钥)。In step S210, the security processor generates a TEK (Transport Encryption Key).
TEK是本申请实施例用于对虚拟机的快照内容进行加密的加密密钥,其可对安全处理器与虚拟机使用者之间的数据传输进行加密保护,TEK可由安全处理器生成。需要说明的是,TEK并不等同于安全处理器为虚拟机分配的VEK。在一些实施例中,本申请实施例可利用TEK对多个虚拟机的快照内容分别进行加密,而虚拟机在内存的虚拟机数据是用虚拟机对应的VEK进行加密。TEK is an encryption key used in this embodiment of the present application to encrypt the snapshot content of a virtual machine. It can encrypt and protect data transmission between the security processor and the virtual machine user. The TEK can be generated by the security processor. It should be noted that TEK is not equivalent to the VEK allocated by the security processor to the virtual machine. In some embodiments, the embodiments of the present application can use TEK to encrypt the snapshot contents of multiple virtual machines respectively, and the virtual machine data in the memory of the virtual machine is encrypted using the VEK corresponding to the virtual machine.
在一些实施例中,安全处理器可通过硬件真随机数发生器生成TEK。硬件真随机数发生器是从物理过程而不是计算机程序生成随机数的设备。例如,安全处理器可基于硬件真随机数发生器生成的随机数,生成TEK。在一些可选实现上,TEK可以是SM4密钥的形式,例如,安全处理器可基于硬件真随机数发生器生成的随机数,生成SM4密钥,以得到TEK。In some embodiments, the security processor may generate the TEK via a hardware true random number generator. A hardware true random number generator is a device that generates random numbers from a physical process rather than a computer program. For example, the security processor can generate TEK based on random numbers generated by a hardware true random number generator. In some optional implementations, the TEK can be in the form of an SM4 key. For example, the security processor can generate an SM4 key based on the random number generated by the hardware true random number generator to obtain the TEK.
在步骤S211中,安全处理器生成KEK(Key Encryption Key,密钥加密密钥)。In step S211, the security processor generates a KEK (Key Encryption Key).
KEK是本申请实施例用于对密钥进行加密的密钥,以保障密钥的安全性,TEK可由安全处理器生成。在本申请实施例中,KEK可至少对步骤S210生成的TEK进行加密,以保障TEK的安全性。KEK is a key used to encrypt the key in this embodiment of the application to ensure the security of the key. The TEK can be generated by a security processor. In this embodiment of the present application, the KEK can at least encrypt the TEK generated in step S210 to ensure the security of the TEK.
在一些实施例中,安全处理器可至少基于密钥协商信息,生成KEK。密钥协商信息可以是安全处理器用于协商密钥的信息。In some embodiments, the security processor may generate a KEK based at least on the key agreement information. The key agreement information may be information used by the security processor to negotiate keys.
作为一种可选实现,步骤S210和步骤S211可以同步执行,两者可不分先后顺序。As an optional implementation, step S210 and step S211 can be executed simultaneously, and the two steps can be executed in no particular order.
在步骤S212中,安全处理器基于KEK至少对TEK进行加密,得到密钥加密信息(WRAP_TK)。In step S212, the security processor encrypts at least TEK based on KEK to obtain key encryption information (WRAP_TK).
在一些实施例中,安全处理器可直接基于KEK至少对TEK进行加密,得到密钥加密信息(WRAP_TK)。在另一些实施例中,安全处理器可基于KEK和硬件真随机数发生器生成的第一随机数(WARP_IV),至少对TEK进行加密,得到密钥加密信息(WRAP_TK)。可选的,第一随机数(WARP_IV)与生成TEK所使用的随机数不同。In some embodiments, the security processor may directly encrypt at least TEK based on KEK to obtain key encryption information (WRAP_TK). In other embodiments, the security processor may encrypt at least the TEK based on the KEK and the first random number (WARP_IV) generated by the hardware true random number generator to obtain the key encryption information (WRAP_TK). Optionally, the first random number (WARP_IV) is different from the random number used to generate TEK.
在步骤S213中,安全处理器基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容。In step S213, the security processor encrypts the snapshot content of the target virtual machine based on the TEK to obtain the encrypted snapshot content of the target virtual machine.
目标虚拟机可以认为是当前需要保存虚拟机快照的虚拟机。在一些实施例中,安全处理器可直接基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容。在另一些实施例中,安全处理器可基于TEK以及第一随机数(WARP_IV)对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容。在可选实现中,目标虚拟机的快照内容可由虚拟机平台传输给安全处理器。例如,虚拟机平台可确定目标虚拟机在某一时间点的状态,从而得到描述该状态的快照内容,将快照内容传输给安全处理器。The target virtual machine can be considered as the virtual machine that currently needs to save the virtual machine snapshot. In some embodiments, the security processor can directly encrypt the snapshot content of the target virtual machine based on TEK to obtain the encrypted snapshot content of the target virtual machine. In other embodiments, the security processor may encrypt the snapshot content of the target virtual machine based on the TEK and the first random number (WARP_IV) to obtain the encrypted snapshot content of the target virtual machine. In an optional implementation, the snapshot contents of the target virtual machine may be transmitted by the virtual machine platform to the security processor. For example, the virtual machine platform can determine the status of the target virtual machine at a certain point in time, thereby obtaining snapshot content describing the status, and transmit the snapshot content to the security processor.
在保存目标虚拟机的虚拟机快照时,安全处理器除利用TEK对目标虚拟机的快照内容进行加密,以得到目标虚拟机的加密快照内容外,安全处理器还提供TEK的安全保护。即,安全处理器还可利用KEK至少对TEK进行加密,以得到密钥加密信息。为便于后续说明,密钥加密信息可使用WRAP_TK指代。When saving the virtual machine snapshot of the target virtual machine, the security processor not only uses TEK to encrypt the snapshot content of the target virtual machine to obtain the encrypted snapshot content of the target virtual machine, but also provides TEK security protection. That is, the security processor can also use KEK to encrypt at least TEK to obtain key encryption information. For the convenience of subsequent explanation, the key encryption information can be referred to as WRAP_TK.
需要说明的是,在本申请实施例完成虚拟机快照的保存并销毁TEK后,由于硬件真随机数发生器的随机性,安全处理器通过硬件真随机数发生器并不一定能够重复生成与步骤S210中相同的TEK,因此为保障后续在读取目标虚拟机的虚拟机快照时,能对目标虚拟机的加密快照内容进行解密,本申请实施例可将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中;从而,后续安全处理器通过恢复KEK,可对虚拟机快照中的密钥加密信息(WRAP_TK)进行解密,得到加密快照内容时所使用的TEK,进而利用TEK实现对加密快照内容的解密。出于上述考虑,本申请实施例除基于TEK对目标虚拟机的快照内容进行加密外,还基于KEK至少对TEK进行加密,并在后续将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中。在进一步的一些实施例中,如果得到密钥加密信息(WRAP_TK)和/或得到加密快照内容时,结合使用了第一随机数(WARP_IV),则本申请实施例也可将第一随机数(WARP_IV)以明文的形式保存在虚拟机快照中。It should be noted that after the embodiment of this application completes saving the virtual machine snapshot and destroying the TEK, due to the randomness of the hardware true random number generator, the security processor may not be able to repeat the generation and steps through the hardware true random number generator. The same TEK in S210. Therefore, in order to ensure that the encrypted snapshot content of the target virtual machine can be decrypted when reading the virtual machine snapshot of the target virtual machine later, the embodiment of this application can combine the key encryption information (WRAP_TK) and the encrypted snapshot. The content is saved in the virtual machine snapshot of the target virtual machine; thus, the subsequent security processor can decrypt the key encryption information (WRAP_TK) in the virtual machine snapshot by restoring the KEK, and obtain the TEK used to encrypt the snapshot content, and then Use TEK to decrypt the contents of encrypted snapshots. For the above considerations, in addition to encrypting the snapshot content of the target virtual machine based on TEK, the embodiment of the present application also encrypts at least TEK based on KEK, and subsequently saves the key encryption information (WRAP_TK) and the encrypted snapshot content in the target. In the virtual machine snapshot of the virtual machine. In some further embodiments, if the first random number (WARP_IV) is used in combination when obtaining the key encryption information (WRAP_TK) and/or obtaining the encrypted snapshot content, then the embodiment of the present application may also use the first random number ( WARP_IV) is saved in clear text in the virtual machine snapshot.
在一些实施例中,在目标虚拟机需要保存虚拟机快照时,虚拟机平台可暂停运行中的目标虚拟机,然后才由安全处理器对目标虚拟机的快照内容进行加密,并在目标虚拟机的虚拟机快照保存后,由虚拟机平台恢复运行目标虚拟机。In some embodiments, when the target virtual machine needs to save a virtual machine snapshot, the virtual machine platform can pause the running target virtual machine, and then the security processor encrypts the snapshot content of the target virtual machine and stores it in the target virtual machine. After the virtual machine snapshot is saved, the virtual machine platform resumes running the target virtual machine.
作为一种可选实现,步骤S212和步骤S213可以同步执行,两者可不分先后顺序。As an optional implementation, step S212 and step S213 can be executed simultaneously, and the two steps can be executed in no particular order.
在步骤S214中,安全处理器至少将密钥加密信息(WRAP_TK)和加密快照内容传输给虚拟机平台。In step S214, the security processor transmits at least the key encryption information (WRAP_TK) and the encrypted snapshot content to the virtual machine platform.
在步骤S215中,虚拟机平台至少将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中。In step S215, the virtual machine platform saves at least the key encryption information (WRAP_TK) and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine.
安全处理器在得到密钥加密信息(WRAP_TK)和加密快照内容后,本申请实施例可将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中。在一些实施例中,安全处理器可将密钥加密信息(WRAP_TK)和加密快照内容传输给虚拟机平台,从而由虚拟机平台将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中。在进一步的一些实施例中,虚拟机平台可将目标虚拟机的虚拟机快照写入目标虚拟机的虚拟机镜像文件,以实现对虚拟机快照的保存。After the security processor obtains the key encryption information (WRAP_TK) and the encrypted snapshot content, embodiments of the present application may save the key encryption information (WRAP_TK) and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine. In some embodiments, the security processor may transmit the key encryption information (WRAP_TK) and the encrypted snapshot content to the virtual machine platform, so that the virtual machine platform saves the key encryption information (WRAP_TK) and the encrypted snapshot content in the target virtual machine. in the virtual machine snapshot. In some further embodiments, the virtual machine platform can write the virtual machine snapshot of the target virtual machine into the virtual machine image file of the target virtual machine to save the virtual machine snapshot.
当然,由虚拟机平台将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中仅是一种可选手段,在安全处理器支持物理内存、存储介质(例如磁盘)的数据读取的情况下,本申请实施例也可由安全处理器直接将密钥加密信息(WRAP_TK)和加密快照内容保存在目标虚拟机的虚拟机快照中,而不必由虚拟机平台进行保存;进而,本申请实施例也可由安全处理器将虚拟机快照写入虚拟机镜像文件,实现对虚拟机快照的保存。Of course, it is only an optional method for the virtual machine platform to save the key encryption information (WRAP_TK) and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine. The security processor supports physical memory and storage media (such as disks). In the case of data reading, in the embodiment of the present application, the security processor can also directly save the key encryption information (WRAP_TK) and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine, without having to save it by the virtual machine platform; Furthermore, in this embodiment of the present application, the security processor can also write the virtual machine snapshot into the virtual machine image file to achieve saving of the virtual machine snapshot.
也就是说,本申请实施例将数据(例如密钥加密信息和加密快照内容等)保存在虚拟机快照中,可以是安全处理器通过虚拟机平台将数据保存在虚拟机快照中,也可以是安全处理器直接将数据保存在虚拟机快照中。That is to say, in the embodiment of the present application, the data (such as key encryption information and encrypted snapshot content, etc.) is saved in the virtual machine snapshot. The security processor can save the data in the virtual machine snapshot through the virtual machine platform, or it can be The security processor saves data directly in the virtual machine snapshot.
在一些实施例中,当虚拟机快照写入虚拟机镜像文件,实现保存虚拟机快照时,本申请实施例可对虚拟机镜像文件的镜像文件头进行更新(例如更新快照数量和快照头偏移),并生成快照头。In some embodiments, when the virtual machine snapshot is written into the virtual machine image file to save the virtual machine snapshot, the embodiment of the present application can update the image file header of the virtual machine image file (for example, update the snapshot number and snapshot header offset). ), and generate a snapshot header.
为便于理解,图2b示出了本申请实施例提供的虚拟机快照的数据结构的可选示意图。结合图2b和图1a所示,可以看出,本申请实施例所保存的虚拟机快照中至少包括加密快照内容和密钥加密信息(WRAP_TK);其中加密快照内容可对目标虚拟机的快照内容进行加密保护,减少了目标虚拟机的快照内容以明文形式保存而造成的虚拟机相关的配置和数据被窃取的情况,可以有效降低目标虚拟机的虚拟机数据被篡改的情况;密钥加密信息可至少对加密快照内容的TEK进行加密保护,便于后续在读取虚拟机快照时,通过解密密钥加密信息来得到TEK,以实现后续加密快照内容的解密和读取。To facilitate understanding, Figure 2b shows an optional schematic diagram of the data structure of a virtual machine snapshot provided by an embodiment of the present application. Combining Figure 2b and Figure 1a, it can be seen that the virtual machine snapshot saved in the embodiment of the present application at least includes encrypted snapshot content and key encryption information (WRAP_TK); where the encrypted snapshot content can be the snapshot content of the target virtual machine. Encryption protection reduces the theft of virtual machine-related configuration and data caused by the snapshot content of the target virtual machine being saved in clear text, which can effectively reduce the tampering of virtual machine data of the target virtual machine; key encryption information At least the TEK of the encrypted snapshot content can be encrypted and protected, so that when reading the virtual machine snapshot later, the TEK can be obtained by decrypting the key encryption information, so as to realize the decryption and reading of the subsequent encrypted snapshot content.
本申请实施例提供的虚拟机快照保存方法,可由安全处理器生成用于加密快照内容的TEK,以及用于加密TEK的KEK;从而,在需要保存目标虚拟机的虚拟机快照时,安全处理器可基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容。为实现TEK的加密保护,安全处理器还可基于KEK至少对TEK进行加密,得到密钥加密信息。进而,加密快照内容和密钥加密信息可保存在目标虚拟机的虚拟机快照中,且虚拟机快照可写入目标虚拟机的虚拟机镜像文件中,以实现保存目标虚拟机的虚拟机快照。可见,本申请实施例提供的虚拟机快照保存方法,可在虚拟机快照中以密文形式保存快照内容,减少了通过虚拟机的快照内容来窃取虚拟机相关的配置和数据的情况,有效降低了虚拟机数据被篡改的情况。同时,通过将至少加密TEK所得到的加密密钥信息保存在虚拟机快照中,可实现TEK的安全保护,并便于后续读取虚拟机快照时,能够通过解密加密密钥信息来恢复TEK,以实现加密快照内容的解密和读取。The virtual machine snapshot saving method provided by the embodiment of the present application can use the security processor to generate the TEK used to encrypt the snapshot content, and the KEK used to encrypt the TEK; thus, when it is necessary to save the virtual machine snapshot of the target virtual machine, the security processor The snapshot content of the target virtual machine can be encrypted based on TEK to obtain the encrypted snapshot content of the target virtual machine. In order to realize the encryption protection of TEK, the security processor can also encrypt at least TEK based on KEK to obtain key encryption information. Furthermore, the encrypted snapshot content and key encryption information can be saved in the virtual machine snapshot of the target virtual machine, and the virtual machine snapshot can be written into the virtual machine image file of the target virtual machine, so as to save the virtual machine snapshot of the target virtual machine. It can be seen that the virtual machine snapshot saving method provided by the embodiment of the present application can save the snapshot content in the form of ciphertext in the virtual machine snapshot, reducing the situation of stealing virtual machine-related configuration and data through the virtual machine snapshot content, and effectively reducing the number of virtual machine snapshots. The virtual machine data has been tampered with. At the same time, by saving at least the encryption key information obtained by encrypting the TEK in the virtual machine snapshot, the security protection of the TEK can be achieved, and when the virtual machine snapshot is subsequently read, the TEK can be restored by decrypting the encryption key information, so as to Implement decryption and reading of encrypted snapshot content.
在一些实施例中,安全处理器可至少基于密钥协商信息,生成KEK。作为可选实现,图3a示出了生成KEK的可选实现流程图。该流程可由安全处理器执行实现,如图3a所示,该流程可以包括如下步骤。In some embodiments, the security processor may generate a KEK based at least on the key agreement information. As an optional implementation, Figure 3a shows an optional implementation flow chart for generating a KEK. This process can be implemented by the security processor, as shown in Figure 3a. The process can include the following steps.
在步骤S310中,安全处理器基于密钥协商信息,使用密钥协商标准,确定公共密钥。In step S310, the security processor determines the public key based on the key agreement information and using the key agreement standard.
在一些实施例中,密钥协商信息可以包括密钥协商私钥信息,以及密钥协商公钥信息。密钥协商私钥信息可以是安全处理器私用的用于密钥协商的私钥,密钥协商公钥信息可以是能够对外公开的用于密钥协商的公钥。In some embodiments, the key agreement information may include key agreement private key information, and key agreement public key information. The key agreement private key information may be a private key used for key agreement that is privately used by the security processor, and the key agreement public key information may be a public key used for key agreement that can be disclosed to the outside world.
在一些实施例中,密钥协商私钥信息可以至少包括安全处理器的安全证书私钥,密钥协商公钥信息可以至少包括安全处理器的安全证书公钥。例如,安全处理器的安全证书可以是PDH(Platform Diffie-Hellman,平台迪菲赫尔曼密钥交换协议/算法)证书;PDH证书可以包括用于密钥协商的PDH证书私钥和PDH证书公钥,PDH证书私钥可以认为是上述安全证书私钥的一种可选形式,PDH证书公钥可以认为是上述的安全证书公钥的一种可选形式。在可选实现中,安全处理器可至少基于安全处理器的安全证书私钥(例如PDH证书私钥)、安全证书公钥(例如PDH证书公钥),使用密钥协商标准,确定公共密钥。In some embodiments, the key agreement private key information may include at least the security certificate private key of the security processor, and the key agreement public key information may at least include the security certificate public key of the security processor. For example, the security certificate of the security processor may be a PDH (Platform Diffie-Hellman key exchange protocol/algorithm) certificate; the PDH certificate may include the PDH certificate private key and the PDH certificate public key used for key negotiation. The PDH certificate private key can be considered as an optional form of the above-mentioned security certificate private key, and the PDH certificate public key can be considered as an optional form of the above-mentioned security certificate public key. In an optional implementation, the security processor may determine the public key using a key agreement standard based on at least the security processor's security certificate private key (such as the PDH certificate private key) and the security certificate public key (such as the PDH certificate public key). .
在进一步的一些实施例中,安全处理器还可结合密钥协商标准的随机私钥和随机公钥,来确定公共密钥;从而,密钥协商私钥信息还可以包括密钥协商标准的随机私钥,密钥协商公钥信息还可以包括密钥协商标准的随机公钥。在一个可选实现示例中,安全处理器可以基于SM2等密钥协商标准,来协商公共密钥;以使用SM2密钥协商标准为例,则密钥协商标准的随机私钥可以是SM2随机私钥,密钥协商标准的随机公钥可以是SM2随机公钥。In some further embodiments, the security processor can also combine the random private key and the random public key of the key agreement standard to determine the public key; thus, the key agreement private key information can also include the random private key of the key agreement standard. The private key and key agreement public key information may also include a random public key of the key agreement standard. In an optional implementation example, the security processor can negotiate the public key based on key agreement standards such as SM2; taking the SM2 key agreement standard as an example, the random private key of the key agreement standard can be an SM2 random private key. The key, the random public key of the key agreement standard can be the SM2 random public key.
作为可选实现,在基于安全处理器的安全证书和密钥协商标准(例如SM2密钥协商标准)确定公共密钥的情况下,密钥协商信息中的密钥协商私钥信息可以包括安全处理器的安全证书私钥,以及密钥协商标准的随机私钥;密钥协商信息中的密钥协商公钥信息可以包括安全处理器的安全证书公钥,以及密钥协商标准的随机公钥。例如,以使用PDH证书和SM2密钥协商标准为例,则安全处理器可基于PDH证书私钥、PDH证书公钥、SM2随机私钥和SM2随机共钥,使用SM2密钥协商标准,确定公共密钥。As an optional implementation, in the case where the public key is determined based on the security certificate of the security processor and the key agreement standard (such as the SM2 key agreement standard), the key agreement private key information in the key agreement information may include the security process The security certificate private key of the security processor and the random private key of the key agreement standard; the key agreement public key information in the key agreement information may include the security certificate public key of the security processor and the random public key of the key agreement standard. For example, taking the use of PDH certificate and SM2 key agreement standard as an example, the security processor can use the SM2 key agreement standard to determine the public key based on the PDH certificate private key, PDH certificate public key, SM2 random private key and SM2 random public key. key.
在步骤S311中,安全处理器基于所述公共密钥派生主密钥(master secret)。In step S311, the security processor derives a master secret based on the public key.
在一些实施例中,安全处理器可使用密钥派生算法(Key Derivation Function,KDF)由公共密钥派生出主密钥。In some embodiments, the security processor may use a key derivation algorithm (Key Derivation Function, KDF) to derive the master key from the public key.
在步骤S312中,安全处理器基于所述主密钥派生KEK。In step S312, the security processor derives a KEK based on the master key.
在本申请实施例中,KEK是用于对密钥进行加密的密钥,以保障密钥的安全性。在一些实施例中,KEK可以是SM4密钥。例如,安全处理器可通过主密钥派生SM4密钥,以生成KEK。In the embodiment of this application, KEK is a key used to encrypt the key to ensure the security of the key. In some embodiments, the KEK may be an SM4 key. For example, the security processor can derive the SM4 key from the master key to generate the KEK.
由图3a所示流程可以看出,安全处理器可先基于密钥协商信息,使用密钥协商标准,确定公共密钥;然后,再基于公共密钥派生主密钥;从而,基于主密钥派生出KEK。也就是说,生成KEK可以涵盖基于密钥协商信息协商公共密钥、基于公共密钥派生主密钥、基于主密钥派生KEK的过程。当然,图3a所示的生成KEK的过程仅是一种可选实现,本申请实施例也可支持基于密钥协商信息生成KEK的其他可能过程。As can be seen from the process shown in Figure 3a, the security processor can first determine the public key based on the key agreement information and the key agreement standard; then, derive the master key based on the public key; thus, based on the master key Derive KEK. That is to say, generating a KEK can cover the process of negotiating a public key based on key agreement information, deriving a master key based on the public key, and deriving a KEK based on the master key. Of course, the process of generating KEK shown in Figure 3a is only an optional implementation, and the embodiment of the present application can also support other possible processes of generating KEK based on key agreement information.
在一些实施例中,由于本申请实施例将加密密钥信息保存在了虚拟机快照中,而加密密钥信息又是由KEK至少对TEK进行加密而得到,因此在KEK基于密钥协商信息生成的情况下,本申请实施例可将密钥协商信息中能够对外公开的密钥协商公钥信息(例如安全处理器的安全证书公钥和密钥协商标准的随机公钥)保存在虚拟机快照中。基于上述操作,后续在读取虚拟机快照时,通过从虚拟机快照中导出密钥协商公钥信息,安全处理器可结合自身保存的密钥协商私钥信息来恢复KEK,从而实现利用KEK对虚拟机快照中的加密密钥信息进行解密,以恢复出TEK;进而可利用恢复的TEK对虚拟机快照中的加密快照内容进行解密,以对加密快照内容的解密和读取。In some embodiments, since the embodiments of the present application store the encryption key information in the virtual machine snapshot, and the encryption key information is obtained by encrypting at least TEK by KEK, the KEK is generated based on the key agreement information. In this case, the embodiment of the present application can save the public key information of the key agreement in the key agreement information that can be disclosed to the outside world (such as the security certificate public key of the security processor and the random public key of the key agreement standard) in the virtual machine snapshot. middle. Based on the above operations, when reading the virtual machine snapshot later, by deriving the key negotiation public key information from the virtual machine snapshot, the security processor can restore the KEK in combination with the key negotiation private key information saved by itself, thereby realizing the use of the KEK The encryption key information in the virtual machine snapshot is decrypted to recover the TEK; the recovered TEK can then be used to decrypt the encrypted snapshot content in the virtual machine snapshot to decrypt and read the encrypted snapshot content.
基于上述考虑,在一些实施例中,本申请实施例可将密钥协商公钥信息保存在目标虚拟机的虚拟机快照中。在可选实现中,安全处理器可将密钥协商公钥信息传输给虚拟机平台,由虚拟机平台将密钥协商公钥信息保存在目标虚拟机的虚拟机快照中。当然,本申请实施例也可支持由安全处理器将密钥协商公钥信息保存在目标虚拟机的虚拟机快照中。作为一种实现示例,在虚拟机快照已存在以密文形式保存的加密快照内容和加密密钥信息的情况下,密钥协商公钥信息可以明文形式保存在虚拟机快照中。例如,虚拟机快照中可进一步设置以明文形式保存信息的附加信息,密钥协商公钥信息可写入该附加信息,以实现保存在虚拟机快照中。Based on the above considerations, in some embodiments, embodiments of the present application may save the key agreement public key information in the virtual machine snapshot of the target virtual machine. In an optional implementation, the security processor may transmit the key negotiation public key information to the virtual machine platform, and the virtual machine platform saves the key negotiation public key information in a virtual machine snapshot of the target virtual machine. Of course, embodiments of the present application may also support the security processor to save the key negotiation public key information in the virtual machine snapshot of the target virtual machine. As an implementation example, when the virtual machine snapshot already has encrypted snapshot content and encryption key information saved in ciphertext, the key negotiation public key information can be saved in the virtual machine snapshot in clear text. For example, the virtual machine snapshot can be further set with additional information that saves the information in plain text, and the key agreement public key information can be written into the additional information to be saved in the virtual machine snapshot.
为便于理解,图3b示出了本申请实施例提供的虚拟机快照的数据结构的另一可选示意图。结合图2b和图3b所示,可以看出,本申请实施例保存的虚拟机快照中除包括密文形式的加密快照内容和密钥加密信息外,还包括明文形式的附加信息;密钥协商公钥信息可写入附加信息中,以实现将密钥协商公钥信息保存在虚拟机快照中。To facilitate understanding, FIG. 3b shows another optional schematic diagram of the data structure of the virtual machine snapshot provided by the embodiment of the present application. Combining Figure 2b and Figure 3b, it can be seen that in addition to the encrypted snapshot content and key encryption information in the form of ciphertext, the virtual machine snapshot saved in the embodiment of the present application also includes additional information in the form of plaintext; key negotiation Public key information can be written into additional information to save the key negotiation public key information in the virtual machine snapshot.
在进一步的一些实施例中,如果安全处理器是基于KEK和硬件真随机数发生器生成的第一随机数(WARP_IV),至少对TEK进行加密,以得到密钥加密信息(WRAP_TK);由于硬件真随机数发生器的随机性,本申请实施例也可将第一随机数(WARP_IV)保存在虚拟机快照的附加信息中,以便于后续安全处理器通过自身恢复的KEK以及附加信息中写入的第一随机数(WARP_IV),对密钥加密信息(WRAP_TK)进行解密。在一些可能的实施例中,第一随机数(WARP_IV)也可与TEK结合使用,对目标虚拟机的快照内容进行加密,得到所述加密快照内容。值得注意的是,第一随机数(WARP_IV)与生成TEK所使用的随机数不同,因此虚拟机快照中保存明文的第一随机数(WARP_IV)并不会导致生成TEK的信息泄露。In some further embodiments, if the security processor is based on the KEK and the first random number (WARP_IV) generated by the hardware true random number generator, at least the TEK is encrypted to obtain the key encryption information (WRAP_TK); due to the hardware To ensure the randomness of the true random number generator, the embodiment of this application can also save the first random number (WARP_IV) in the additional information of the virtual machine snapshot, so that the subsequent security processor can write it in the KEK and additional information restored by itself. The first random number (WARP_IV) is used to decrypt the key encryption information (WRAP_TK). In some possible embodiments, the first random number (WARP_IV) can also be used in combination with TEK to encrypt the snapshot content of the target virtual machine to obtain the encrypted snapshot content. It is worth noting that the first random number (WARP_IV) is different from the random number used to generate the TEK, so saving the first random number (WARP_IV) in clear text in the virtual machine snapshot will not lead to the leakage of the information used to generate the TEK.
图3c示出了本申请实施例提供的虚拟机快照的数据结构的再一可选示意图,图3c所示的数据结构在图3b的基础上,进一步在附加信息中写入了第一随机数(WARP_IV)。在可选实现中,安全处理器可将第一随机数(WARP_IV)传输给虚拟机平台,由虚拟机平台将第一随机数(WARP_IV)保存在虚拟机快照的附加信息中。当然,本申请实施例也可支持由安全处理器直接将第一随机数(WARP_IV)写入虚拟机快照的附加信息中。需要说明的是,在安全处理器支持物理内存、存储介质(例如磁盘)读写的情况下,本申请实施例任意由虚拟机平台实现的虚拟机快照的数据读写,均可由安全处理器替代实现,下文对此同样性质的替代实现不再另外说明。也就是说,本申请实施例将数据写入虚拟机快照,可以是安全处理器通过虚拟机平台实现,也可以是安全处理器直接实现。Figure 3c shows another optional schematic diagram of the data structure of the virtual machine snapshot provided by the embodiment of the present application. The data structure shown in Figure 3c is based on Figure 3b, and further writes a first random number in the additional information. (WARP_IV). In an optional implementation, the security processor may transmit the first random number (WARP_IV) to the virtual machine platform, and the virtual machine platform saves the first random number (WARP_IV) in additional information of the virtual machine snapshot. Of course, the embodiment of the present application can also support the security processor to directly write the first random number (WARP_IV) into the additional information of the virtual machine snapshot. It should be noted that when the security processor supports reading and writing of physical memory and storage media (such as disks), any data reading and writing of virtual machine snapshots implemented by the virtual machine platform in the embodiment of this application can be replaced by the security processor. Implementation, alternative implementations of the same nature will not be further described below. That is to say, in the embodiment of this application, data is written into the virtual machine snapshot, which can be implemented by the security processor through the virtual machine platform, or directly by the security processor.
在一些实施例中,本申请实施例还可支持对密钥加密信息(WRAP_TK)进行完整性保护,以便于后续在读取虚拟机快照时,能够检测虚拟机快照中保存的密钥加密信息是否完整,若检测密钥加密信息不完整,本申请实施例可确认密钥加密信息在虚拟机快照中保存时遭到破坏,可终止读取虚拟机快照。基于此,本申请实施例可通过生成KIK(KeyIntegrity Key,密钥完整性密钥),来实现密钥加密信息(WRAP_TK)的完整性保护。作为一种可选实现中,图3d示出了本申请实施例对密钥加密信息进行完整性保护的可选实现流程图。图3d所示流程可由安全处理器执行实现,如图3d所示,该流程可以包括如下步骤。In some embodiments, the embodiments of the present application can also support integrity protection of the key encryption information (WRAP_TK), so that when the virtual machine snapshot is read later, it can be detected whether the key encryption information saved in the virtual machine snapshot is Complete. If it is detected that the key encryption information is incomplete, the embodiment of the present application can confirm that the key encryption information is damaged when saving in the virtual machine snapshot, and the reading of the virtual machine snapshot can be terminated. Based on this, embodiments of the present application can achieve integrity protection of the key encryption information (WRAP_TK) by generating a KIK (KeyIntegrity Key). As an optional implementation, Figure 3d shows an optional implementation flow chart for integrity protection of key encryption information according to the embodiment of the present application. The process shown in Figure 3d can be implemented by the security processor. As shown in Figure 3d, the process can include the following steps.
在步骤S320中,安全处理器生成KIK。In step S320, the security processor generates a KIK.
在本申请实施例中,KIK是用于保障密钥完整性的密钥。In the embodiment of this application, KIK is a key used to ensure key integrity.
作为一种可选实现,安全处理器可基于步骤S311中生成的主密钥派生KIK。在一些实施例中,KEK和KIK虽然都能由主密钥派生得到,但是KEK和KIK的密钥类型可以不同;安全处理器可通过主密钥派生不同类型的密钥,得到KEK和KIK。例如,KEK可以是SM4密钥,KIK可以是HMAC(哈希运算消息认证码,Hash-based Message Authentication Code)-SM3密钥;安全处理器可通过主密钥派生SM4密钥,生成KEK;安全处理器可通过主密钥派生HMAC-SM3密钥,生成KIK。As an optional implementation, the security processor may derive the KIK based on the master key generated in step S311. In some embodiments, although both KEK and KIK can be derived from the master key, the key types of KEK and KIK can be different; the security processor can derive different types of keys through the master key to obtain KEK and KIK. For example, the KEK can be an SM4 key, and the KIK can be an HMAC (Hash-based Message Authentication Code)-SM3 key; the security processor can derive the SM4 key through the master key to generate the KEK; Security The processor can derive the HMAC-SM3 key from the master key and generate the KIK.
当然,本申请实施例也可支持其他生成KIK的方式,而不限于由主密钥派生KIK。本质上,KIK是用于保障密钥完整性的密钥,本申请实施例可支持任意能够保障密钥完整性的密钥来作为KIK。Of course, the embodiment of the present application can also support other methods of generating KIK, and is not limited to deriving KIK from the master key. Essentially, KIK is a key used to ensure key integrity. The embodiment of the present application can support any key that can ensure key integrity as a KIK.
在步骤S321中,安全处理器基于KIK,对密钥加密信息(WRAP_TK)进行完整性保护,以得到密钥完整性保护信息(WRAP_MAC)。In step S321, the security processor performs integrity protection on the key encryption information (WRAP_TK) based on the KIK to obtain the key integrity protection information (WRAP_MAC).
出于密钥加密信息在虚拟机快照中的完整性保护需求,安全处理器可使用KIK,对密钥加密信息(WRAP_TK)进行完整性保护,以得到密钥加密信息(WRAP_TK)对应的密钥完整性保护信息(WRAP_MAC)。在一些实施例中,安全处理器可基于KIK,计算密钥加密信息(WRAP_TK)的HMAC,以得到密钥完整性保护信息(WRAP_MAC)。Due to the need for integrity protection of key encryption information in virtual machine snapshots, the security processor can use KIK to perform integrity protection on the key encryption information (WRAP_TK) to obtain the key corresponding to the key encryption information (WRAP_TK). Integrity protection information (WRAP_MAC). In some embodiments, the security processor may calculate the HMAC of the key encryption information (WRAP_TK) based on the KIK to obtain the key integrity protection information (WRAP_MAC).
在进一步的一些实施例中,密钥完整性保护信息(WRAP_MAC)可以明文形式,保存在目标虚拟机的虚拟机快照中。例如,安全处理器可将密钥完整性保护信息(WRAP_MAC)传输给虚拟机平台,虚拟机平台将密钥完整性保护信息(WRAP_MAC)写入虚拟机快照的附加信息中。为便于理解,图3e示出了本申请实施例提供的虚拟机快照的数据结构的又一可选示意图。结合图3e和图3c所示,可以看出,虚拟机快照的附加信息中还写入有密钥完整性保护信息(WRAP_MAC),以便于后续在读取虚拟机快照时,对虚拟机快照中保存的密钥加密信息(WRAP_TK)的完整性进行检测。In some further embodiments, the key integrity protection information (WRAP_MAC) may be saved in the virtual machine snapshot of the target virtual machine in clear text form. For example, the security processor may transmit the key integrity protection information (WRAP_MAC) to the virtual machine platform, and the virtual machine platform writes the key integrity protection information (WRAP_MAC) into additional information of the virtual machine snapshot. To facilitate understanding, Figure 3e shows another optional schematic diagram of the data structure of the virtual machine snapshot provided by the embodiment of the present application. Combining Figure 3e and Figure 3c, it can be seen that the key integrity protection information (WRAP_MAC) is also written in the additional information of the virtual machine snapshot, so that when the virtual machine snapshot is read later, the key integrity protection information in the virtual machine snapshot can be read. Check the integrity of the saved key encryption information (WRAP_TK).
在一些实施例中,目标虚拟机的策略(policy)信息在目标虚拟机的整个生命周期均有效且不可更改,因此需确保目标虚拟机的策略信息在虚拟机快照保存和读取时不被改动。基于此,本申请实施例还可对目标虚拟机的策略信息进行完整性保护。进而后续在读取目标虚拟机的虚拟机快照时,如果检测目标虚拟机的策略信息不完整,则可确认虚拟机快照保存到读取的中间过程中,目标虚拟机的策略信息被改动,可终止后续读取目标虚拟机的虚拟机快照。需要说明的是,虚拟机的策略信息可以是由安全处理器(例如安全处理器中的安全固件)强制执行、并限制虚拟机管理程序在虚拟机上允许执行的配置和操作命令。In some embodiments, the policy information of the target virtual machine is valid throughout the entire life cycle of the target virtual machine and cannot be changed. Therefore, it is necessary to ensure that the policy information of the target virtual machine is not changed when the virtual machine snapshot is saved and read. . Based on this, embodiments of the present application can also perform integrity protection on the policy information of the target virtual machine. Then, when reading the virtual machine snapshot of the target virtual machine later, if the policy information of the target virtual machine is detected to be incomplete, it can be confirmed that the policy information of the target virtual machine was changed during the process of saving the virtual machine snapshot to reading, and it can be confirmed that the policy information of the target virtual machine was changed. Terminates subsequent reads of the virtual machine snapshot of the target virtual machine. It should be noted that the policy information of the virtual machine may be enforced by the security processor (for example, security firmware in the security processor) and restrict the configuration and operation commands that the virtual machine management program is allowed to execute on the virtual machine.
作为一种可选实现,安全处理器可通过生成TIK(Transport Integrity Key,传输完整性密钥),以实现对目标虚拟机的策略信息进行完整性保护。图4a示出了本申请实施例对目标虚拟机的策略信息进行完整性保护的可选实现流程图。图4a所示流程可由安全处理器执行实现,如图4a所示,该流程可以包括如下步骤。As an optional implementation, the security processor can generate a TIK (Transport Integrity Key) to achieve integrity protection of the policy information of the target virtual machine. Figure 4a shows an optional implementation flow chart for integrity protection of the policy information of the target virtual machine according to this embodiment of the present application. The process shown in Figure 4a can be implemented by the security processor. As shown in Figure 4a, the process can include the following steps.
在步骤S410中,安全处理器生成TIK。In step S410, the security processor generates a TIK.
TIK是本申请实施例用于保障数据完整性所使用的一种密钥。TIK is a key used in the embodiment of this application to ensure data integrity.
在一些实施例中,安全处理器可通过硬件真随机数发生器生成TIK。例如,安全处理器可基于硬件真随机数发生器生成的随机数,生成TIK。在可选实现中,安全处理器在步骤S210生成的TEK和在步骤S410生成的TIK虽然都可通过硬件真随机数发生器生成,但是TEK和TIK的密钥类型可以不同;安全处理器可通过硬件真随机数发生器生成不同类型的密钥,以得到TEK和TIK。例如,TEK可以是SM4密钥,安全处理器可通过硬件真随机数发生器生成SM4密钥,以得到TEK。例如,TIK可以是HMAC-SM3密钥,安全处理器可通过硬件真随机数发生器生成HMAC-SM3密钥,以得到TIK。In some embodiments, the security processor may generate the TIK via a hardware true random number generator. For example, the security processor can generate a TIK based on random numbers generated by a hardware true random number generator. In an optional implementation, although both the TEK generated by the security processor in step S210 and the TIK generated in step S410 can be generated by a hardware true random number generator, the key types of the TEK and TIK can be different; the security processor can use A hardware true random number generator generates different types of keys to derive TEK and TIK. For example, the TEK can be an SM4 key, and the security processor can generate the SM4 key through a hardware true random number generator to obtain the TEK. For example, the TIK can be an HMAC-SM3 key, and the security processor can generate the HMAC-SM3 key through a hardware true random number generator to obtain the TIK.
当然,本申请实施例也可支持其他生成TIK的方式,而不限于由安全处理器通过硬件真随机数发生器生成TIK。TIK本质上是用于保障数据完整性的密钥,任意能够支持数据完整性保护的密钥均可作为TIK。Of course, the embodiments of the present application may also support other methods of generating TIK, and are not limited to generating TIK by the security processor through a hardware true random number generator. TIK is essentially a key used to ensure data integrity. Any key that can support data integrity protection can be used as a TIK.
在步骤S411中,安全处理器获取目标虚拟机的策略信息。In step S411, the security processor obtains policy information of the target virtual machine.
在一些实施例中,目标虚拟机的策略信息可由虚拟机平台传输给安全处理器。In some embodiments, policy information for the target virtual machine may be transmitted by the virtual machine platform to the security processor.
在步骤S412中,安全处理器基于TIK对所述策略信息进行完整性保护,以得到策略完整性保护信息(POLICY_MAC)。In step S412, the security processor performs integrity protection on the policy information based on TIK to obtain policy integrity protection information (POLICY_MAC).
在一些实施例中,安全处理器可基于TIK,计算目标虚拟机的策略信息的HMAC,以得到所述策略完整性保护信息(POLICY_MAC)。In some embodiments, the security processor may calculate the HMAC of the policy information of the target virtual machine based on the TIK to obtain the policy integrity protection information (POLICY_MAC).
在进一步的一些实施例中,策略完整性保护信息(POLICY_MAC)可以明文形式,保存在目标虚拟机的虚拟机快照中。例如,安全处理器可将策略完整性保护信息(POLICY_MAC)传输给虚拟机平台,虚拟机平台将策略完整性保护信息(POLICY_MAC)写入虚拟机快照的附加信息中。为便于理解,图4b示出了本申请实施例提供的虚拟机快照的数据结构的又另一可选示意图。结合图3e和图4b所示,可以看出,虚拟机快照的附加信息中还写入有策略完整性保护信息(POLICY_MAC),以便于后续在读取虚拟机快照时,对目标虚拟机的策略信息的完整性进行检测。In some further embodiments, the policy integrity protection information (POLICY_MAC) may be stored in the virtual machine snapshot of the target virtual machine in clear text form. For example, the security processor may transmit the policy integrity protection information (POLICY_MAC) to the virtual machine platform, and the virtual machine platform writes the policy integrity protection information (POLICY_MAC) into additional information of the virtual machine snapshot. To facilitate understanding, Figure 4b shows yet another optional schematic diagram of the data structure of the virtual machine snapshot provided by the embodiment of the present application. Combining Figure 3e and Figure 4b, it can be seen that the additional information of the virtual machine snapshot also contains policy integrity protection information (POLICY_MAC), so that when the virtual machine snapshot is read later, the policy of the target virtual machine can be verified. Check the integrity of the information.
在进一步的一些实施例中,安全处理器还可基于TIK对加密快照内容进行完整性保护,得到加密快照完整性保护信息。例如,安全处理器基于TIK,计算加密快照内容对应的HMAC,以得到加密快照完整性保护信息。该加密快照完整性保护信息也可保存在附加信息中。进一步结合图4b所示,附加信息中还可保存加密快照完整性保护信息。In some further embodiments, the security processor can also perform integrity protection on the encrypted snapshot content based on the TIK to obtain the integrity protection information of the encrypted snapshot. For example, the security processor calculates the HMAC corresponding to the encrypted snapshot content based on TIK to obtain the integrity protection information of the encrypted snapshot. This encrypted snapshot integrity protection information may also be stored in additional information. Further combined with what is shown in Figure 4b, the encrypted snapshot integrity protection information can also be stored in the additional information.
在进一步的一些实施例中,本申请实施例也可将目标虚拟机的策略信息保存在目标虚拟机的虚拟机快照中。例如,安全处理器可将目标虚拟机的策略信息传输给虚拟机平台,虚拟机平台将目标虚拟机的策略信息写入虚拟机快照的附加信息中。In some further embodiments, the embodiments of the present application may also save the policy information of the target virtual machine in the virtual machine snapshot of the target virtual machine. For example, the security processor may transmit the policy information of the target virtual machine to the virtual machine platform, and the virtual machine platform writes the policy information of the target virtual machine into additional information of the virtual machine snapshot.
在进一步的一些实施例中,本申请实施例也可对TIK进行加密保护,以在后续读取虚拟机快照时,通过对加密的TIK进行恢复,实现检测目标虚拟机的策略信息的完整性、加密快照内容的完整性。在可选实现中,由于TEK和TIK均由安全处理器通过硬件真随机数发生器生成,因此TIK可作为密钥加密信息(WRAP_TK)中的部分加密内容。在一些实施例中,安全处理器可在生成密钥加密信息(WRAP_TK)时,基于KEK对TEK和TIK整体进行加密,以得到密钥加密信息(WRAP_TK)。例如,安全处理器可基于KEK和硬件真随机数发生器生成的第一随机数(WARP_IV)对TEK和TIK整体进行加密,以得到密钥加密信息(WRAP_TK)。基于此,在目标虚拟机的虚拟机快照中保存的密钥加密信息(WRAP_TK)可以是,TEK和TIK整体加密后的信息。为便于理解,图4c示出了本申请实施例提供的虚拟机快照的数据结构的又再一可选示意图。结合图4c和图4b所示,可以看出,虚拟机快照的密钥加密信息(WRAP_TK)为TEK和TIK整体加密后的信息。相应的,密钥完整性保护信息(WRAP_MAC)可以是对TEK和TIK整体进行加密后的密钥加密信息(WRAP_TK)进行完整性保护。In some further embodiments, the embodiments of the present application can also encrypt and protect the TIK, so that when the virtual machine snapshot is subsequently read, the encrypted TIK can be restored to detect the integrity of the policy information of the target virtual machine. Encrypts the integrity of snapshot contents. In an optional implementation, since both TEK and TIK are generated by the security processor using a hardware true random number generator, the TIK can be used as part of the encrypted content in the key encryption message (WRAP_TK). In some embodiments, when generating the key encryption information (WRAP_TK), the security processor may encrypt the entire TEK and TIK based on the KEK to obtain the key encryption information (WRAP_TK). For example, the security processor can encrypt the TEK and TIK as a whole based on the KEK and the first random number (WARP_IV) generated by the hardware true random number generator to obtain the key encryption information (WRAP_TK). Based on this, the key encryption information (WRAP_TK) saved in the virtual machine snapshot of the target virtual machine may be the encrypted information of TEK and TIK as a whole. To facilitate understanding, Figure 4c shows yet another optional schematic diagram of the data structure of the virtual machine snapshot provided by the embodiment of the present application. Combining Figure 4c and Figure 4b, it can be seen that the key encryption information (WRAP_TK) of the virtual machine snapshot is the encrypted information of TEK and TIK as a whole. Correspondingly, the key integrity protection information (WRAP_MAC) may be the key encryption information (WRAP_TK) that encrypts the TEK and TIK as a whole for integrity protection.
需要说明的是,本申请实施例在图2a所示流程基础上,进一步提供的基于密钥协商信息生成KEK的实现手段、密钥加密信息的完整性保护手段、目标虚拟机的策略信息的完整性保护手段等均可视为是可选手段,本申请实施例可视实际的情况选择使用上述手段中的一种或者多种,相应的,虚拟机快照中保存的信息可对应调整。例如,选择不使用密钥加密信息的完整性保护手段,则虚拟机快照中可不保存密钥完整性保护信息(WRAP_MAC),其他情况同理推导,此处不再进一步展开。当然,选用密钥加密信息的完整性保护手段、目标虚拟机的策略信息的完整性保护手段等,可使得本申请实施例提供的方案更为完善,提升虚拟机快照保存和后续读取的安全性,但这仅是图2a所示流程基础上进一步的技术完善手段,而非必须手段。It should be noted that, on the basis of the process shown in Figure 2a, the embodiment of this application further provides means for generating a KEK based on key agreement information, means for protecting the integrity of key encryption information, and means for ensuring the integrity of the policy information of the target virtual machine. Sexual protection means can be regarded as optional means. The embodiments of the present application can choose to use one or more of the above means according to the actual situation. Correspondingly, the information saved in the virtual machine snapshot can be adjusted accordingly. For example, if you choose an integrity protection method that does not use key encryption information, the key integrity protection information (WRAP_MAC) does not need to be saved in the virtual machine snapshot. The same derivation can be made in other cases, which will not be further elaborated here. Of course, the use of integrity protection means for key encryption information, integrity protection means for policy information of the target virtual machine, etc. can make the solution provided by the embodiments of this application more complete and improve the security of virtual machine snapshot saving and subsequent reading. nature, but this is only a further technical improvement method based on the process shown in Figure 2a, rather than a necessary means.
在进一步的一些实施例中,当目标虚拟机的虚拟机快照保存后,例如目标虚拟机的虚拟机快照写入到虚拟机镜像文件后,安全处理器可销毁保存虚拟机快照过程中生成的相关密钥,例如,安全处理器可销毁TEK、TIK、KEK和KIK。In some further embodiments, after the virtual machine snapshot of the target virtual machine is saved, for example, after the virtual machine snapshot of the target virtual machine is written to the virtual machine image file, the security processor can destroy the relevant data generated during the process of saving the virtual machine snapshot. Keys, such as TEK, TIK, KEK and KIK, can be destroyed by the secure processor.
在进一步的一些实施例中,如果安全处理器是基于密钥协商信息,在密钥协商过程中生成KEK,则安全处理器可将密钥协商中生成的密钥摘要(例如,根据SM2密钥协商标准计算出的密钥摘要),传输给虚拟机平台;虚拟机平台在基于该密钥摘要,检查安全处理器的密钥协商过程成功的情况下,安全处理器才对目标虚拟机的快照内容进行加密,并使得加密快照内容保存到虚拟机快照中。例如,虚拟机平台可重新计算密钥摘要,将重新计算的密钥摘要与安全处理器传输的密钥摘要进行比对,如果比对一致,则安全处理器的密钥协商过程成功,如果比对不一致,则安全处理器的密钥协商过程失败。在安全处理器的安全处理器的密钥协商过程失败的情况下,本申请实施例可终止后续对快照内容进行加密、将加密快照内容保存到虚拟机快照等操作。In some further embodiments, if the security processor generates a KEK during the key negotiation process based on the key agreement information, the security processor may convert the key digest generated during the key negotiation (e.g., according to the SM2 key The key digest calculated by the negotiation standard) is transmitted to the virtual machine platform; the virtual machine platform checks the security processor's key negotiation process based on the key digest, and then the security processor takes a snapshot of the target virtual machine. The content is encrypted and the encrypted snapshot content is saved to the virtual machine snapshot. For example, the virtual machine platform can recalculate the key digest and compare the recalculated key digest with the key digest transmitted by the security processor. If the comparison is consistent, the key negotiation process of the security processor is successful. If the pair is inconsistent, the key negotiation process of the security processor fails. When the key negotiation process of the security processor fails, embodiments of the present application can terminate subsequent operations such as encrypting the snapshot content and saving the encrypted snapshot content to the virtual machine snapshot.
作为一种可选实现,图5示出了本申请实施例提供的虚拟机快照保存方法的另一可选流程图。图5所示流程可从技术细节上描述虚拟机快照的保存方案。图5所示的步骤可以认为是实现虚拟机快照保存可以设置的步骤,图5所示步骤之间的顺序可以进行调整,而并不一定按照图5所示步骤的序号进行执行。如图5所示,该流程可以包括如下步骤。As an optional implementation, FIG. 5 shows another optional flow chart of the virtual machine snapshot saving method provided by the embodiment of the present application. The process shown in Figure 5 can describe the virtual machine snapshot saving solution in technical details. The steps shown in Figure 5 can be considered as steps that can be set to save virtual machine snapshots. The order of the steps shown in Figure 5 can be adjusted, and the steps do not necessarily need to be executed according to the sequence numbers shown in Figure 5 . As shown in Figure 5, the process may include the following steps.
在步骤S510中,虚拟机平台读取并解析目标虚拟机的虚拟机镜像文件,以启动目标虚拟机。In step S510, the virtual machine platform reads and parses the virtual machine image file of the target virtual machine to start the target virtual machine.
在一些实施例中,虚拟机平台在启动目标虚拟机时,可读取目标虚拟机的虚拟机镜像文件,并对读取的虚拟机镜像文件进行解析,以获得启动目标虚拟机所需的启动数据(例如目标虚拟机的BIOS、硬件配置、分区信息、引导程序等),从而通过该启动数据实现启动目标虚拟机。In some embodiments, when starting the target virtual machine, the virtual machine platform can read the virtual machine image file of the target virtual machine and parse the read virtual machine image file to obtain the startup information required to start the target virtual machine. Data (such as the BIOS, hardware configuration, partition information, boot program, etc.) of the target virtual machine, so that the target virtual machine can be started through the startup data.
在步骤S511中,虚拟机平台暂停运行目标虚拟机,向安全处理器请求PDH证书公钥、SM2随机公钥等信息。In step S511, the virtual machine platform suspends the target virtual machine and requests the security processor for information such as the PDH certificate public key and the SM2 random public key.
在步骤S512中,安全处理器将PDH证书公钥、SM2随机公钥等信息传输给虚拟机平台。In step S512, the security processor transmits the PDH certificate public key, SM2 random public key and other information to the virtual machine platform.
虚拟机平台在启动目标虚拟机后,若需保存目标虚拟机的虚拟机快照(例如,将虚拟机快照写入虚拟机镜像文件中),则虚拟机平台会发起保存虚拟机快照的流程,此时,虚拟机平台控制目标虚拟机暂停运行,并向安全处理器请求导出PDH证书公钥、SM2随机公钥等密钥协商公钥信息,以便后续虚拟机平台能够重新计算密钥协商过程中生成的密钥摘要,检查安全处理器的密钥协商过程是否成功。在进一步的一些实施例中,在步骤S511中,虚拟机平台也可请求安全处理器导出PDH证书链。需要说明的是,虚拟机平台发起保存虚拟机快照的时机,本申请实施例并不设限,例如可按常规的保存虚拟机快照的时机,触发本申请实施例的流程。After the virtual machine platform starts the target virtual machine, if it needs to save the virtual machine snapshot of the target virtual machine (for example, write the virtual machine snapshot into the virtual machine image file), the virtual machine platform will initiate the process of saving the virtual machine snapshot. When key digest to check whether the security processor's key negotiation process was successful. In some further embodiments, in step S511, the virtual machine platform may also request the security processor to export the PDH certificate chain. It should be noted that the embodiment of the present application does not set a limit on the timing when the virtual machine platform initiates saving of the virtual machine snapshot. For example, the process of the embodiment of the present application can be triggered according to the conventional timing of saving the virtual machine snapshot.
在步骤S513中,安全处理器基于PDH证书私钥、PDH证书公钥、SM2随机私钥、SM2随机公钥,使用SM2密钥协商标准,计算公共密钥。In step S513, the security processor calculates the public key based on the PDH certificate private key, the PDH certificate public key, the SM2 random private key, the SM2 random public key, and using the SM2 key agreement standard.
在步骤S514中,安全处理器使用密钥派生算法,由公共密钥派生主密钥。In step S514, the security processor uses a key derivation algorithm to derive the master key from the public key.
在步骤S515中,安全处理器由主密钥派生KEK和KIK。In step S515, the security processor derives KEK and KIK from the master key.
在步骤S516中,安全处理器通过硬件真随机数发生器产生第一随机数(WARP_IV)。In step S516, the security processor generates a first random number (WARP_IV) through a hardware true random number generator.
在步骤S517中,安全处理器通过硬件真随机数发生器产生TEK和TIK。In step S517, the security processor generates TEK and TIK through a hardware true random number generator.
在步骤S518中,安全处理器使用KEK和第一随机数对TEK和KIK整体进行加密,得到密钥加密信息(WRAP_TK)。In step S518, the security processor uses KEK and the first random number to encrypt the entire TEK and KIK to obtain key encryption information (WRAP_TK).
在步骤S519中,安全处理器使用KIK计算密钥加密信息(WRAP_TK)的HMAC,得到密钥完整性保护信息(WRAP_MAC)。In step S519, the security processor uses KIK to calculate the HMAC of the key encryption information (WRAP_TK) and obtains the key integrity protection information (WRAP_MAC).
在步骤S520中,安全处理器使用TIK计算目标虚拟机的策略信息的HMAC,得到策略完整性保护信息(POLICY_MAC)。In step S520, the security processor uses TIK to calculate the HMAC of the policy information of the target virtual machine, and obtains the policy integrity protection information (POLICY_MAC).
在一些实施例中,虚拟机平台向安全处理器请求PDH证书公钥、SM2随机公钥等信息后,安全处理器可确认虚拟机平台发起了目标虚拟机的虚拟机快照保存流程,安全处理器可生成KEK、KIK、TEK和TIK,以便本申请实施例的数据加密和数据完整性保护操作。In some embodiments, after the virtual machine platform requests information such as the PDH certificate public key and SM2 random public key from the security processor, the security processor can confirm that the virtual machine platform initiated the virtual machine snapshot saving process of the target virtual machine. The security processor KEK, KIK, TEK and TIK can be generated to facilitate the data encryption and data integrity protection operations of the embodiment of the present application.
在步骤S521中,安全处理器将SM2密钥协商过程生成的密钥摘要传输给虚拟机平台。In step S521, the security processor transmits the key digest generated by the SM2 key negotiation process to the virtual machine platform.
在步骤S522中,虚拟机平台重新计算密钥摘要,若重新计算的密钥摘要与安全处理器传输的密钥摘要一致,则将目标虚拟机的快照内容传输给安全处理器。In step S522, the virtual machine platform recalculates the key digest. If the recalculated key digest is consistent with the key digest transmitted by the security processor, the snapshot content of the target virtual machine is transmitted to the security processor.
虚拟机平台在获取安全处理器传输的密钥摘要后,可基于步骤S512中获得的PDH证书公钥、SM2随机公钥等信息,重新计算SM2密钥协商过程生成的密钥摘要,将重新计算的密钥摘要与安全处理器传输的密钥摘要进行比对,以检查安全处理器的密钥协商过程是否成功;若两者一致,则可将目标虚拟机的快照内容传输给安全处理器,以便安全处理器对快照内容进行加密;若两者不一致,则虚拟机平台可终止后续流程。可以理解的是,目标虚拟机的快照内容也可提前发送给安全处理器,而不限于在目标虚拟机检查安全处理器的密钥协商过程成功之后,例如,目标虚拟机平台在检查安全处理器的密钥协商过程成功之后,可向安全处理器传输一个指示信息,以指示安全处理器进行后续操作。After obtaining the key digest transmitted by the security processor, the virtual machine platform can recalculate the key digest generated by the SM2 key negotiation process based on the PDH certificate public key, SM2 random public key and other information obtained in step S512, and will recalculate Compare the key digest with the key digest transmitted by the security processor to check whether the key negotiation process of the security processor is successful; if the two are consistent, the snapshot content of the target virtual machine can be transmitted to the security processor. This allows the security processor to encrypt the snapshot content; if the two are inconsistent, the virtual machine platform can terminate subsequent processes. It can be understood that the snapshot content of the target virtual machine can also be sent to the security processor in advance, and is not limited to after the target virtual machine checks the security processor's key negotiation process. For example, the target virtual machine platform checks the security processor after the key negotiation process is successful. After the key negotiation process is successful, an indication message can be transmitted to the security processor to instruct the security processor to perform subsequent operations.
在步骤S523中,安全处理器使用TEK以及第一随机数,对快照内容进行加密,得到加密快照内容。In step S523, the security processor uses the TEK and the first random number to encrypt the snapshot content to obtain the encrypted snapshot content.
在步骤S524中,安全处理器使用TIK对加密快照内容进行完整性保护,得到加密快照完整性保护信息。In step S524, the security processor uses TIK to perform integrity protection on the encrypted snapshot content, and obtains the integrity protection information of the encrypted snapshot.
在本申请实施例进一步的一些实施例中,安全处理器在对快照内容进行加密后,还可提供加密快照内容的完整性保护方案。例如,安全处理器可使用TIK计算加密快照内容的HMAC,以得到加密快照完整性保护信息,从而实现对加密快照内容进行完整性保护。In some further embodiments of the embodiments of the present application, after encrypting the snapshot content, the security processor may also provide an integrity protection solution for encrypting the snapshot content. For example, the security processor can use TIK to calculate the HMAC of the encrypted snapshot content to obtain the integrity protection information of the encrypted snapshot, thereby achieving integrity protection for the encrypted snapshot content.
在步骤S525中,安全处理器将加密快照内容、密钥加密信息(WRAP_TK)、密钥完整性保护信息(WRAP_MAC)、策略完整性保护信息(POLICY_MAC)、加密快照完整性保护信息、第一随机数(WARP_IV)传输给虚拟机平台。In step S525, the security processor encrypts the snapshot content, key encryption information (WRAP_TK), key integrity protection information (WRAP_MAC), policy integrity protection information (POLICY_MAC), encrypted snapshot integrity protection information, and the first random The number (WARP_IV) is transferred to the virtual machine platform.
需要说明的是,加密快照内容、密钥加密信息(WRAP_TK)、密钥完整性保护信息(WRAP_MAC)、策略完整性保护信息(POLICY_MAC)、加密快照完整性保护信息、第一随机数(WARP_IV)并不一定同时由安全处理器传输给虚拟机平台。例如,安全处理器也可在生成其中的某一项信息后,就传输给虚拟机平台,而安全处理器加密快照内容的执行步骤可晚于其他阶段,安全处理器可最后将加密快照内容传输给虚拟机平台。It should be noted that the encrypted snapshot content, key encryption information (WRAP_TK), key integrity protection information (WRAP_MAC), policy integrity protection information (POLICY_MAC), encrypted snapshot integrity protection information, and the first random number (WARP_IV) It is not necessarily transmitted to the virtual machine platform by the security processor at the same time. For example, the security processor can also transmit a certain piece of information to the virtual machine platform after generating it, and the security processor can encrypt the snapshot content later than other stages, and the security processor can finally transmit the encrypted snapshot content. to the virtual machine platform.
在步骤S526中,虚拟机平台将加密快照内容、密钥加密信息(WRAP_TK)、密钥完整性保护信息(WRAP_MAC)、策略完整性保护信息(POLICY_MAC)、加密快照完整性保护信息、第一随机数(WARP_IV)、策略信息、PDH证书公钥、SM2随机公钥等信息保存到目标虚拟机的虚拟机快照中,该虚拟机快照写入虚拟机镜像文件中。In step S526, the virtual machine platform encrypts the snapshot content, key encryption information (WRAP_TK), key integrity protection information (WRAP_MAC), policy integrity protection information (POLICY_MAC), encrypted snapshot integrity protection information, first random (WARP_IV), policy information, PDH certificate public key, SM2 random public key and other information are saved to the virtual machine snapshot of the target virtual machine, and the virtual machine snapshot is written into the virtual machine image file.
在一些实施例中,加密快照内容、密钥加密信息(WRAP_TK)属于密文信息,而密钥完整性保护信息(WRAP_MAC)、策略完整性保护信息(POLICY_MAC)、加密快照完整性保护信息、策略信息、第一随机数(WARP_IV)、PDH证书公钥、SM2随机公钥等信息属于明文信息,虚拟机快照中可设置明文形式的附加信息,从而将这些明文信息保存到虚拟机快照的附加信息中。In some embodiments, the encrypted snapshot content and key encryption information (WRAP_TK) belong to the ciphertext information, and the key integrity protection information (WRAP_MAC), policy integrity protection information (POLICY_MAC), encrypted snapshot integrity protection information, policy Information, first random number (WARP_IV), PDH certificate public key, SM2 random public key and other information are plain text information. Additional information in plain text form can be set in the virtual machine snapshot, thereby saving these plain text information to the additional information of the virtual machine snapshot. middle.
在步骤S527中,安全处理器销毁TEK、TIK、KEK和KIK。In step S527, the security processor destroys TEK, TIK, KEK and KIK.
在步骤S528中,虚拟机平台继续运行目标虚拟机。In step S528, the virtual machine platform continues to run the target virtual machine.
当目标虚拟机的虚拟机快照保存完成后,安全处理器可销毁TEK、TIK、KEK和KIK等相关的密钥,并且虚拟机平台可恢复运行目标虚拟机,使得目标虚拟机继续运行。After the virtual machine snapshot of the target virtual machine is saved, the security processor can destroy related keys such as TEK, TIK, KEK, and KIK, and the virtual machine platform can resume running the target virtual machine so that the target virtual machine continues to run.
基于前文描述的,可以看出,在一些实施例中,本申请实施例在目标虚拟机的虚拟机快照中保存的信息可以至少包括:加密快照内容和密钥加密信息(WRAP_TK)。其中,密钥加密信息(WRAP_TK)可以是对TEK进行加密而得到,也可以是对TEK和TIK整体进行加密而得到。Based on the foregoing description, it can be seen that in some embodiments, the information saved in the virtual machine snapshot of the target virtual machine according to the embodiment of the present application may at least include: encrypted snapshot content and key encryption information (WRAP_TK). The key encryption information (WRAP_TK) may be obtained by encrypting TEK, or may be obtained by encrypting TEK and TIK as a whole.
在另外可能的一个或多个实施例中,目标虚拟机的虚拟机快照中保存的信息可以包括:加密快照内容、密钥加密信息(WRAP_TK)和附加信息。附加信息可以包括如下至少一项信息(即如下一项或多项信息):In another possible embodiment or embodiments, the information saved in the virtual machine snapshot of the target virtual machine may include: encrypted snapshot content, key encryption information (WRAP_TK), and additional information. Additional information may include at least one of the following information (i.e. one or more of the following information):
密钥协商公钥信息(例如,PDH证书公钥和SM2随机共钥);Key agreement public key information (for example, PDH certificate public key and SM2 random public key);
密钥完整性保护信息(WRAP_MAC);Key integrity protection information (WRAP_MAC);
策略完整性保护信息(POLICY_MAC)、目标虚拟机的策略(policy)信息;Policy integrity protection information (POLICY_MAC), policy (policy) information of the target virtual machine;
第一随机数(WARP_IV);The first random number (WARP_IV);
加密快照完整性保护信息。Encrypted snapshot integrity protection information.
需要说明的是,上述附加信息保存在虚拟机快照中仅是一种可选实现,本申请实施例也可支持上述附加信息保存在虚拟机快照的外部或者其他存储位置。It should be noted that saving the above additional information in the virtual machine snapshot is only an optional implementation. Embodiments of the present application may also support saving the above additional information outside the virtual machine snapshot or in other storage locations.
本申请实施例可在虚拟机快照中以密文形式保存快照内容,提升了虚拟机快照的安全性;并且可在虚拟机快照中以密文形式保存加密密钥信息,该加密密钥信息可至少是对用于加密快照内容的TEK进行加密后而得到,可实现TEK的安全保护,并便于后续读取虚拟机快照时,能够通过解密加密密钥信息来恢复TEK,以实现加密快照内容的解密和读取。进一步的,本申请实施例还可设置明文形式的附加信息,以保存用于加密密钥信息的完整性保护的密钥完整性保护信息、用于虚拟机的策略信息的完整性保护的策略完整性保护信息等信息,从而便于后续在读取虚拟机快照时,实现相关数据的完整性检测,能够进一步提升虚拟机快照保存时的安全性。The embodiment of the present application can save the snapshot content in the form of ciphertext in the virtual machine snapshot, which improves the security of the virtual machine snapshot; and can save the encryption key information in the form of ciphertext in the virtual machine snapshot, and the encryption key information can At least it is obtained by encrypting the TEK used to encrypt the snapshot content, which can realize the security protection of the TEK and facilitate the subsequent reading of the virtual machine snapshot. The TEK can be restored by decrypting the encryption key information to realize the encrypted snapshot content. Decrypt and read. Further, the embodiment of the present application can also set additional information in plain text form to preserve the key integrity protection information used for integrity protection of encryption key information and the policy integrity used for integrity protection of virtual machine policy information. The security protection information and other information can be used to facilitate the integrity detection of relevant data when reading virtual machine snapshots later, which can further improve the security of virtual machine snapshots when saving them.
在基于前文描述的虚拟机快照保存方案,保存目标虚拟机的虚拟快照后,本申请实施例还提供虚拟机快照的读取方案。下面对虚拟机快照的读取方案进行介绍,可以理解的是,下文描述的虚拟机快照的读取方案涉及到与前文保存方案相关的部分,可相互参照。After saving the virtual snapshot of the target virtual machine based on the virtual machine snapshot saving solution described above, embodiments of the present application also provide a reading solution for the virtual machine snapshot. The reading scheme of the virtual machine snapshot is introduced below. It can be understood that the reading scheme of the virtual machine snapshot described below involves parts related to the previous saving scheme and can be referred to each other.
作为一种可选实现,图6a示出了本申请实施例提供的虚拟机快照读取方法的可选流程图。如图6a所示,该流程可以包括如下步骤。As an optional implementation, Figure 6a shows an optional flow chart of the virtual machine snapshot reading method provided by the embodiment of the present application. As shown in Figure 6a, the process may include the following steps.
在步骤S610中,虚拟机平台从目标虚拟机的虚拟机镜像文件中获取虚拟机快照,所述虚拟机快照包括加密快照内容和密钥加密信息。In step S610, the virtual machine platform obtains a virtual machine snapshot from the virtual machine image file of the target virtual machine, where the virtual machine snapshot includes encrypted snapshot content and key encryption information.
在步骤S611中,虚拟机平台将所述虚拟机快照传输给安全处理器。In step S611, the virtual machine platform transmits the virtual machine snapshot to the security processor.
在一些实施例中,安全处理器可通过虚拟机平台从目标虚拟机的虚拟机镜像文件中获取虚拟机快照,例如通过步骤S610和步骤S611实现安全处理器获取虚拟机快照。在另一些实施例中,安全处理器也可直接从目标虚拟机的虚拟机镜像文件中获取虚拟机快照。In some embodiments, the security processor can obtain the virtual machine snapshot from the virtual machine image file of the target virtual machine through the virtual machine platform. For example, the security processor obtains the virtual machine snapshot through steps S610 and S611. In other embodiments, the security processor may also directly obtain the virtual machine snapshot from the virtual machine image file of the target virtual machine.
读取目标虚拟机的虚拟机快照实际上是读取其中的快照内容,并依照快照内容恢复目标虚拟机的状态。基于本申请实施例提供的虚拟机快照保存方案,虚拟机快照中至少包括加密快照内容和密钥加密信息,因此在读取快照内容时,涉及到对加密快照内容进行解密。Reading the virtual machine snapshot of the target virtual machine actually reads the snapshot content and restores the state of the target virtual machine according to the snapshot content. Based on the virtual machine snapshot saving solution provided by the embodiment of the present application, the virtual machine snapshot at least includes encrypted snapshot content and key encryption information. Therefore, reading the snapshot content involves decrypting the encrypted snapshot content.
在步骤S612中,安全处理器恢复KEK。In step S612, the security processor restores the KEK.
在步骤S613中,安全处理器基于KEK对所述密钥加密信息进行解密,得到TEK。In step S613, the security processor decrypts the key encryption information based on the KEK to obtain the TEK.
在一些实施例中,密钥加密信息是基于KEK至少对TEK进行加密得到,而TEK用于对快照内容进行加密而得到加密快照内容,因此为实现加密快照内容的解密,从而读取到目标虚拟机的快照内容,本申请实施例可恢复KEK,利用KEK对密钥加密信息进行解密,得到TEK。In some embodiments, the key encryption information is obtained by encrypting at least TEK based on KEK, and TEK is used to encrypt the snapshot content to obtain the encrypted snapshot content. Therefore, in order to decrypt the encrypted snapshot content, the target virtual machine can be read. According to the snapshot content of the computer, the embodiment of the present application can restore the KEK, and use the KEK to decrypt the key encryption information to obtain the TEK.
在一些实施例中,所述虚拟机快照中还可包括明文的附加信息(所述附加信息也可保存在其他存储位置),所述附加信息可以至少包括密钥协商公钥信息;从而,安全处理器可通过虚拟机平台或者自身获取所述附加信息,基于附加信息中的密钥协商公钥信息以及安全处理器自身的密钥协商私钥信息,恢复出KEK,进而利用恢复的KEK对密钥加密信息进行解密,得到TEK。In some embodiments, the virtual machine snapshot may also include additional information in clear text (the additional information may also be stored in other storage locations), and the additional information may include at least key agreement public key information; thus, security The processor can obtain the additional information through the virtual machine platform or itself, recover the KEK based on the key negotiation public key information in the additional information and the security processor's own key negotiation private key information, and then use the restored KEK to verify the encryption key. Decrypt the key-encrypted information to obtain the TEK.
在进一步的一些实施例中,如果安全处理器是结合KEK和第一随机数(WARP_IV),至少对TEK进行加密,从而得到密钥加密信息,则所述附加信息中还可以包括第一随机数(WARP_IV);进而,安全处理器在恢复KEK后,可基于KEK和附加信息中的第一随机数(WARP_IV),对密钥加密信息进行解密,得到TEK。In some further embodiments, if the security processor combines the KEK and the first random number (WARP_IV) to encrypt at least the TEK to obtain the key encryption information, the additional information may also include the first random number. (WARP_IV); furthermore, after recovering the KEK, the security processor can decrypt the key encryption information based on the KEK and the first random number (WARP_IV) in the additional information to obtain the TEK.
在步骤S614中,安全处理器基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容。In step S614, the security processor decrypts the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine.
安全处理器在恢复出TEK后,可利用TEK对虚拟机快照中的加密快照内容进行解密,从而得到目标虚拟机的快照内容,实现读取目标虚拟机的虚拟机快照。在一些实施例中,安全处理器可直接基于TEK对加密快照内容进行解密,从而得到目标虚拟机的快照内容。在另一些实施例中,如果安全处理器是结合TEK和第一随机数(WARP_IV),对快照内容进行加密,从而得到加密快照内容,则安全处理器可基于恢复的TEK和附加信息中的第一随机数(WARP_IV),对加密快照内容进行解密,从而得到目标虚拟机的快照内容。After the security processor recovers the TEK, it can use the TEK to decrypt the encrypted snapshot content in the virtual machine snapshot, thereby obtaining the snapshot content of the target virtual machine and reading the virtual machine snapshot of the target virtual machine. In some embodiments, the security processor can directly decrypt the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine. In some other embodiments, if the security processor combines the TEK and the first random number (WARP_IV) to encrypt the snapshot content to obtain the encrypted snapshot content, the security processor may use the recovered TEK and the first random number in the additional information to obtain the encrypted snapshot content. A random number (WARP_IV) to decrypt the encrypted snapshot content to obtain the snapshot content of the target virtual machine.
在进一步的一些实施例中,安全处理器可将得到的目标虚拟机的快照内容传输给虚拟机平台,以便虚拟机平台利用快照内容,恢复目标虚拟机的状态。In some further embodiments, the security processor may transmit the obtained snapshot content of the target virtual machine to the virtual machine platform, so that the virtual machine platform uses the snapshot content to restore the state of the target virtual machine.
在一些实施例中,在提供密钥加密信息的完整性保护方案的基础上,本申请实施例可通过附加信息中的密钥完整性保护信息,检查密钥加密信息的完整性,进而在检查密钥加密信息完整的基础上,才对密钥加密信息进行解密。作为可选实现,图6b示出了本申请实施例提供的虚拟机快照读取方法的另一可选流程图,如图6b所示,该流程可以包括如下步骤。In some embodiments, on the basis of providing an integrity protection scheme for key encryption information, embodiments of the present application can check the integrity of the key encryption information through the key integrity protection information in the additional information, and then check the integrity of the key encryption information. Only when the key encryption information is complete can the key encryption information be decrypted. As an optional implementation, Figure 6b shows another optional flow chart of the virtual machine snapshot reading method provided by the embodiment of the present application. As shown in Figure 6b, the process may include the following steps.
在步骤S620中,安全处理器获取目标虚拟机的虚拟机快照以及附加信息,所述虚拟机快照包括加密快照内容和密钥加密信息,所述附加信息包括密钥完整性保护信息、密钥协商公钥信息、第一随机数。In step S620, the security processor obtains a virtual machine snapshot of the target virtual machine and additional information. The virtual machine snapshot includes encrypted snapshot content and key encryption information. The additional information includes key integrity protection information, key negotiation Public key information, first random number.
在一些实施例中,安全处理器可通过虚拟机平台获取目标虚拟机的虚拟机快照以及附加信息。可选的,附加信息可保存在所述虚拟机快照中。In some embodiments, the security processor may obtain a virtual machine snapshot of the target virtual machine and additional information through the virtual machine platform. Optionally, additional information can be saved in the virtual machine snapshot.
在步骤S621中,安全处理器基于密钥协商公钥信息和自身的密钥协商私钥信息,恢复KEK和KIK。In step S621, the security processor restores the KEK and KIK based on the key negotiation public key information and its own key negotiation private key information.
作为可选实现中,安全处理器可基于附加信息中的密钥协商公钥信息以及安全处理器自身的密钥协商私钥信息,使用密钥协商标准,确定公共密钥;基于所述公共密钥派生主密钥;基于所述主密钥派生KEK和KIK,从而实现恢复KEK和KIK。As an optional implementation, the security processor may use the key agreement standard to determine the public key based on the key agreement public key information in the additional information and the security processor's own key agreement private key information; based on the public key The master key is derived from the key; KEK and KIK are derived based on the master key, thereby realizing the recovery of KEK and KIK.
在步骤S622中,安全处理器基于KIK,计算所述密钥加密信息的HMAC,以得到重新计算的密钥完整性保护信息。In step S622, the security processor calculates the HMAC of the key encryption information based on the KIK to obtain recalculated key integrity protection information.
在步骤S623中,安全处理器比对重新计算的密钥完整性保护信息和附加信息中保存的密钥完整性保护信息。In step S623, the security processor compares the recalculated key integrity protection information with the key integrity protection information stored in the additional information.
在步骤S624中,安全处理器若确定比对结果一致,基于KEK和第一随机数对所述密钥加密信息进行解密,得到TEK。In step S624, if the security processor determines that the comparison results are consistent, it decrypts the key encryption information based on the KEK and the first random number to obtain the TEK.
在步骤S625中,安全处理器基于TEK和第一随机数对加密快照内容进行解密,得到目标虚拟机的快照内容。In step S625, the security processor decrypts the encrypted snapshot content based on the TEK and the first random number to obtain the snapshot content of the target virtual machine.
需要说明的是,在步骤S623进行比对后,如果安全处理器确定比对结果不一致,则安全处理器可确定密钥加密信息不完整,安全处理器可终止后续流程,即终止读取目标虚拟机的虚拟机快照。It should be noted that after the comparison in step S623, if the security processor determines that the comparison results are inconsistent, the security processor may determine that the key encryption information is incomplete, and the security processor may terminate the subsequent process, that is, terminate the reading of the target virtual machine. A virtual machine snapshot of the machine.
在一些实施例中,在提供目标虚拟机的策略信息的完整性保护方案的基础上,所述附加信息中还包括目标虚拟机的策略信息和策略完整性保护信息;安全处理器通过虚拟机平台或者自身获取到所述附加信息后,可对目标虚拟机的策略信息进行完整性检查,在检查目标虚拟机的策略信息完整的基础上,才对加密快照内容进行解密。In some embodiments, on the basis of providing an integrity protection solution for the policy information of the target virtual machine, the additional information also includes the policy information and policy integrity protection information of the target virtual machine; the security processor passes the virtual machine platform Or after obtaining the additional information, the policy information of the target virtual machine can be integrity checked, and the encrypted snapshot content can be decrypted only after checking that the policy information of the target virtual machine is complete.
在上述基础上,作为一种可选实现中,虚拟机快照中的密钥加密信息可以是对TIK与TEK整体进行加密而得到,从而安全处理器在对所述密钥加密信息进行解密后,可恢复出TEK和TIK;进而,安全处理器可利用TIK计算附加信息中的策略信息对应的HMAC,以得到重新计算的策略完整性保护信息。安全处理器将重新计算的策略完整性保护信息,与附加信息中的策略完整性保护信息进行比对;如果比对结果一致,则说明目标虚拟机的策略信息未更改,安全处理器可继续对加密快照内容进行解密,得到目标虚拟机的快照内容;如果比对结果不一致,则说明目标虚拟机的策略信息被改动,本申请实施例可终止后续流程,终止读取目标虚拟机的虚拟机快照。On the basis of the above, as an optional implementation, the key encryption information in the virtual machine snapshot can be obtained by encrypting the entire TIK and TEK, so that after the security processor decrypts the key encryption information, TEK and TIK can be recovered; furthermore, the security processor can use TIK to calculate the HMAC corresponding to the policy information in the additional information to obtain recalculated policy integrity protection information. The security processor compares the recalculated policy integrity protection information with the policy integrity protection information in the additional information; if the comparison results are consistent, it means that the policy information of the target virtual machine has not changed, and the security processor can continue to process the policy integrity protection information. Decrypt the encrypted snapshot content to obtain the snapshot content of the target virtual machine; if the comparison results are inconsistent, it means that the policy information of the target virtual machine has been changed. This embodiment of the application can terminate the subsequent process and terminate the reading of the virtual machine snapshot of the target virtual machine. .
在一些实施例中,在提供加密快照内容的完整性保护方案的基础上,所述附加信息中还包括加密快照完整性保护信息;安全处理器通过虚拟机平台或者自身获取到所述附加信息后,可对虚拟机快照中的加密快照内容进行完整性检查,在检查加密快照内容完整的基础上,才对加密快照内容进行解密。In some embodiments, on the basis of providing an integrity protection solution for encrypted snapshot content, the additional information also includes encrypted snapshot integrity protection information; after the security processor obtains the additional information through the virtual machine platform or itself , the encrypted snapshot content in the virtual machine snapshot can be integrity checked, and the encrypted snapshot content can be decrypted only after checking that the encrypted snapshot content is complete.
在上述基础上,作为一种可选实现中,安全处理器在恢复出TIK后,可使用TIK计算加密快照内容对应的HMAC,以得到重新计算的加密快照完整性保护信息。安全处理器将重新计算的加密快照完整性保护信息与附加信息中的加密快照完整性保护信息进行比对;如果比对结果一致,则安全处理器可确认加密快照内容完整,安全处理器可继续对加密快照内容进行解密,得到目标虚拟机的快照内容;如果比对结果不一致,则说明加密快照内容不完整,本申请实施例可终止后续流程,终止读取目标虚拟机的虚拟机快照。On the basis of the above, as an optional implementation, after the security processor recovers the TIK, it can use the TIK to calculate the HMAC corresponding to the encrypted snapshot content to obtain the recalculated integrity protection information of the encrypted snapshot. The security processor compares the recalculated integrity protection information of the encrypted snapshot with the integrity protection information of the encrypted snapshot in the additional information; if the comparison results are consistent, the security processor can confirm that the content of the encrypted snapshot is complete and the security processor can continue Decrypt the encrypted snapshot content to obtain the snapshot content of the target virtual machine; if the comparison results are inconsistent, it means that the encrypted snapshot content is incomplete. The embodiment of the present application can terminate the subsequent process and terminate the reading of the virtual machine snapshot of the target virtual machine.
在进一步的一些实施例中,虚拟机平台可先暂停运行中的目标虚拟机,再发起目标虚拟机的虚拟机快照读取,进而在本申请实施例完成虚拟机快照的读取,并且安全处理器销毁相关密钥(例如TEK、TIK、KEK和KIK)后,虚拟机平台可再恢复运行目标虚拟机。需要说明的是,读取虚拟机快照实质上是恢复虚拟机快照的快照内容,将虚拟机恢复到快照内容描述的虚拟机状态,因此本申请实施例在读取虚拟机快照完成后,再由虚拟机平台运行虚拟机实际上是加载数据到内存并实现恢复的过程。在此基础上,作为进一步的一些实施例,本申请实施例在读取到目标虚拟机的快照内容后,安全处理器可进一步利用目标虚拟机的VEK,对快照内容进行加密,以使得运行目标虚拟机时,保障从内存中加载的数据属于安全虚拟化技术要求的加密数据。In some further embodiments, the virtual machine platform can first pause the running target virtual machine, and then initiate reading of the virtual machine snapshot of the target virtual machine, and then complete the reading of the virtual machine snapshot in the embodiment of this application and process it safely. After the server destroys related keys (such as TEK, TIK, KEK, and KIK), the virtual machine platform can resume running the target virtual machine. It should be noted that reading a virtual machine snapshot is essentially restoring the snapshot content of the virtual machine snapshot and restoring the virtual machine to the virtual machine state described by the snapshot content. Therefore, in this embodiment of the application, after reading the virtual machine snapshot is completed, Running a virtual machine on a virtual machine platform is actually a process of loading data into memory and restoring it. On this basis, as some further embodiments, after reading the snapshot content of the target virtual machine, the security processor can further use the VEK of the target virtual machine to encrypt the snapshot content so that the target virtual machine can be run. When using a virtual machine, it is guaranteed that the data loaded from the memory is encrypted data required by secure virtualization technology.
在进一步的一些实施例中,虚拟机平台暂停运行中的目标虚拟机,发起目标虚拟机的快照内容读取之前,可解析、检查目标虚拟机的镜像文件头(Image Header),若镜像文件头(Image Header)包含快照头,则虚拟机平台可请求安全处理器将目标虚拟机与目标虚拟机的ASID(Address Space ID,地址空间标记)进行解绑。可以理解的是,镜像文件头(Image Header)包含快照头(即快照头不为空),则说明镜像文件头指示的快照头中存在虚拟机快照。ASID为虚拟机的地址空间标记,在启动虚拟机时,安全处理器可为虚拟机分配ASID;在常规的情况下,或者某些实现中,不同的虚拟机拥有不同的ASID。In some further embodiments, the virtual machine platform pauses the running target virtual machine, and before initiating reading of the snapshot content of the target virtual machine, the image file header (Image Header) of the target virtual machine can be parsed and checked. If the image file header (Image Header) contains the snapshot header, the virtual machine platform can request the security processor to unbind the target virtual machine from the ASID (Address Space ID, address space tag) of the target virtual machine. It can be understood that if the image file header (Image Header) contains a snapshot header (that is, the snapshot header is not empty), it means that there is a virtual machine snapshot in the snapshot header indicated by the image file header. ASID is the address space tag of the virtual machine. When starting the virtual machine, the security processor can assign an ASID to the virtual machine; under normal circumstances, or in some implementations, different virtual machines have different ASIDs.
本申请实施例在提供虚拟机快照的加密保存方案的基础上,还提供相应的虚拟机快照的读取方案,实现对虚拟机快照中加密快照内容的解密和读取,完善了安全虚拟化技术在虚拟机快照保存和读取场景下的应用。需要说明的是,虚拟机快照的读取方案实际上是基于虚拟机快照的保存方案进行适应性的实现,因此虚拟机快照读取方案与虚拟机快照保存方案相关的部分,可相互参照。On the basis of providing an encrypted storage solution for virtual machine snapshots, the embodiments of this application also provide a corresponding reading solution for virtual machine snapshots, realizing the decryption and reading of the encrypted snapshot content in the virtual machine snapshots, and improving the secure virtualization technology. Application in virtual machine snapshot saving and reading scenarios. It should be noted that the virtual machine snapshot reading scheme is actually an adaptive implementation based on the virtual machine snapshot saving scheme. Therefore, the parts related to the virtual machine snapshot reading scheme and the virtual machine snapshot saving scheme can be referred to each other.
上文描述了本申请实施例提供的多个实施例方案,各实施例方案介绍的各可选方式可在不冲突的情况下相互结合、交叉引用,从而延伸出多种可能的实施例方案,这些均可认为是本申请实施例披露、公开的实施例方案。The above describes multiple embodiment solutions provided by the embodiments of the present application. The optional methods introduced in each embodiment solution can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible embodiment solutions. These can be considered as embodiments disclosed and disclosed in the embodiments of this application.
本申请实施例还提供一种虚拟机快照保存装置,该装置可以认为是安全处理器为实现本申请实施例提供的虚拟机快照保存方法所需设置的功能模块。下文描述的装置内容可与上文描述的方法内容相互对应参照。Embodiments of the present application also provide a virtual machine snapshot saving device, which can be considered as a functional module required by the security processor to implement the virtual machine snapshot saving method provided by the embodiment of the present application. The device content described below may be mutually referenced with the method content described above.
作为一种可选实现中,图7示出了本申请实施例提供的虚拟机快照保存装置的可选框图。该装置可应用于安全处理器,例如应用于安全处理器的安全固件。如图7所示,该装置可以包括:As an optional implementation, FIG. 7 shows an optional block diagram of a virtual machine snapshot saving device provided by an embodiment of the present application. The device may be applied to a secure processor, such as secure firmware applied to a secure processor. As shown in Figure 7, the device may include:
密钥生成模块710,用于生成TEK,以及生成KEK;Key generation module 710, used to generate TEK and KEK;
加密模块711,用于基于KEK至少对TEK进行加密,得到密钥加密信息;以及,基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容;The encryption module 711 is configured to encrypt at least TEK based on KEK to obtain key encryption information; and encrypt the snapshot content of the target virtual machine based on TEK to obtain the encrypted snapshot content of the target virtual machine;
保存模块712,用于将所述密钥加密信息和加密快照内容保存在目标虚拟机的虚拟机快照中,所述虚拟机快照写入目标虚拟机的虚拟机镜像文件中。The saving module 712 is configured to save the key encryption information and the encrypted snapshot content in the virtual machine snapshot of the target virtual machine, and write the virtual machine snapshot into the virtual machine image file of the target virtual machine.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:保存明文的附加信息,所述附加信息包括如下至少一项信息:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further: save additional information of plain text , the additional information includes at least one of the following information:
密钥协商公钥信息,所述密钥协商公钥信息用于生成KEK;Key negotiation public key information, the key negotiation public key information is used to generate KEK;
对所述密钥加密信息进行完整性保护的密钥完整性保护信息;Key integrity protection information that integrity-protects the key encryption information;
对目标虚拟机的策略信息进行完整性保护的策略完整性保护信息;Policy integrity protection information that integrity protects the policy information of the target virtual machine;
对加密快照内容进行完整性保护的加密快照完整性保护信息。Encrypted snapshot integrity protection information that integrity-protects the contents of the encrypted snapshot.
在一些实施例中,密钥生成模块710,用于生成KEK包括:In some embodiments, the key generation module 710 for generating a KEK includes:
基于密钥协商信息,生成KEK;所述密钥协商信息包括密钥协商私钥信息以及密钥协商公钥信息。Based on the key agreement information, a KEK is generated; the key agreement information includes key agreement private key information and key agreement public key information.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:将所述密钥协商公钥信息保存在所述附加信息中。In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further: convert the key The negotiated public key information is stored in the additional information.
在一些实施例中,密钥生成模块710,用于基于密钥协商信息,生成KEK包括:In some embodiments, the key generation module 710 is used to generate a KEK based on the key agreement information, including:
基于密钥协商信息,使用密钥协商标准,确定公共密钥;Based on the key agreement information, use the key agreement standard to determine the public key;
基于所述公共密钥派生主密钥;deriving a master key based on the public key;
基于所述主密钥派生KEK。A KEK is derived based on the master key.
在一些实施例中,所述密钥协商私钥信息包括:安全处理器的安全证书私钥,和密钥协商标准的随机私钥;所述密钥协商公钥信息包括:安全处理器的安全证书公钥,和密钥协商标准的随机公钥。In some embodiments, the key agreement private key information includes: the security certificate private key of the security processor, and the random private key of the key agreement standard; the key agreement public key information includes: the security processor's security Certificate public key, and key agreement standard random public key.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further be used for:
生成KIK;Generate KIK;
基于KIK,计算所述密钥加密信息的HMAC,以得到密钥完整性保护信息;Based on KIK, calculate the HMAC of the key encryption information to obtain the key integrity protection information;
将所述密钥完整性保护信息保存在所述附加信息中。The key integrity protection information is stored in the additional information.
在一些实施例中,所述生成KIK包括:In some embodiments, generating KIK includes:
基于密钥协商信息,使用密钥协商标准,确定公共密钥;Based on the key agreement information, use the key agreement standard to determine the public key;
基于所述公共密钥派生主密钥;deriving a master key based on the public key;
基于所述主密钥派生KIK;其中,KIK与KEK的密钥类型不同。A KIK is derived based on the master key; where the key types of KIK and KEK are different.
在一些实施例中,密钥生成模块710,用于生成TEK包括:In some embodiments, the key generation module 710 for generating TEK includes:
通过硬件真随机数发生器,生成TEK。TEK is generated through a hardware true random number generator.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further be used for:
生成TIK;Generate TIK;
获取目标虚拟机的策略信息;Obtain the policy information of the target virtual machine;
基于TIK,计算目标虚拟机的策略信息的HMAC,以得到策略完整性保护信息;Based on TIK, calculate the HMAC of the policy information of the target virtual machine to obtain the policy integrity protection information;
将所述策略完整性保护信息,或者,所述策略完整性保护信息和所述策略信息,保存在所述附加信息中。The policy integrity protection information, or the policy integrity protection information and the policy information, are stored in the additional information.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further be used for:
生成TIK;Generate TIK;
使用TIK对加密快照内容进行完整性保护,得到加密快照完整性保护信息;Use TIK to protect the integrity of the encrypted snapshot content and obtain the integrity protection information of the encrypted snapshot;
将所述加密快照完整性保护信息保存在所述附加信息中。The encrypted snapshot integrity protection information is stored in the additional information.
可选的,所述生成TIK包括:Optionally, generating TIK includes:
通过硬件真随机数发生器,生成TIK;其中,TIK与TEK的密钥类型不同;所述密钥加密信息至少由KEK对TIK与TEK整体进行加密得到。TIK is generated through a hardware true random number generator; TIK and TEK have different key types; the key encryption information is at least obtained by encrypting the entirety of TIK and TEK with KEK.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图7所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 7, to further be used for:
将密钥协商过程生成的密钥摘要传输给虚拟机平台,以便虚拟机平台检查安全处理器的密钥协商过程是否成功;其中,在虚拟机平台检查安全处理器的密钥协商过程成功后,所述安全处理器执行所述基于TEK对目标虚拟机的快照内容进行加密,得到目标虚拟机的加密快照内容的步骤。Transmit the key digest generated by the key negotiation process to the virtual machine platform, so that the virtual machine platform can check whether the key negotiation process of the security processor is successful; wherein, after the virtual machine platform checks whether the key negotiation process of the security processor is successful, The security processor executes the step of encrypting the snapshot content of the target virtual machine based on TEK to obtain the encrypted snapshot content of the target virtual machine.
在进一步的一些实施例中,所述附加信息还包括:In some further embodiments, the additional information also includes:
硬件真随机数发生器生成的第一随机数;其中,所述第一随机数用于结合KEK,至少对TEK进行加密,以得到所述密钥加密信息;和/或,所述第一随机数用于结合TEK,对目标虚拟机的快照内容进行加密,以得到所述加密快照内容。The first random number generated by a hardware true random number generator; wherein the first random number is used to encrypt at least TEK in combination with KEK to obtain the key encryption information; and/or the first random number The number is used to encrypt the snapshot content of the target virtual machine in combination with TEK to obtain the encrypted snapshot content.
本申请实施例还提供一种虚拟机快照读取装置,该装置可以认为是安全处理器为实现本申请实施例提供的虚拟机快照读取方法所需设置的功能模块。下文描述的装置内容可与上文描述的方法内容相互对应参照。Embodiments of the present application also provide a virtual machine snapshot reading device, which can be considered as a functional module required by the security processor to implement the virtual machine snapshot reading method provided by the embodiment of the present application. The device content described below may be mutually referenced with the method content described above.
作为一种可选实现中,图8示出了本申请实施例提供的虚拟机快照读取装置的可选框图。该装置可应用于安全处理器,例如应用于安全处理器的安全固件。如图8所示,该装置可以包括:As an optional implementation, FIG. 8 shows an optional block diagram of a virtual machine snapshot reading device provided by an embodiment of the present application. The device may be applied to a secure processor, such as secure firmware applied to a secure processor. As shown in Figure 8, the device may include:
获取模块810,用于获取目标虚拟机的虚拟机快照,所述虚拟机快照包括加密快照内容和密钥加密信息;Obtaining module 810 is used to obtain a virtual machine snapshot of the target virtual machine, where the virtual machine snapshot includes encrypted snapshot content and key encryption information;
恢复模块811,用于恢复KEK;Recovery module 811, used to recover KEK;
密钥解密模块812,用于基于KEK对所述密钥加密信息进行解密,得到TEK;Key decryption module 812, used to decrypt the key encryption information based on KEK to obtain TEK;
快照解密模块813,用于基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容。The snapshot decryption module 813 is used to decrypt the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图8所示的一个或多个功能模块的基础上增加功能,以进一步用于:获取附加信息,所述附加信息包括如下至少一项信息:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 8, to further: obtain additional information, so The above additional information includes at least one of the following information:
密钥协商公钥信息,所述密钥协商公钥信息用于恢复KEK;Key negotiation public key information, which is used to restore the KEK;
对所述密钥加密信息进行完整性保护的密钥完整性保护信息;Key integrity protection information that integrity-protects the key encryption information;
对目标虚拟机的策略信息进行完整性保护的策略完整性保护信息;Policy integrity protection information that integrity protects the policy information of the target virtual machine;
对加密快照内容进行完整性保护的加密快照完整性保护信息。Encrypted snapshot integrity protection information that integrity-protects the contents of the encrypted snapshot.
在一些实施例中,恢复模块811,用于恢复KEK包括:In some embodiments, the recovery module 811 for recovering the KEK includes:
基于安全处理器的密钥协商私钥信息,以及所述附加信息中的密钥协商公钥信息,恢复KEK。The KEK is restored based on the key negotiation private key information of the security processor and the key negotiation public key information in the additional information.
在一些实施例中,所述密钥协商私钥信息包括:安全处理器的安全证书私钥,和密钥协商标准的随机私钥;所述密钥协商公钥信息包括:安全处理器的安全证书公钥,和密钥协商标准的随机公钥。In some embodiments, the key agreement private key information includes: the security certificate private key of the security processor, and the random private key of the key agreement standard; the key agreement public key information includes: the security processor's security Certificate public key, and key agreement standard random public key.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图8所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 8, to further be used for:
恢复KIK;Restore KIK;
基于KIK,计算所述密钥加密信息的HMAC,以得到重新计算的密钥完整性保护信息;Based on KIK, calculate the HMAC of the key encryption information to obtain recalculated key integrity protection information;
比对重新计算的密钥完整性保护信息和附加信息中保存的密钥完整性保护信息;Compare the recalculated key integrity protection information with the key integrity protection information stored in the additional information;
其中,若比对结果为一致,则安全处理器执行所述基于KEK对所述密钥加密信息进行解密,得到TEK的步骤;若比对结果不一致,则终止读取所述虚拟机快照。Wherein, if the comparison results are consistent, the security processor performs the step of decrypting the key encryption information based on the KEK to obtain the TEK; if the comparison results are inconsistent, the reading of the virtual machine snapshot is terminated.
在一些实施例中,恢复KIK包括:In some embodiments, restoring the KIK includes:
基于安全处理器的密钥协商私钥信息,以及所述附加信息中的密钥协商公钥信息,恢复KIK;KIK与KEK的密钥类型不同。Based on the key negotiation private key information of the security processor and the key negotiation public key information in the additional information, the KIK is restored; the key types of KIK and KEK are different.
在进一步的一些实施例中,所述附加信息还包括目标虚拟机的策略信息;该装置还可进一步设置一个或多个功能模块,或者在图8所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the additional information also includes policy information of the target virtual machine; the device can further set one or more functional modules, or based on one or more functional modules shown in Figure 8 Add functionality for further use in:
恢复TIK;Restore TIK;
基于TIK计算附加信息中的策略信息对应的HMAC,以得到重新计算的策略完整性保护信息;Calculate the HMAC corresponding to the policy information in the additional information based on TIK to obtain the recalculated policy integrity protection information;
将重新计算的策略完整性保护信息与附加信息中的策略完整性保护信息进行比对;Compare the recalculated policy integrity protection information with the policy integrity protection information in the additional information;
其中,若比对结果为一致,则安全处理器执行基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容的步骤;若比对结果不一致,则终止读取所述虚拟机快照。Among them, if the comparison results are consistent, the security processor performs the step of decrypting the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine; if the comparison results are inconsistent, the reading of the virtual machine snapshot is terminated. .
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图8所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 8, to further be used for:
恢复TIK;Restore TIK;
基于TIK计算加密快照内容对应的HMAC,以得到重新计算的加密快照完整性保护信息;Calculate the HMAC corresponding to the encrypted snapshot content based on TIK to obtain the recalculated integrity protection information of the encrypted snapshot;
将重新计算的加密快照完整性保护信息与附加信息中的加密快照完整性保护信息进行比对;Compare the recalculated integrity protection information of the encrypted snapshot with the integrity protection information of the encrypted snapshot in the additional information;
其中,若比对结果为一致,则安全处理器执行基于所述TEK对加密快照内容进行解密,得到目标虚拟机的快照内容的步骤;若比对结果不一致,则终止读取所述虚拟机快照。Among them, if the comparison results are consistent, the security processor performs the step of decrypting the encrypted snapshot content based on the TEK to obtain the snapshot content of the target virtual machine; if the comparison results are inconsistent, the reading of the virtual machine snapshot is terminated. .
在一些实施例中,恢复TIK包括:In some embodiments, restoring the TIK includes:
在基于KEK对所述密钥加密信息进行解密后,从解密结果中获取到TIK;其中,所述密钥加密信息至少由KEK对TIK与TEK整体进行加密得到。After the key encryption information is decrypted based on KEK, TIK is obtained from the decryption result; wherein the key encryption information is at least obtained by encrypting the entirety of TIK and TEK with KEK.
在进一步的一些实施例中,所述附加信息还包括:第一随机数;所述第一随机数用于结合KEK对所述密钥加密信息进行解密,和/或,所述第一随机数用于结合TEK对加密快照内容进行解密。In some further embodiments, the additional information also includes: a first random number; the first random number is used to decrypt the key encryption information in combination with KEK, and/or, the first random number Used to decrypt the encrypted snapshot content in conjunction with TEK.
在进一步的一些实施例中,该装置还可进一步设置一个或多个功能模块,或者在图8所示的一个或多个功能模块的基础上增加功能,以进一步用于:In some further embodiments, the device can further be provided with one or more functional modules, or add functions based on the one or more functional modules shown in Figure 8, to further be used for:
在虚拟机平台检查目标虚拟机的快照头不为空时,基于虚拟机平台的请求,将目标虚拟机与目标虚拟机的ASID进行解绑;When the virtual machine platform checks that the snapshot header of the target virtual machine is not empty, based on the request of the virtual machine platform, unbinds the target virtual machine from the ASID of the target virtual machine;
和/或,在得到目标虚拟机的快照内容之后,利用目标虚拟机的VEK,对快照内容进行加密。And/or, after obtaining the snapshot content of the target virtual machine, use the VEK of the target virtual machine to encrypt the snapshot content.
本申请实施例还提供一种安全处理器,该安全处理器(例如安全处理器中的安全固件)可通过装载上述所述的虚拟机快照保存装置,以实现执行本申请实施例提供的虚拟机快照保存方法;该安全处理器(例如安全处理器中的安全固件)可通过装载上述所述的虚拟机快照读取装置,以实现执行本申请实施例提供的虚拟机快照读取方法。在本申请实施例中,该安全处理器可以被配置为执行本申请实施例提供的由安全处理器执行的虚拟机快照保存方法,和虚拟机快照读取方法。Embodiments of the present application also provide a security processor. The security processor (for example, security firmware in the security processor) can execute the virtual machine provided by the embodiments of the present application by loading the above-mentioned virtual machine snapshot saving device. Snapshot saving method: The security processor (for example, the security firmware in the security processor) can implement the virtual machine snapshot reading method provided by the embodiment of the present application by loading the above-mentioned virtual machine snapshot reading device. In this embodiment of the present application, the security processor may be configured to execute the virtual machine snapshot saving method and the virtual machine snapshot reading method performed by the security processor provided in the embodiment of the present application.
本申请实施例还提供一种电子设备(例如物理主机),该电子设备的结构可结合图1b所示,包括上述提供的安全处理器。An embodiment of the present application also provides an electronic device (such as a physical host). The structure of the electronic device can be shown in conjunction with FIG. 1b and includes the security processor provided above.
虽然本申请实施例披露如上,但本申请并非限定于此。任何本领域技术人员,在不脱离本申请的精神和范围内,均可作各种更动与修改,因此本申请的保护范围应当以权利要求所限定的范围为准。Although the embodiments of the present application are disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope defined by the claims.
Claims (27)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110694868.6A CN113342467B (en) | 2021-06-22 | 2021-06-22 | Virtual machine snapshot saving, reading methods, devices and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110694868.6A CN113342467B (en) | 2021-06-22 | 2021-06-22 | Virtual machine snapshot saving, reading methods, devices and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113342467A CN113342467A (en) | 2021-09-03 |
CN113342467B true CN113342467B (en) | 2023-12-05 |
Family
ID=77477638
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110694868.6A Active CN113342467B (en) | 2021-06-22 | 2021-06-22 | Virtual machine snapshot saving, reading methods, devices and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113342467B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103609059A (en) * | 2010-09-20 | 2014-02-26 | 安全第一公司 | Systems and methods for secure data sharing |
US9830278B1 (en) * | 2008-03-06 | 2017-11-28 | EMC IP Holding Company LLC | Tracking replica data using key management |
CN109150899A (en) * | 2018-09-18 | 2019-01-04 | 江苏恒宝智能系统技术有限公司 | A kind of Internet of Things method of mobile communication and system |
CN112800439A (en) * | 2020-12-02 | 2021-05-14 | 中国电子科技集团公司第三十研究所 | Key management protocol design method and system for secure storage |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9953168B1 (en) * | 2017-06-26 | 2018-04-24 | Bracket Computing, Inc. | Secure boot of virtualized computing instances |
US10756888B2 (en) * | 2017-11-20 | 2020-08-25 | Rubrik, Inc. | Managing key encryption keys using a key wrapping tree |
-
2021
- 2021-06-22 CN CN202110694868.6A patent/CN113342467B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9830278B1 (en) * | 2008-03-06 | 2017-11-28 | EMC IP Holding Company LLC | Tracking replica data using key management |
CN103609059A (en) * | 2010-09-20 | 2014-02-26 | 安全第一公司 | Systems and methods for secure data sharing |
CN109150899A (en) * | 2018-09-18 | 2019-01-04 | 江苏恒宝智能系统技术有限公司 | A kind of Internet of Things method of mobile communication and system |
CN112800439A (en) * | 2020-12-02 | 2021-05-14 | 中国电子科技集团公司第三十研究所 | Key management protocol design method and system for secure storage |
Also Published As
Publication number | Publication date |
---|---|
CN113342467A (en) | 2021-09-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11469885B2 (en) | Remote grant of access to locked data storage device | |
CN109858265B (en) | Encryption method, device and related equipment | |
JP5362114B2 (en) | Secure USB storage medium generation and decoding method, and medium on which a program for generating a secure USB storage medium is recorded | |
AU2012204448B2 (en) | System and method for in-place encryption | |
US11606206B2 (en) | Recovery key for unlocking a data storage device | |
US11088832B2 (en) | Secure logging of data storage device events | |
US11366933B2 (en) | Multi-device unlocking of a data storage device | |
US11831752B2 (en) | Initializing a data storage device with a manager device | |
US11334677B2 (en) | Multi-role unlocking of a data storage device | |
US11556665B2 (en) | Unlocking a data storage device | |
CN111460455B (en) | Key negotiation method, safety guiding method and system for self-encryption solid state disk | |
AU2012204448A1 (en) | System and method for in-place encryption | |
TW200405963A (en) | Sleep protection | |
US11265152B2 (en) | Enrolment of pre-authorized device | |
CN108108631A (en) | Root key processing method and related device | |
CN108804203A (en) | VTPM private information guard methods based on label | |
CN113342467B (en) | Virtual machine snapshot saving, reading methods, devices and related equipment | |
CN107563228A (en) | A kind of method of internal storage data encryption and decryption | |
JP2008147946A (en) | Authentication method, authentication system, and external recording medium | |
CN116502291B (en) | Data security storage equipment and data storage method based on three-dimensional heterogeneous integration | |
KR101765209B1 (en) | Apparatus and method for safe booting | |
CN117786729A (en) | A chip key management method and system | |
CN113343265A (en) | Key configuration method, device and related equipment | |
JP2001044985A (en) | Cryptographic key storage system for communication equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |