Data storage method and system, electronic equipment and storage medium

Through the public and private key mechanism between the virtual machine and the virtual function, the secure working mode is turned on and digital signature verification is performed, which solves the problem of low data security after the virtual function is mounted and achieves effective protection of the virtual function data.

CN118535279APending Publication Date: 2024-08-23INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410525107.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

On solid-state drives that support single-root input and output virtualization, virtual functions are easily tampered with and stolen after being mounted to a new virtual machine, resulting in low data security.

Method used

By using the public and private key mechanism between the virtual machine and the virtual function, the safe working mode is turned on and digital signature verification is performed to verify whether the virtual machine is a virtual machine with the safe working mode turned on, ensuring that only legal virtual machines can access the virtual functions. data.

Benefits of technology

This effectively prevents other virtual machines from stealing or tampering with data on virtual functions, and improves the security of data stored on virtual functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535279A
    Figure CN118535279A
Patent Text Reader

Abstract

The embodiment of the invention discloses a data storage method and system, electronic equipment and a storage medium, relates to the technical field of computers, and can improve the security of data stored on a virtual function. The method comprises the following steps: receiving a first command which is sent by a first virtual machine and carries a first public key, wherein the virtual function is mounted on the first virtual machine; starting a safe working mode of the virtual function, and sending a second public key to the first virtual machine; receiving first encrypted data and first signature data sent by a second virtual machine, wherein the virtual function is mounted on the second virtual machine; according to the first encrypted data and the first public key, performing signature verification operation on the first signature data to verify whether the second virtual machine is the first virtual machine; and under the condition that the second virtual machine is verified to be the first virtual machine, responding to data storage related access operation initiated by the second virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data storage method, system, electronic device, and storage medium. Background Technology

[0002] A solid state disk (SSD) that supports single-root input / output virtualization (SR-IOV) can create multiple virtual functions (VFs). These VFs can be assigned to different virtual machines for mounting, allowing the virtual machines to store data on the VFs they are mounted on.

[0003] However, after VF is mounted to a new virtual machine, the new virtual machine can perform read and write operations on the data written by the previously mounted virtual machine on VF, making the data stored on VF easy to be tampered with and stolen, resulting in low security. Summary of the Invention

[0004] The purpose of this application is to provide a data storage method, system, electronic device, and storage medium that can improve the security of data stored on virtual functions.

[0005] To address the aforementioned technical problems, in a first aspect, embodiments of this application provide a data storage method applied to a virtual function, wherein the virtual function is created on a solid-state drive supporting single-root input / output virtualization, the method comprising:

[0006] Receive a first command carrying a first public key sent by a first virtual machine, wherein the virtual function is mounted on the first virtual machine;

[0007] Enable the secure working mode of the virtual function and send the second public key to the first virtual machine;

[0008] The virtual function receives first encrypted data and first signature data sent by the second virtual machine, and the virtual function is mounted on the second virtual machine.

[0009] Based on the first encrypted data and the first public key, a signature verification operation is performed on the first signature data to verify whether the second virtual machine is the first virtual machine;

[0010] If the second virtual machine is verified to be the first virtual machine, respond to the data storage related access operations initiated by the second virtual machine.

[0011] Secondly, this application also provides a data storage method applied to a virtual machine with virtualization functionality, wherein the virtualization functionality is created on a solid-state drive that supports single-root input / output virtualization, the method comprising:

[0012] Send a first command carrying a first public key to the virtual function, the first command being used to enable the secure working mode of the virtual function;

[0013] Receive the second public key sent by the virtual function;

[0014] Before initiating data storage-related access operations on the virtual function, first encrypted data is generated based on the second public key;

[0015] The first encrypted data is signed using the first private key matched with the first public key to obtain the first signed data.

[0016] The first encrypted data and the first signature data are sent to the virtual function so that the virtual function can verify whether the virtual machine has enabled the secure working mode of the virtual function. If it is verified that the virtual machine has enabled the secure working mode of the virtual function, the virtual function responds to the data storage related access operation initiated by the virtual machine.

[0017] Thirdly, embodiments of this application also provide a data storage system, including a virtual machine and virtual functions mounted on the virtual machine, wherein the virtual functions are created on a solid-state drive that supports single-root input / output virtualization, wherein:

[0018] The virtual machine is used to send a first command carrying a first public key to the virtual function;

[0019] The virtual function is configured to, in response to receiving the first command carrying the first public key, enable the secure working mode of the virtual function and send the second public key to the virtual machine;

[0020] The virtual machine is also used to generate first encrypted data based on the second public key before initiating data storage-related access operations on the virtual function;

[0021] The virtual machine is further configured to use the first private key matched by the first public key to sign the first encrypted data, thereby obtaining first signed data;

[0022] The virtual machine is also used to send the first encrypted data and the first signature data to the virtual function;

[0023] The virtual function is also used to perform a signature verification operation on the first signature data based on the first encrypted data and the first public key, so as to verify whether the virtual machine has enabled the secure working mode of the virtual function.

[0024] The virtual function is also used to respond to data storage related access operations initiated by the virtual machine when it is verified that the virtual machine has enabled the secure working mode of the virtual function.

[0025] Fourthly, embodiments of this application also provide an electronic device, including a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the data storage method as described in the first or second aspect.

[0026] Fifthly, embodiments of this application also provide a computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implements the data storage method as described in the first or second aspect.

[0027] In a sixth aspect, embodiments of this application also provide a computer program product, including a computer program / instructions that, when executed by a processor, implement the data storage method as described in the first or second aspect.

[0028] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function. Attached Figure Description

[0029] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a flowchart illustrating an implementation of a data storage method provided in an embodiment of this application.

[0031] Figure 2This is a schematic diagram illustrating the process of enabling a secure working mode, as provided in an embodiment of this application.

[0032] Figure 3 A schematic diagram illustrating an implementation process for secure data transmission provided in an embodiment of this application;

[0033] Figure 4 A flowchart illustrating another data storage method provided in this application embodiment;

[0034] Figure 5 This is a schematic diagram of the structure of a data storage system provided in an embodiment of this application;

[0035] Figure 6 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application;

[0036] Figure 7 A schematic diagram of another data storage device provided in an embodiment of this application;

[0037] Figure 8 A schematic diagram of an electronic device provided in an embodiment of this application;

[0038] Figure 9 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0039] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0040] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.

[0041] With the development of technologies such as the Internet and cloud computing, solid-state drives (SSDs) based on flash memory have been widely used due to their advantages such as high performance, low power consumption, and small size. Furthermore, with the advent of the Artificial Intelligence (AI) era, how to achieve energy conservation and efficiency improvement in cloud data centers has become a hot topic. SR-IOV technology, with its high flexibility and ability to save computing power for virtualization services, has become one of the important solutions for building green and low-carbon cloud data centers.

[0042] SR-IOV is a hardware-based virtualization solution that utilizes the properties of Physical Functions (PF) and Virtual Functions (VF) to virtualize multiple high-speed Peripheral Component Interconnect Express (PCIe) devices from a single device. This benefits virtual machine operation, significantly reducing the load on the host machine's Central Processing Unit (CPU) and improving performance and scalability. It can also help the system address the Quality of Service (QoS) issues associated with the SSDs of virtual machines, thereby supporting a larger number of virtual machine services.

[0043] A solid-state drive (SSD) supporting SR-IOV can create multiple virtual machines (VFs) and assign them to different virtual machines (VMs). Each VM can mount one VF, and the VM can perform read and write operations on the VF it is mounted to. However, after a VF is mounted to a new VM, the new VM can also read and write data written by the VM that was previously mounted on the VF. This makes the data stored on the VF vulnerable to tampering and theft, resulting in low security.

[0044] For example, after virtual machine 1 mounts VF1, it can store data on VF1. However, after virtual machine 1 is shut down, virtual machine 2 can also mount VF1, thereby performing read and write operations on the data stored on VF1 (including the data written by virtual machine 1), resulting in low security of the data stored on VF1.

[0045] To address the problems existing in the aforementioned related technologies, this application proposes a data storage scheme that allows virtual machines to configure whether a secure working mode is enabled for their virtual functions. When a virtual function with a secure working mode enabled is enabled, it will use digital signature verification to verify whether the virtual machine is the one that has enabled its own secure working mode (i.e., this virtual machine). Only after verifying that the virtual machine is this virtual machine will the virtual machine be allowed to access the data stored in the virtual function. This can ensure the security of the data stored by this virtual machine in the virtual function and prevent the stored data from being stolen or tampered with by other virtual machines.

[0046] The following description, in conjunction with the accompanying drawings, details a data storage method, system, electronic device, and storage medium provided in this application through some embodiments and application scenarios.

[0047] Firstly, see [the following] Figure 1The diagram shown is an implementation flowchart of a data storage method provided in this application embodiment. This data storage method is applied to a virtual function, which is created on a solid-state drive that supports single-root input / output virtualization. The method may include the following steps:

[0048] Step S101: Receive a first command carrying a first public key sent by a first virtual machine, wherein the virtual function is mounted on the first virtual machine.

[0049] In specific implementation, refer to, for example Figure 2 The diagram illustrates the process of enabling the secure working mode. The first virtual machine generates a public-private key pair. The public key virt_pubKey (i.e., the first public key) is sent to the VF mounted on the first virtual machine via a first command. The private key virt_priKey is saved as the first private key matched by the first public key to ensure that it is not obtained by other virtual machines and virtual functions.

[0050] It should be noted that the virtual machine and the virtual function can send and receive the first command and other data through shared memory, shared file system or network communication. This application embodiment does not impose specific restrictions on the data transmission method between the virtual machine and the virtual function.

[0051] Step S102: Enable the secure working mode of the virtual function and send the second public key to the first virtual machine.

[0052] In practical implementation, the virtual function can determine whether it has received the first command based on whether the received data contains a specific bit sequence. If the first command is received, the virtual function saves the first public key carried in the first command, enables the secure operating mode, and generates a public-private key pair. The public key ssd_pubKey (i.e., the second public key) is sent to the first virtual machine for subsequent security verification (i.e., verifying whether it is the virtual machine in the secure operating mode with the virtual function enabled). The private key ssd_priKey is saved as the second private key matched with the second public key, ensuring it cannot be obtained by other virtual functions or virtual machines.

[0053] Step S103: Receive the first encrypted data and the first signature data sent by the second virtual machine, wherein the virtual function is mounted on the second virtual machine.

[0054] In practical implementation, the virtual machine (i.e., the second virtual machine) can be configured to send the first encrypted data and the first signature data to the virtual function it is currently attached to before each data storage-related access operation, so that the virtual function can perform security verification on the virtual machine; alternatively, the virtual machine can be configured to periodically send the first encrypted data and the first signature data to the virtual function, so that the virtual function can periodically perform security verification on the virtual machine; alternatively, newly attached virtual machines (including previously attached and unattached virtual machines) can be configured to send the first encrypted data and the first signature data to the virtual function once. If the virtual machine fails and restarts, and the original virtual function is restored, it needs to resend the first encrypted data and the first signature data to the virtual function so that the virtual function can perform security verification on the virtual machine again.

[0055] Step S104: Perform a signature verification operation on the first signature data based on the first encrypted data and the first public key to verify whether the second virtual machine is the first virtual machine.

[0056] It should be noted that the signing operation is used to calculate and transform the message using the signer's private key to obtain the signed data; the verification operation is used to verify whether the signed data was signed by the signer using the public key matched with the signer's private key.

[0057] In practice, the second virtual machine needs to sign the first encrypted data using the specified private key (i.e., the first private key) to generate the first signed data. The virtual function verifies the first signed data based on the first encrypted data and the first public key. If the signature is correct, it means that the second virtual machine has the first private key. Thus, it can be determined that the second virtual machine is the same virtual machine (i.e., the first virtual machine) that has enabled the secure working mode of the virtual function.

[0058] In this embodiment, VF uses digital signature verification to perform security verification on the virtual machine. This digital signature verification method is based on the public and private key mechanism of the virtual machine. Since other virtual machines have difficulty obtaining the private key of this virtual machine (i.e., the first virtual machine), the reliability of security verification can be greatly improved, thereby ensuring the security of the data stored on the virtual function.

[0059] Step S105: If it is verified that the second virtual machine is the first virtual machine, respond to the data storage related access operation initiated by the second virtual machine.

[0060] In practice, the virtualization function performs security verification on the mounted virtual machine and only responds to data storage-related read and write access operations initiated by this virtual machine. Data storage-related read and write access operations initiated by other virtual machines can be ignored or directly reported as errors or alarms to prevent other virtual machines from stealing or tampering with the data written by this virtual machine.

[0061] As one possible implementation, if it is verified that the second virtual machine is not the first virtual machine, the system does not respond to data storage-related access operations initiated by the second virtual machine, and directly returns a preset error message to the second virtual machine.

[0062] In practical implementation, after the virtual function is enabled in secure working mode, it directly returns a preset error message, such as a preset error code, to data storage-related access operations initiated by other virtual machines besides the first virtual machine, thereby preventing other virtual machines from making incorrect or malicious access to the virtual function.

[0063] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function.

[0064] As one possible implementation, the method further includes:

[0065] Receive a second command sent by the second virtual machine, wherein the second command is a command to delete or format the namespace bound to the virtual function;

[0066] If it is verified that the second virtual machine is the first virtual machine, the namespace bound to the virtual function is deleted or formatted.

[0067] If it is verified that the second virtual machine is not the first virtual machine, the namespace bound to the virtual function is not deleted or formatted.

[0068] It should be noted that namespaces refer to a segment of logical block address (LBA) space in a Non-Volatile Memory Host Controller Interface (NVMe) device.

[0069] In practical implementation, after the virtual function enables the secure working mode, it responds to the second command sent by the virtual machine that has enabled the secure working mode (when the second virtual machine is the first virtual machine). It ignores or directly reports errors or alarms for the second commands sent by other virtual machines mounted by the virtual function (when the second virtual machine is not the first virtual machine). This can prevent other mounted virtual machines from arbitrarily deleting the namespace bound to the virtual function, which could lead to data loss, and ensure data security.

[0070] As one possible implementation, enabling the secure operating mode of the virtual function includes:

[0071] In the first storage area, the working mode representation value corresponding to the virtual function is set as the target representation value;

[0072] The first storage area is a storage area that supports access to various virtual functions created on the solid-state drive and the physical function that manages the various virtual functions. The first storage area is used to prevent the physical function from deleting or formatting the namespaces bound to the virtual functions that have enabled the safe working mode when executing the third command. The third command is a command to delete or format the namespaces bound to all virtual functions or a command to specify the namespaces bound to a virtual function.

[0073] It should be noted that a PF is a standard PCIe device that can be associated with one or more VFs. A PF shares one or more physical resources (such as links) with its associated VFs, and the PF has management permissions for the namespaces bound to its associated VFs by default, such as being able to delete or format the namespaces bound to the VFs.

[0074] In practice, an array can be pre-established, where each element represents the working mode of a virtual function. The array is initialized (e.g., to 0) and written to the first storage area. Upon receiving the first command, the virtual function accesses the first storage area to modify its corresponding element in the array to the target representation value (e.g., 1), thereby enabling its own secure working mode.

[0075] When the PF associated with a virtual function executes the third command, it will first access the first storage area. Specifically, when executing the command to format or delete the namespaces bound to all virtual functions, the PF will first access the first storage area and query whether the value of each element in the array is the target representation value, so as to poll whether each virtual function has enabled the safe working mode, and will not delete or format the namespaces bound to the virtual functions that have been enabled.

[0076] When executing a command to format or delete a namespace bound to a specific virtual function, PF first accesses the first storage area and queries whether the element value corresponding to the specific virtual function in the array is the target representation value to determine whether the specific virtual function has enabled safe working mode. If the specific virtual function has enabled safe working mode, the namespace bound to the specific virtual function will not be deleted or formatted.

[0077] In this embodiment, the present application restricts the management permissions of PF by setting a first storage area, so that after the virtual function is enabled in secure working mode, PF does not have the permission to delete or format the namespace bound to the virtual function, thereby ensuring data security.

[0078] As one possible implementation, if the second virtual machine is verified to be the first virtual machine, responding to data storage-related access operations initiated by the second virtual machine includes:

[0079] If the second virtual machine is verified to be the first virtual machine, the first encrypted data is decrypted using the second private key matched with the second public key to obtain the first symmetric key;

[0080] The system responds to data storage-related access operations initiated by the second virtual machine based on the first symmetric key.

[0081] The second public key and the second private key that the second public key matches are a public-private key pair generated when the solid-state drive leaves the factory.

[0082] In practice, the virtualization function directly uses the public-private key pair generated internally by the solid-state drive at the factory as the second public and second private key to improve processing efficiency. (See example...) Figure 3The diagram illustrates the secure data transmission process. The first virtual machine generates a symmetric key, `virt_transportKey` (i.e., the first symmetric key). This first symmetric key is encrypted using the second public key returned by the virtual function, yielding the first encrypted data, `key_encData`, used in security verification. After security verification, the virtual function decrypts the first encrypted data using the second private key, obtaining the first symmetric key. The virtual function can then use this first symmetric key to perform data storage encryption / decryption or transmission encryption / decryption operations to respond to data storage-related access operations initiated by the second virtual machine.

[0083] It should be noted that in the default mode, any virtual machine can mount any virtual function (VF), and the virtual machine's read and write operations on the VF are all in plaintext, and the VF also stores data in plaintext, which affects data security. To solve this problem, this implementation allows the virtual machine to enable a secure working mode for the VF it mounts, enabling the VF to store or transmit data in encrypted form, thereby further ensuring data security. Furthermore, using the first symmetric key on which the access operations related to data storage are based to generate the first encrypted data required for security verification reduces the number of data transfers between the virtual machine and the virtual function, ensuring processing efficiency.

[0084] In one embodiment, such as Figure 3 As shown, before initiating a read / write operation, the virtual machine generates a random number and uses this random number as the aforementioned symmetric key virt_transportKey for subsequent encryption and decryption of data related to the read / write operation.

[0085] The virtual machine (VM) can use the second public key, `ssd_pubKey`, returned by the virtual function to encrypt the symmetric key `virt_transportKey`, obtaining the first encrypted data `key_encData`. The VM then uses the previously generated first private key, `virt_priKey`, to perform a signature operation (such as generating a hash value) on the first encrypted data `key_encData`, obtaining the signature data `sign_data`. The VM sends the first encrypted data `key_encData` and the signature data `sign_data` to the Virtual Function (VF) for security verification and to retrieve the symmetric key `virt_transportKey`.

[0086] Specifically, after receiving the first encrypted data key_encData and the signature data sign_data sent by the virtual machine, VF uses the first public key virt_pubKey previously sent by the virtual machine to verify the signature data sign_data. Since only data signed with the specified private key (first private key virt_priKey) of a virtual machine that has set its secure working mode can be successfully verified using the first public key virt_pubKey, if the verification fails, VF can determine that this is not a virtual machine that has set its secure working mode, and VF will return an error for all subsequent read and write operation commands initiated by the virtual machine. If the verification passes, it means that this is a virtual machine that has set its secure working mode, and VF uses the second private key ssd_priKey to decrypt the first encrypted data key_encData to obtain virt_transportKey.

[0087] As one possible implementation, after receiving the first command, the method further includes:

[0088] Generate a second symmetric key, and determine the symmetric key generated when the solid-state drive leaves the factory as the third symmetric key;

[0089] The second symmetric key is encrypted using the third symmetric key, and the encrypted second symmetric key is saved to the second storage area, which is a non-volatile storage area that is not cleared by the controller-level reset operation;

[0090] The data storage-related access operations include write operations; responding to data storage-related access operations initiated by the second virtual machine based on the first symmetric key includes:

[0091] Receive a write command carrying second encrypted data sent by the second virtual machine;

[0092] The first symmetric key is used to decrypt the second encrypted data to obtain the data to be written to the virtual function;

[0093] If the virtual function has performed a controller-level reset operation, the encrypted second symmetric key is read from the second storage area and decrypted using the third symmetric key to obtain the second symmetric key.

[0094] If the virtual function does not perform a controller-level reset operation, the second symmetric key is read from the third storage area. The second symmetric key is a second symmetric key that has been encrypted in the second storage area before being decrypted and saved to the third storage area. The third storage area is a storage area that will be cleared by the controller-level reset operation.

[0095] The data to be written to the virtual function is encrypted using the second symmetric key to obtain the third encrypted data;

[0096] The third encrypted data is written to the storage area corresponding to the virtual function.

[0097] In practical implementation, a portion of the persistent storage space on the solid-state drive, such as non-volatile flash memory (NOR Flash), which is not cleared by controller-level reset operations (i.e., a specific non-volatile storage area), can be set as the second storage area corresponding to the virtual function.

[0098] like Figure 3 As shown, after receiving the first command, the virtual function internally generates a symmetric key vf_key (i.e., the second symmetric key). To ensure the security of the second symmetric key, the symmetric key ssd_key generated when the solid-state drive leaves the factory is determined as the third symmetric key, and the second symmetric key is encrypted using the third symmetric key. Subsequently, the encrypted second symmetric key, the first symmetric key, and the first public key can be saved to the second storage area for subsequent reading and use.

[0099] The first virtual machine uses the first symmetric key returned by the virtual function to encrypt the data to be written to the virtual function, obtaining the second encrypted data, and sends the write command carrying the second encrypted data to the virtual function to ensure the secure transmission of the data to be written.

[0100] When a virtual function responds to a write operation initiated by the first virtual machine, it uses the first symmetric key to decrypt the second encrypted data carried in the write command, obtaining the data to be written to the virtual function. Subsequently, depending on whether the virtual function has performed a controller-level reset operation, it selects a second or third storage region to obtain the second symmetric key.

[0101] Specifically, the virtual function reads the encrypted second symmetric key from the second storage area and decrypts it using the third symmetric key. After obtaining the second symmetric key, it can be saved to the third storage area, from which it can be directly read later. After the virtual function performs a controller-level reset, the second symmetric key in the third storage area will be cleared. In this case, the above steps need to be repeated to obtain the second symmetric key again based on the second storage area and save it back to the third storage area.

[0102] After obtaining the second symmetric key, the virtual function uses the second symmetric key to encrypt the data to be written to the virtual function, obtains the third encrypted data, and writes the third encrypted data to the storage area corresponding to the virtual function, thereby ensuring the secure storage of the data to be written.

[0103] In this embodiment, by setting up a second storage area and a third storage area, this application achieves a balance between key storage security and key acquisition efficiency.

[0104] In one embodiment, such as Figure 3 As shown, when the virtual machine initiates a write operation, it calculates the Cyclic Redundancy Check (CRC) value CRC1 for the data to be written and appends it to the data to be written, data1, to form {data1, CRC1}.

[0105] The virtual machine uses the first symmetric key virt_transportKey to encrypt {data1, CRC1} to obtain the second encrypted data write_enc_data, and then sends it to VF.

[0106] When responding to a write operation initiated by the virtual machine, VF uses the first symmetric key virt_transportKey obtained through pre-decryption to decrypt the second encrypted data write_enc_data, resulting in {data1, CRC1}.

[0107] VF checks if CRC1 is correct. If CRC1 is incorrect, it indicates an error in decrypting the second encrypted data, and VF reports an error. If CRC1 is correct, it indicates successful decryption of the second encrypted data. VF then reads the encrypted second symmetric key vf_key from the non-volatile storage area of ​​the solid-state drive and decrypts it using the third symmetric key ssd_key to obtain the plaintext key (i.e., the second symmetric key vf_key). It then uses the second symmetric key vf_key to encrypt the data data1 to be written and writes the encrypted data to the specified storage area.

[0108] As one possible implementation, the data storage-related access operations include read operations;

[0109] Responding to data storage-related access operations initiated by the second virtual machine based on the first symmetric key includes:

[0110] Receive a read command sent by the virtual function, which carries the address of the target storage area, wherein the target storage area address is used to indicate the storage area address where the data to be read by the virtual function is located;

[0111] Data is read based on the target storage area address to obtain the data required by the virtual function.

[0112] Calculate the cyclic redundancy check value for the data to be read by the virtual function;

[0113] The data that the virtual function needs to read, and the cyclic redundancy check value corresponding to the data that the virtual function needs to read, are encrypted using the first symmetric key to obtain the fourth encrypted data;

[0114] The fourth encrypted data is sent to the second virtual machine.

[0115] In specific implementation, such as Figure 3 As shown, the virtual function responds to the read operation initiated by the first virtual machine, reading data from the target storage area address. If the read data is encrypted with the second symmetric key vf_key, it is first decrypted using the second symmetric key to obtain the data to be read by the virtual function. Subsequently, the virtual function calculates the CRC value of the data to be read, and encrypts the data combination {data2, CRC2} consisting of the data to be read data2 and its corresponding cyclic redundancy check value CRC2 using the first symmetric key virt_transportKey to obtain the fourth encrypted data, which is then returned to the first virtual machine. For the second symmetric key vf_key used for encryption, if the corresponding plaintext key has already been obtained, it is not necessary to repeat the decryption to obtain the plaintext key.

[0116] After receiving the fourth encrypted data from the virtual function, the first virtual machine decrypts the fourth encrypted data using the first symmetric key virt_transportKey to obtain the above data combination. It then performs a cyclic redundancy check on the data to be read in the data combination based on the CRC value in the data combination. If the check passes, it means that the data decryption is correct, and the first virtual machine then uses the data to be read in the data combination normally. If the check fails, it means that the data decryption is incorrect, and the first virtual machine can report an error or re-initiate the read operation.

[0117] Understandably, for VF with its secure operating mode enabled, setting CRC value verification and encrypted transmission methods for data transmission between it and the virtual machine can ensure data integrity and security.

[0118] As one possible implementation, data is read based on the target storage area address to obtain the data required by the virtual function, including:

[0119] Read the second symmetric key from the fourth storage area, the second symmetric key being pre-written into the fourth storage area;

[0120] Using the second symmetric key, the data read from the target storage area address is decrypted to obtain the data required by the virtual function.

[0121] In practice, the fourth storage area can be a non-volatile storage area that is not cleared by a controller-level reset operation, or it can be a storage area that is cleared by a controller-level reset operation.

[0122] After obtaining the second symmetric key, the virtual function can read the encrypted second symmetric key from the second storage area and decrypt it using the third symmetric key. After obtaining the second symmetric key, it can save it to the fourth storage area. Subsequently, the second symmetric key can be directly read from the fourth storage area to perform operations such as decrypting the read data or encrypting the data to be written, thereby improving processing efficiency.

[0123] As one possible implementation, the method further includes:

[0124] The system receives a fourth command carrying second signature data sent by a third virtual machine. The virtual function is mounted on the third virtual machine. The second signature data is obtained by the third virtual machine signing the second public key using the first private key matched with the first public key.

[0125] Based on the second public key, a signature verification operation is performed on the second signature data to verify whether the third virtual machine is the first virtual machine;

[0126] If the third virtual machine is verified to be the first virtual machine, the secure working mode of the virtual function is canceled, and the previously saved target key is deleted. The target key includes the key required to respond to data storage-related access operations initiated by the first virtual machine when the secure working mode is enabled.

[0127] In practice, when a virtual machine wants to deactivate the secure working mode of a virtual function, it needs to use the specified private key (i.e., the first private key virt_priKey) to sign the specified public key (i.e., the public key ssd_pubKey returned when the virtual function activates the secure working mode, which is also the second public key), and send the obtained second signature data to the virtual function through the fourth command.

[0128] After receiving the fourth command carrying the second signature data, the virtual function verifies the second signature data based on the second public key and the first public key. If the signature is correct, it indicates that the third virtual machine has the first private key and the second public key. Therefore, it can be determined that the third virtual machine is the same virtual machine (i.e., the first virtual machine) that has enabled the secure working mode of the virtual function.

[0129] The virtual function then responds to the fourth command issued by this virtual machine, cancels the secure working mode of the virtual function, and deletes the previously saved target key, such as deleting the first public key virt_pubKey and the second symmetric key vf_key saved by the virtual function. This ensures that the data written by this virtual machine when the secure working mode of the virtual function is enabled will not be accessed by any virtual machine, including this virtual machine. This further ensures the security of the written data and avoids the tedious operation of indexing and clearing the data written when the secure working mode of the virtual function is enabled one by one.

[0130] In this embodiment, the present application provides a first command and a third command to enable and disable the secure working mode of the virtual function. After the secure working mode is disabled (i.e., the default mode is restored), the virtual function can be flexibly operated by the mounted virtual machine.

[0131] In one embodiment, the target key is generated based on the ID of the first virtual machine, the ID of the virtual function, and a key generation algorithm pre-negotiated between the first virtual machine and the virtual function; when the virtual function is remounted to the first virtual machine and the first virtual machine restarts its secure working mode, the virtual function and the first virtual machine restore the target key.

[0132] In this embodiment, the present application sets the same key (corresponding to the target key) required to generate the same response read operation between the same virtual machine and the same virtual function, and different keys required to generate the response read operation between different virtual machines and different virtual functions. This ensures the security of the data written by the first virtual machine to the virtual function, and enables the first virtual machine to restore the previously deleted target key when it restarts the secure working mode of the same virtual function, thereby restoring read and write access to the previously written data.

[0133] As one possible implementation, when a virtual function cancels its secure operating mode, it records the target key and its corresponding virtual machine. When the virtual function is re-enabled by the same virtual machine, the target key corresponding to the virtual machine is queried based on the previous record to quickly restore the virtual machine's access to the previously written data.

[0134] Secondly, see Figure 4 The diagram shown is an implementation flowchart of another data storage method provided in this application embodiment. This data storage method is applied to a virtual machine with virtualization capabilities, wherein the virtualization capabilities are created on a solid-state drive that supports single-root input / output virtualization. The method may include the following steps:

[0135] Step S201: Send a first command carrying the first public key to the virtual function, the first command being used to enable the secure working mode of the virtual function;

[0136] Step S202: Receive the second public key sent by the virtual function;

[0137] Step S203: Before initiating data storage related access operations on the virtual function, generate first encrypted data based on the second public key;

[0138] Step S204: Use the first private key matched with the first public key to sign the first encrypted data to obtain the first signed data;

[0139] Step S205: Send the first encrypted data and the first signature data to the virtual function so that the virtual function can verify whether the virtual machine has enabled the secure working mode of the virtual function, and if it is verified that the virtual machine has enabled the secure working mode of the virtual function, respond to the data storage related access operation initiated by the virtual machine.

[0140] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function.

[0141] As one possible implementation, the method further includes:

[0142] A second command is sent to the virtual function so that, if the virtual function verifies that the virtual machine has enabled the secure working mode of the virtual function, it deletes or formats the namespace bound to the virtual function.

[0143] As one possible implementation, generating first encrypted data based on the second public key includes:

[0144] The first symmetric key is generated by generating random numbers;

[0145] The first symmetric key is encrypted using the second public key to obtain the first encrypted data;

[0146] The data storage-related access operations include write operations; the method further includes:

[0147] The first encrypted data is decrypted using the second private key matched with the second public key to obtain the first symmetric key;

[0148] Calculate the cyclic redundancy check value for the data to be written to the virtual function;

[0149] The data to be written to the virtual function and the corresponding cyclic redundancy check value are encrypted using the first symmetric key to obtain the second encrypted data.

[0150] A write command carrying the second encrypted data is sent to the virtual function, and the write command is used to initiate a write operation to the virtual function.

[0151] As one possible implementation, the data storage-related access operations include read operations; the method further includes:

[0152] Send a read command carrying the target storage area address to the virtual function. The read command is used to initiate a read operation to the virtual function. The target storage area address is used to indicate the storage area address where the data to be read by the virtual function is located.

[0153] Receive the fourth encrypted data sent by the virtual function;

[0154] The fourth encrypted data is decrypted using the first symmetric key to obtain the data required by the virtual function.

[0155] As one possible implementation, the method further includes:

[0156] Using the first private key matched with the first public key, a signature operation is performed on the second public key to obtain the second signature data;

[0157] A fourth command carrying the second signature data is sent to the virtual function so that the virtual function can verify whether the virtual machine has enabled the secure working mode of the virtual function. If it is verified that the virtual machine has enabled the secure working mode of the virtual function, the secure working mode of the virtual function is canceled and the previously saved target key is deleted. The target key includes the key required by the virtual function to respond to the data storage related access operation initiated by the virtual machine when the secure working mode is enabled.

[0158] It should be noted that the method implementation on the virtual machine side is similar to that on the virtual function side, so the description is relatively simple. For relevant details, please refer to the method implementation on the virtual function side.

[0159] Thirdly, embodiments of this application provide a data storage system, such as... Figure 5 As shown, the data storage system includes a virtual machine and virtual functions mounted on the virtual machine. These virtual functions are created on a solid-state drive that supports single-root input / output virtualization, wherein:

[0160] The virtual machine is used to send a first command carrying a first public key to the virtual function;

[0161] The virtual function is configured to, in response to receiving the first command carrying the first public key, enable the secure working mode of the virtual function and send the second public key to the virtual machine;

[0162] The virtual machine is also used to generate first encrypted data based on the second public key before initiating data storage-related access operations on the virtual function;

[0163] The virtual machine is further configured to use the first private key matched by the first public key to sign the first encrypted data, thereby obtaining first signed data;

[0164] The virtual machine is also used to send the first encrypted data and the first signature data to the virtual function;

[0165] The virtual function is also used to perform a signature verification operation on the first signature data based on the first encrypted data and the first public key, so as to verify whether the virtual machine has enabled the secure working mode of the virtual function.

[0166] The virtual function is also used to respond to data storage related access operations initiated by the virtual machine when it is verified that the virtual machine has enabled the secure working mode of the virtual function.

[0167] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function.

[0168] It should be noted that the data storage system embodiment is similar to the method embodiment described in the first and second aspects, so the description is relatively simple. For relevant details, please refer to the method embodiment described in the first and second aspects.

[0169] Fourthly, embodiments of this application provide a data storage device applied to virtual functions, wherein the virtual functions are created on a solid-state drive that supports single-root input / output virtualization, such as... Figure 6 As shown, the device includes:

[0170] The first receiving module is used to receive a first command carrying a first public key sent by the first virtual machine, wherein the virtual function is mounted on the first virtual machine;

[0171] The first processing module is used to enable the secure working mode of the virtual function and send the second public key to the first virtual machine.

[0172] The second receiving module is used to receive the first encrypted data and the first signature data sent by the second virtual machine, wherein the virtual function is mounted on the second virtual machine;

[0173] The first signature verification module is used to perform a signature verification operation on the first signature data based on the first encrypted data and the first public key, so as to verify whether the second virtual machine is the first virtual machine;

[0174] The first response module is used to respond to data storage related access operations initiated by the second virtual machine when it is verified that the second virtual machine is the first virtual machine.

[0175] Optionally, the device further includes:

[0176] The third receiving module is used to receive the second command sent by the second virtual machine, wherein the second command is a command to delete or format the namespace bound to the virtual function;

[0177] The second processing module is used to delete or format the namespace bound to the virtual function when it is verified that the second virtual machine is the first virtual machine;

[0178] The third processing module is used to prevent the deletion or formatting of the namespace bound to the virtual function if it is verified that the second virtual machine is not the first virtual machine.

[0179] Optionally, the first processing module includes:

[0180] The first setting module is used to set the working mode representation value corresponding to the virtual function to the target representation value in the first storage area;

[0181] The first storage area is a storage area that supports access to various virtual functions created on the solid-state drive and the physical function that manages the various virtual functions. The first storage area is used to prevent the physical function from deleting or formatting the namespaces bound to the virtual functions that have enabled the safe working mode when executing the third command. The third command is a command to delete or format the namespaces bound to all virtual functions or a command to specify the namespaces bound to a virtual function.

[0182] Optionally, the first response module includes:

[0183] The first response submodule is used to decrypt the first encrypted data using the second private key matched with the second public key, and obtain the first symmetric key, when it is verified that the second virtual machine is the first virtual machine;

[0184] The second response submodule is used to respond to data storage-related access operations initiated by the second virtual machine based on the first symmetric key;

[0185] The second public key and the second private key that the second public key matches are a public-private key pair generated when the solid-state drive leaves the factory.

[0186] Optionally, the device further includes:

[0187] The first generation module is used to generate a second symmetric key after receiving the first command, and to determine the symmetric key generated when the solid-state drive leaves the factory as the third symmetric key;

[0188] The first encryption module is used to encrypt the second symmetric key using the third symmetric key and save the encrypted second symmetric key to a second storage area, wherein the second storage area is a non-volatile storage area that is not cleared by a controller-level reset operation;

[0189] The second response submodule includes:

[0190] The first write response module is used to receive a write command carrying the second encrypted data sent by the second virtual machine;

[0191] The second write response module is used to decrypt the second encrypted data using the first symmetric key to obtain the data to be written to the virtual function;

[0192] The third write response module is used to read the encrypted second symmetric key from the second storage area and decrypt it using the third symmetric key to obtain the second symmetric key when the virtual function has performed a controller-level reset operation.

[0193] The fourth write response module is used to read the second symmetric key from the third storage area when the virtual function does not perform a controller-level reset operation. The second symmetric key is a second symmetric key that has been encrypted in the second storage area before being decrypted and saved to the third storage area. The third storage area is a storage area that will be cleared by the controller-level reset operation.

[0194] The fifth write response module is used to encrypt the data to be written to the virtual function using the second symmetric key to obtain the third encrypted data;

[0195] The sixth write response module is used to write the third encrypted data into the storage area corresponding to the virtual function;

[0196] The data storage-related access operations include write operations.

[0197] Optionally, the second response submodule includes:

[0198] The first read response module is used to receive a read command sent by the virtual function, which carries the address of the target storage area. The target storage area address is used to indicate the storage area address where the data to be read by the virtual function is located.

[0199] The second read response module is used to read data according to the target storage area address to obtain the data required by the virtual function.

[0200] The third read response is used to calculate the cyclic redundancy check value for the data required to be read by the virtual function.

[0201] The fourth read response is used to encrypt the data required by the virtual function and the cyclic redundancy check value corresponding to the data required by the virtual function using the first symmetric key to obtain the fourth encrypted data.

[0202] The fifth read response is used to send the fourth encrypted data to the second virtual machine;

[0203] The data storage-related access operations include read operations.

[0204] Optionally, the second read response module includes:

[0205] The first read response submodule is used to read the second symmetric key from the fourth storage area, the second symmetric key being pre-written into the fourth storage area;

[0206] The second read response submodule is used to decrypt the data read from the target storage area address using the second symmetric key to obtain the data required by the virtual function.

[0207] Optionally, the device further includes:

[0208] The first prompt module is used to, if it is verified that the second virtual machine is not the first virtual machine, not to respond to the data storage related access operation initiated by the second virtual machine, and directly return a preset error prompt message to the second virtual machine.

[0209] Optionally, the device further includes:

[0210] The fourth receiving module is used to receive a fourth command carrying second signature data sent by the third virtual machine. The virtual function is mounted on the third virtual machine. The second signature data is obtained by the third virtual machine signing the second public key using the first private key matched with the first public key.

[0211] The second signature verification module is used to perform a signature verification operation on the second signature data based on the second public key, so as to verify whether the third virtual machine is the first virtual machine;

[0212] The fourth processing module is used to, upon verifying that the third virtual machine is the first virtual machine, cancel the secure working mode of the virtual function and delete the previously saved target key, which includes the key required to respond to data storage-related access operations initiated by the first virtual machine when the secure working mode is enabled.

[0213] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function.

[0214] Fifthly, embodiments of this application provide another data storage device for use with a virtual machine equipped with virtualization capabilities, wherein the virtualization capabilities are created on a solid-state drive that supports single-root input / output virtualization, such as... Figure 7 As shown, the device includes:

[0215] The first command sending module is used to send a first command carrying a first public key to the virtual function, and the first command is used to enable the secure working mode of the virtual function.

[0216] The second public key receiving module is used to receive the second public key sent by the virtual function;

[0217] The first generation module is used to generate first encrypted data based on the second public key before initiating data storage-related access operations on the virtual function.

[0218] The first signature module is used to sign the first encrypted data using the first private key matched with the first public key to obtain the first signature data.

[0219] The first data sending module is used to send the first encrypted data and the first signature data to the virtual function so that the virtual function can verify whether the virtual machine has enabled the secure working mode of the virtual function, and if it is verified that the virtual machine has enabled the secure working mode of the virtual function, it responds to the data storage related access operation initiated by the virtual machine.

[0220] Optionally, the device further includes:

[0221] The second command sending module is used to send a second command to the virtual function, so that the virtual function, after verifying that the virtual machine has enabled the secure working mode of the virtual function, deletes or formats the namespace bound to the virtual function.

[0222] Optionally, the first generation module includes:

[0223] The first generation submodule is used to generate the first symmetric key by generating random numbers;

[0224] The second generation submodule is used to encrypt the first symmetric key using the second public key to obtain the first encrypted data;

[0225] The device further includes:

[0226] The first decryption module is used to decrypt the first encrypted data using the second private key matched with the second public key to obtain the first symmetric key;

[0227] The first calculation module is used to calculate the cyclic redundancy check value for the data to be written to the virtual function.

[0228] The second encryption module is used to encrypt the data to be written to the virtual function and the cyclic redundancy check value corresponding to the data to be written to the virtual function using the first symmetric key to obtain the second encrypted data.

[0229] A write command sending module is used to send a write command carrying the second encrypted data to the virtual function, wherein the write command is used to initiate a write operation to the virtual function;

[0230] The data storage-related access operations include write operations.

[0231] Optionally, the device further includes:

[0232] The read command sending module is used to send a read command carrying the target storage area address to the virtual function. The read command is used to initiate a read operation to the virtual function, and the target storage area address is used to indicate the storage area address where the data to be read by the virtual function is located.

[0233] The fourth encrypted data receiving module is used to receive the fourth encrypted data sent by the virtual function;

[0234] The second decryption module is used to decrypt the fourth encrypted data using the first symmetric key to obtain the data to be read by the virtual function.

[0235] The data storage-related access operations include read operations.

[0236] Optionally, the device further includes:

[0237] The second signature module is used to perform a signature operation on the second public key using the first private key matched with the first public key to obtain second signature data.

[0238] The fourth command sending module is used to send a fourth command carrying the second signature data to the virtual function so that the virtual function can verify whether the virtual machine has enabled the secure working mode of the virtual function. If it is verified that the virtual machine has enabled the secure working mode of the virtual function, the secure working mode of the virtual function is canceled and the previously saved target key is deleted. The target key includes the key required by the virtual function to respond to the data storage related access operation initiated by the virtual machine when the secure working mode is enabled.

[0239] As can be seen from the above technical solution, this application sets a first command to enable the secure working mode of the virtual function. After the secure working mode is enabled, the virtual function will verify whether the virtual machine is the virtual machine that has enabled its own secure working mode (i.e., this virtual machine) by means of digital signature verification. This digital signature verification method is implemented based on the public and private key mechanism of the virtual machine, which can ensure the reliability of the verification. The virtual function will only respond to the data storage related access operation initiated by the virtual machine after verifying that the virtual machine is this virtual machine. This can prevent other virtual machines from arbitrarily mounting the virtual function to steal or tamper with the data written by this virtual machine, thereby improving the security of the data stored on the virtual function.

[0240] It should be noted that the device embodiments are similar to the method embodiments, so the description is relatively simple. For relevant details, please refer to the method embodiments.

[0241] This application also provides an electronic device, see embodiments thereof. Figure 8 , Figure 8 This is a schematic diagram of the electronic device proposed in an embodiment of this application. Figure 8 As shown, the electronic device 100 includes a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus for communication. The memory 110 stores a computer program that can run on the processor 120 to implement the steps in the data storage method disclosed in the embodiments of this application.

[0242] This application also provides a computer-readable storage medium, see [link to relevant documentation]. Figure 9 , Figure 9 This is a schematic diagram of a computer-readable storage medium proposed in an embodiment of this application. Figure 9 As shown, a computer-readable storage medium 200 stores a computer program / instructions 210, which, when executed by a processor, implements the steps in the data storage method disclosed in the embodiments of this application.

[0243] This application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps in the data storage method disclosed in this application.

[0244] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0245] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0246] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0247] The data storage method, system, electronic device, and storage medium provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A data storage method, It is characterized in that Applied to a virtual function, the virtual function is created on a solid-state drive supporting single-root input-output virtualization, the method comprising: receiving a first command carrying a first public key sent by a first virtual machine, wherein the virtual function is mounted on the first virtual machine; Enable the secure working mode of the virtual function and send the second public key to the first virtual machine; Receiving first encrypted data and first signed data sent by a second virtual machine, the virtual function being mounted on the second virtual machine; Performing a signature verification operation on the first signature data according to the first encrypted data and the first public key to verify whether the second virtual machine is the first virtual machine; When it is verified that the second virtual machine is the first virtual machine, respond to a data storage related access operation initiated by the second virtual machine.

2. The data storage method according to claim 1, It is characterized in that The method further comprises: receiving a second command sent by the second virtual machine, where the second command is a command for deleting or formatting the namespace to which the virtual function is bound; When it is verified that the second virtual machine is the first virtual machine, deleting or formatting the namespace bound to the virtual function; When it is verified that the second virtual machine is not the first virtual machine, the namespace bound to the virtual function is not deleted or formatted.

3. The data storage method according to claim 1, It is characterized in that Enabling the safe working mode of the virtual function includes: Setting the operating mode characterization value corresponding to the virtual function as a target characterization value in the first storage area; Among them, the first storage area is a storage area that supports access to each virtual function created on the solid-state drive and a physical function that manages each virtual function. The first storage area is used to prevent the physical function from deleting or formatting the namespace bound to the virtual function in the secure working mode when executing a third command. The third command is a command to delete or format the namespace bound to all virtual functions or the namespace bound to a specified virtual function.

4. The data storage method according to claim 1, It is characterized in that When it is verified that the second virtual machine is the first virtual machine, responding to the data storage-related access operation initiated by the second virtual machine includes: When it is verified that the second virtual machine is the first virtual machine, decrypting the first encrypted data using a second private key matched by the second public key to obtain a first symmetric key; Responding to a data storage-related access operation initiated by the second virtual machine based on the first symmetric key; The second public key and the second private key matching the second public key are: a pair of public and private keys generated when the solid state drive leaves the factory.

5. The data storage method according to claim 4, It is characterized in that After receiving the first command, the method further includes: Generate a second symmetric key, and determine the symmetric key generated when the solid state drive leaves the factory as a third symmetric key; Encrypting the second symmetric key using the third symmetric key, and saving the encrypted second symmetric key in a second storage area, where the second storage area is a non-volatile storage area that is not cleared by a controller-level reset operation; The data storage related access operation includes a write operation; responding to the data storage related access operation initiated by the second virtual machine based on the first symmetric key includes: receiving a write command carrying second encrypted data sent by the second virtual machine; Decrypting the second encrypted data using the first symmetric key to obtain the data required to be written to the virtual function; When the virtual function has performed a controller-level reset operation, reading the encrypted second symmetric key from the second storage area, and decrypting the encrypted second symmetric key using the third symmetric key to obtain the second symmetric key; In the case where the virtual function does not perform a controller-level reset operation, the second symmetric key is read from a third storage area, where the second symmetric key is pre-encrypted in the second storage area and then decrypted and saved in the third storage area, and the third storage area is a storage area that will be cleared by a controller-level reset operation; Using the second symmetric key to encrypt the data required to be written to the virtual function to obtain third encrypted data; The third encrypted data is written into the storage area corresponding to the virtual function.

6. The data storage method according to claim 4, It is characterized in that The data storage related access operations include read operations; Responding to the data storage-related access operation initiated by the second virtual machine based on the first symmetric key includes: receiving a read command carrying a target storage area address sent by the virtual function, wherein the target storage area address is used to indicate an address of a storage area where data to be read by the virtual function is located; Read data according to the target storage area address to obtain the data required to be read by the virtual function; Calculating a cyclic redundancy check value for the data required to be read by the virtual function; Encrypting the data required to be read by the virtual function and the cyclic redundancy check value corresponding to the data required to be read by the virtual function using the first symmetric key to obtain fourth encrypted data; The fourth encrypted data is sent to the second virtual machine.

7. The data storage method according to claim 6, It is characterized in that Reading data according to the target storage area address to obtain the data required to be read by the virtual function includes: Reading a second symmetric key from a fourth storage area, where the second symmetric key is pre-written into the fourth storage area; The second symmetric key is used to decrypt the data read from the target storage area address to obtain the data required to be read by the virtual function.

8. The data storage method according to any one of claims 1 to 7, It is characterized in that The method further comprises: When it is verified that the second virtual machine is not the first virtual machine, no response is given to the data storage related access operation initiated by the second virtual machine, and a preset error prompt message is directly returned to the second virtual machine.

9. The data storage method according to any one of claims 1 to 7, It is characterized in that The method further comprises: receiving a fourth command carrying second signature data sent by a third virtual machine, the virtual function being mounted on the third virtual machine, and the second signature data being obtained by the third virtual machine using a first private key matching the first public key to perform a signing operation on the second public key; Performing a signature verification operation on the second signature data according to the second public key to verify whether the third virtual machine is the first virtual machine; When it is verified that the third virtual machine is the first virtual machine, the secure working mode of the virtual function is canceled, and the previously saved target key is deleted. The target key includes the key required to respond to data storage-related access operations initiated by the first virtual machine when the secure working mode is turned on.

10. A data storage method, It is characterized in that Applied to a virtual machine with a virtual function mounted thereon, the virtual function being created on a solid-state hard disk supporting single-root input-output virtualization, the method comprising: Sending a first command carrying a first public key to the virtual function, where the first command is used to enable a secure working mode of the virtual function; receiving a second public key sent by the virtual function; Before initiating a data storage related access operation on the virtual function, generating first encrypted data according to the second public key; Use the first private key matched by the first public key to sign the first encrypted data to obtain first signature data; The first encrypted data and the first signature data are sent to the virtual function so that the virtual function can verify whether the virtual machine has turned on the secure working mode of the virtual function, and if it is verified that the virtual machine has turned on the secure working mode of the virtual function, respond to the data storage-related access operation initiated by the virtual machine.

11. The data storage method according to claim 10, It is characterized in that The method further comprises: A second command is sent to the virtual function, so that the virtual function deletes or formats the namespace bound to the virtual function when it is verified that the virtual machine has enabled the secure working mode of the virtual function.

12. The data storage method according to claim 10, It is characterized in that Generating first encrypted data according to the second public key includes: Generate a first symmetric key by generating a random number; Encrypt the first symmetric key using the second public key to obtain the first encrypted data; The data storage related access operation includes a write operation; the method further includes: Decrypt the first encrypted data using the second private key matched by the second public key to obtain the first symmetric key; Calculating a cyclic redundancy check value for data to be written to the virtual function; Encrypting the data to be written to the virtual function and the cyclic redundancy check value corresponding to the data to be written to the virtual function using the first symmetric key to obtain second encrypted data; A write command carrying the second encrypted data is sent to the virtual function, where the write command is used to initiate a write operation to the virtual function.

13. The data storage method according to claim 12, It is characterized in that The data storage related access operation includes a read operation; the method further includes: Sending a read command carrying a target storage area address to the virtual function, wherein the read command is used to initiate a read operation to the virtual function, and the target storage area address is used to indicate an address of a storage area where data to be read by the virtual function is located; receiving fourth encrypted data sent by the virtual function; The fourth encrypted data is decrypted using the first symmetric key to obtain the read data required by the virtual function.

14. The data storage method according to any one of claims 10 to 13, It is characterized in that The method further comprises: Use the first private key matched by the first public key to perform a signing operation on the second public key to obtain second signature data; A fourth command carrying the second signature data is sent to the virtual function so that the virtual function can verify whether the virtual machine has turned on the secure working mode of the virtual function. If it is verified that the virtual machine has turned on the secure working mode of the virtual function, the secure working mode of the virtual function is canceled and the previously saved target key is deleted. The target key includes the key required for the virtual function to respond to data storage-related access operations initiated by the virtual machine when the secure working mode is turned on.

15. A data storage system, It is characterized in that It includes a virtual machine and a virtual function mounted on the virtual machine, wherein the virtual function is created on a solid state drive supporting single-root input and output virtualization, wherein: The virtual machine is used to send a first command carrying a first public key to the virtual function; The virtual function is configured to, in response to receiving the first command carrying the first public key, enable a secure working mode of the virtual function and send a second public key to the virtual machine; The virtual machine is further configured to generate first encrypted data according to the second public key before initiating a data storage related access operation on the virtual function; The virtual machine is further used to use the first private key matched by the first public key to perform a signing operation on the first encrypted data to obtain first signature data; The virtual machine is further used to send the first encrypted data and the first signed data to the virtual function; The virtual function is further used to perform a signature verification operation on the first signature data according to the first encrypted data and the first public key to verify whether the virtual machine has enabled the secure working mode of the virtual function; The virtual function is further configured to respond to a data storage-related access operation initiated by the virtual machine when it is verified that the virtual machine has enabled the secure working mode of the virtual function.

16. An electronic device comprising a memory, a processor and a computer program stored in the memory, It is characterized in that The processor executes the computer program to implement the data storage method according to any one of claims 1 to 9 or to implement the data storage method according to any one of claims 10 to 14.

17. A computer-readable storage medium having a computer program / instructions stored thereon, It is characterized in that When the computer program / instructions are executed by a processor, the data storage method according to any one of claims 1 to 9 or the data storage method according to any one of claims 10 to 14 is implemented.

Citation Information

Cited By

  • Method and system for using cross-domain virtual NVMe device, terminal and medium

    CN119150379A

  • Storage device access method, product, equipment and readable storage medium

    CN119557932A

  • A storage device access method, product, device and readable storage medium

    CN119557932B

  • Storage apparatus access method, product, device, and non-volatile readable storage medium

    WO2026157349A1