A method, device, equipment and medium for implementing NVME disk locking
By reading and decrypting the encrypted data in the preset storage space of the NVME disk and performing comparisons, the disk lock function of the NVME disk is realized, which solves the problem of insufficient storage security of NVME disks in the existing technology and improves the security of storage devices. sex.
Patent Information
- Application Number
- CN202111660255.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-12-30
AI Technical Summary
The existing technology lacks a disk lock implementation solution for NVME disks, resulting in insufficient storage security.
By reading and decrypting the encrypted data in the preset storage space of the NVME disk, and comparing it with the target data, if it is consistent, the disk is allowed to go online, if it is inconsistent, it is not allowed to go online, and the preset read command and decryption algorithm are used to lock the disk. Function.
Effectively improves the storage security of NVME disks, ensuring that only verified disks can be used on storage devices.
Smart Images

Figure CN114356233B
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a method, device, equipment and medium for implementing NVME disk locking. Background Art
[0002] In order to ensure data security, it is necessary to lock the hard disk in some scenarios. Only hard disks that have passed the lock restriction function can be used on the storage device. Disks that have not passed the lock restriction function will not be recognized and cannot be used. Currently, NVME (i.e. NVM Express, non-volatile memory host controller interface specification) disks are widely used, but there is no corresponding lock disk implementation solution. Therefore, how to implement NVME disks is an urgent problem to be solved. Summary of the invention
[0003] In view of this, the purpose of this application is to provide a method, device, equipment and medium for implementing NVME disk lock, which can implement NVME disk lock and improve storage security. The specific scheme is as follows:
[0004] In a first aspect, a method for implementing NVME disk locking is applied to a storage device, comprising:
[0005] Using a preset read command, the encrypted data is read from the preset storage space of the inserted NVME disk;
[0006] Decrypting the encrypted data to obtain decrypted data;
[0007] Compare the decrypted data with the target data corresponding to the NVME disk;
[0008] If the decrypted data is consistent with the target data, the NVME disk is allowed to go online;
[0009] If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online;
[0010] The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space.
[0011] Optionally, the method of reading encrypted data from a preset storage space of the inserted NVME disk by using a preset read command includes:
[0012] Use the get features command with the specified feature ID to read the encrypted data from the preset storage space of the inserted NVME disk;
[0013] The specified feature ID is a feature ID specified from the feature ID range reserved by the NVME protocol.
[0014] Optionally, the encrypted data of the NVME disk that is allowed to go online is the encrypted data written into the preset storage space of the NVME disk by using the set features command carrying the specified feature ID before the NVME disk leaves the factory.
[0015] Optionally, before comparing the decrypted data with the target data corresponding to the NVME disk, the method further includes:
[0016] Read the identification information of the NVME disk to obtain the target data of the NVME disk.
[0017] Optionally, the preset storage space is a storage space determined from a storage space associated with an NVME disk controller.
[0018] Optionally, if the decrypted data is inconsistent with the target data, the method further includes:
[0019] Outputs an alarm with information about hard disk decryption failure.
[0020] Optionally, it is characterized in that before the encrypted data is read from the preset storage space of the inserted NVME disk by using the preset read command, it also includes:
[0021] Read the firmware version information of the inserted NVME disk;
[0022] Determine whether the firmware version information meets the preset version condition. If the firmware version information meets the preset version condition, start the step of reading encrypted data from the preset storage space of the inserted NVME disk using the preset read command.
[0023] In a second aspect, an embodiment of the present application discloses an NVME disk lock implementation device, which is applied to a storage device, including:
[0024] The encrypted data reading module is used to read the encrypted data from the preset storage space of the inserted NVME disk using a preset read command;
[0025] An encrypted data decryption module, used to decrypt the encrypted data to obtain decrypted data;
[0026] A decrypted data comparison module, used to compare the decrypted data with the target data corresponding to the NVME disk;
[0027] A hard disk online control module, used for allowing the NVME disk to go online if the decrypted data comparison module determines that the decrypted data is consistent with the target data; if the decrypted data comparison module determines that the decrypted data is inconsistent with the target data, then not allowing the NVME disk to go online;
[0028] The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space.
[0029] In a third aspect, the present application discloses an electronic device, comprising:
[0030] Memory, used to store computer programs;
[0031] The processor is used to execute the computer program to implement the aforementioned NVME disk locking method.
[0032] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, which implements the aforementioned NVME disk locking method when executed by a processor.
[0033] It can be seen that the present application uses a preset read command to read encrypted data from the preset storage space of the inserted NVME disk, and then decrypts the encrypted data to obtain decrypted data, and compares the decrypted data with the target data corresponding to the NVME disk. If the decrypted data is consistent with the target data, the NVME disk is allowed to go online. If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online. The encrypted data of the NVME disk allowed to go online is the data encrypted and stored in the preset storage space before the NVME disk leaves the factory. That is, in the implementation of the present application, before the NVME disk allowed to be used on the storage device leaves the factory, the encrypted data is written into the preset storage space of the NVME disk. The storage device uses a preset read command to read the encrypted data from the preset storage space of the inserted NVME disk and decrypt it. If the decryption is successful, the NVME disk is allowed to go online, otherwise the NVME disk is not allowed to go online. In this way, the NVME disk can be locked and the storage security can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0035] Figure 1 This is a flow chart of a method for implementing NVME disk locking disclosed in this application;
[0036] Figure 2 This is a schematic diagram of the structure of an NVME disk locking device disclosed in this application;
[0037] Figure 3 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] In order to ensure the security of data, it is necessary to lock the hard disk in some scenarios. The locked disk means that only hard disks that have passed the lock disk restriction function can be used on the storage device. Disks that have not passed the lock disk restriction function will not be recognized and cannot be used. Currently, NVME disks are widely used, but there is no corresponding lock disk implementation solution. Therefore, how to implement NVME disks is a problem that needs to be solved urgently. To this end, this application provides an NVME disk lock disk implementation that can implement NVME disk lock disk and improve storage security.
[0040] See also Figure 1 As shown, the embodiment of the present application discloses a method for implementing NVME disk locking, which is applied to a storage device, including:
[0041] Step S11: using a preset read command to read encrypted data from a preset storage space of the inserted NVME disk.
[0042] In a specific implementation, the encrypted data is read from the preset storage space of the inserted NVME disk using the get features command carrying a specified feature ID; wherein the specified feature ID is a feature ID specified from the feature ID range reserved by the NVME protocol. The feature IDs reserved on the protocol are C0h-FFh, and one of the feature IDs is selected for use. Further, the embodiment of the present application uses the get features command carrying a specified feature ID and a specified saved parameter to read the encrypted data from the preset storage space of the inserted NVME disk. Furthermore, the preset storage space is a storage space determined from the storage space associated with the NVME disk controller.
[0043] The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space. In addition, the encrypted data of the NVME disk that is allowed to go online is the encrypted data written into the preset storage space of the NVME disk using the set features command carrying the specified feature ID before the NVME disk leaves the factory.
[0044] In a specific implementation, the disk manufacturer can provide a 4K space where data can be written. This 4K space is required to be written into the space related to the disk controller, and will not be lost or changed with the namespace erasure, reset, power on and off. Use the set features command to write 4KB of encrypted data, specify the saved parameter, and save the data permanently to the disk. The feature ID reserved in the protocol is C0h-FFh, and one of the feature IDs is selected for use. When decrypting, use get features to read permanent data, and also specify the saved parameter to read the written data.
[0045] Step S12: decrypt the encrypted data to obtain decrypted data.
[0046] In a specific implementation, the encrypted data may be decrypted using a preset decryption algorithm to obtain decrypted data, wherein the preset decryption algorithm may be a symmetric decryption algorithm or an asymmetric decryption algorithm, which is not limited herein.
[0047] Step S13: Compare the decrypted data with the target data corresponding to the NVME disk.
[0048] In a specific implementation manner, the embodiment of the present application first reads the identification information of the NVME disk to obtain the target data of the NVME disk, and then compares the decrypted data with the target data corresponding to the NVME disk.
[0049] The identification information may include but is not limited to the serial number of the NVME disk.
[0050] Step S14: If the decrypted data is consistent with the target data, the NVME disk is allowed to go online.
[0051] Step S15: If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online.
[0052] Furthermore, if the decrypted data is not read or the encrypted data cannot be decrypted, the NVME disk is not allowed to go online.
[0053] For example, in a specific implementation, before the disk is shipped, the disk is first encrypted, and the set features (selected feature ID, saved parameter) instruction is used to write 4KB of encrypted data to the disk. The encrypted data on the disk is permanently saved. After shipment, the disk is inserted into the storage device, where it will be scanned and decrypted. If the decryption is successful, it is available online, otherwise it is offline and unavailable. When the storage device scans the disk, it locks the disk and decrypts it, and uses get features (selected feature ID, saved parameter) to read the permanent data. After reading, it uses the decryption algorithm to calculate. If the decryption is successful, the disk is put online and available. If the decryption fails, it is considered that the disk has not been written with encrypted data before, or the written encrypted data is wrong, and it is not allowed to go online and is unavailable.
[0054] Furthermore, if the decrypted data is inconsistent with the target data, the embodiment of the present application may also output an alarm carrying hard disk decryption failure information.
[0055] Furthermore, before the encrypted data is read from the preset storage space of the inserted NVME disk using the preset read command, the embodiment of the present application also includes: reading the firmware version information of the inserted NVME disk; determining whether the firmware version information meets the preset version condition, and if the firmware version information meets the preset version condition, initiating the step of reading the encrypted data from the preset storage space of the inserted NVME disk using the preset read command.
[0056] Among them, if the firmware version information indicates that the firmware version is a version that provides a disk lock function, the preset version condition is met. In a specific implementation, the read firmware version information can be compared with the firmware version information of the lowest version firmware that provides the disk lock function to determine whether the firmware version of the NVME disk is higher than the firmware version of the lowest version firmware that provides the disk lock function. If so, the preset version condition is met.
[0057] In this way, based on the determination of the firmware version, the old disk can be compatible. For example, for a newly shipped storage device with a disk lock function, the shipped disk can continue to be used. If a newly inserted disk that cannot pass the disk lock restriction function is unusable, a new disk that passes the disk lock restriction function can be used. In other words, the disk manufacturer needs to provide a disk FW (firmware) that supports the 4K space data writing function. For the old version of FW that does not support the disk lock function, the new FW can use the disk lock function, so that the shipped old disk can continue to be used. For a newly shipped storage device, when scanning the disk, the disk firmware version information is determined. If the conditions are met, the permanent data is read using get features (selected feature ID, saved parameters). After reading, the decryption algorithm is used for calculation. If the decryption is successful, the disk is put online and is available. If the decryption fails, it is considered that the disk has not been written with encrypted data before, or the written encrypted data is wrong, and it is not allowed to go online and is unavailable.
[0058] In addition, the present application can be implemented by coding in C language.
[0059] It can be seen that the embodiment of the present application uses a preset read command to read encrypted data from the preset storage space of the inserted NVME disk, and then decrypts the encrypted data to obtain decrypted data, and compares the decrypted data with the target data corresponding to the NVME disk. If the decrypted data is consistent with the target data, the NVME disk is allowed to go online. If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online. The encrypted data of the NVME disk allowed to go online is the data encrypted and stored in the preset storage space before the NVME disk leaves the factory. That is, in the implementation of the present application, before the NVME disk allowed to be used on the storage device leaves the factory, the encrypted data is written into the preset storage space of the NVME disk. The storage device uses a preset read command to read the encrypted data from the preset storage space of the inserted NVME disk and decrypt it. If the decryption is successful, the NVME disk is allowed to go online, otherwise the NVME disk is not allowed to go online. In this way, the NVME disk can be locked and the storage security can be improved.
[0060] See also Figure 2 As shown, the embodiment of the present application discloses an NVME disk lock implementation device, which is applied to a storage device, including:
[0061] The encrypted data reading module 11 is used to read the encrypted data from the preset storage space of the inserted NVME disk using a preset read command;
[0062] The encrypted data decryption module 12 is used to decrypt the encrypted data to obtain decrypted data;
[0063] The decrypted data comparison module 13 is used to compare the decrypted data with the target data corresponding to the NVME disk;
[0064] The hard disk online control module 14 is used to allow the NVME disk to go online if the decrypted data comparison module determines that the decrypted data is consistent with the target data; if the decrypted data comparison module determines that the decrypted data is inconsistent with the target data, then the NVME disk is not allowed to go online;
[0065] The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space.
[0066] It can be seen that the embodiment of the present application uses a preset read command to read encrypted data from the preset storage space of the inserted NVME disk, and then decrypts the encrypted data to obtain decrypted data, and compares the decrypted data with the target data corresponding to the NVME disk. If the decrypted data is consistent with the target data, the NVME disk is allowed to go online. If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online. The encrypted data of the NVME disk allowed to go online is the data encrypted and stored in the preset storage space before the NVME disk leaves the factory. That is, in the implementation of the present application, before the NVME disk allowed to be used on the storage device leaves the factory, the encrypted data is written into the preset storage space of the NVME disk. The storage device uses a preset read command to read the encrypted data from the preset storage space of the inserted NVME disk and decrypt it. If the decryption is successful, the NVME disk is allowed to go online, otherwise the NVME disk is not allowed to go online. In this way, the NVME disk can be locked and the storage security can be improved.
[0067] Among them, the encrypted data reading module 11 is specifically used to read the encrypted data from the preset storage space of the inserted NVME disk using the get features command carrying the specified feature ID; wherein the specified feature ID is a feature ID specified from the feature ID range reserved by the NVME protocol.
[0068] Correspondingly, the encrypted data of the NVME disk that is allowed to go online is the encrypted data written into the preset storage space of the NVME disk by using the set features command carrying the specified feature ID before the NVME disk leaves the factory.
[0069] In addition, the device further comprises an identification information reading module, which is used for the decrypted data comparison module 13 to read the identification information of the NVME disk to obtain the target data of the NVME disk before comparing the decrypted data with the target data corresponding to the NVME disk.
[0070] The preset storage space is a storage space determined from the storage space related to the NVME disk controller.
[0071] Furthermore, the device further comprises an alarm output module, which is used to output an alarm carrying hard disk decryption failure information if the decrypted data comparison module determines that the decrypted data is inconsistent with the target data.
[0072] Furthermore, the device also includes:
[0073] The firmware version information reading module is used to read the firmware version information of the inserted NVME disk;
[0074] The condition judgment module is used to judge whether the firmware version information meets the preset version condition. Accordingly, when the condition judgment module determines that the firmware version information meets the preset version condition, the device starts the encrypted data reading module 11 to execute the step of reading encrypted data from the preset storage space of the inserted NVME disk using the preset read command.
[0075] See also Figure 3 As shown, an embodiment of the present application discloses an electronic device, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, and the NVME disk locking implementation method disclosed in the above embodiment.
[0076] For the specific process of the above-mentioned NVME disk locking method, please refer to the corresponding content disclosed in the above-mentioned embodiment, which will not be repeated here.
[0077] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the NVME disk locking method disclosed in the aforementioned embodiment.
[0078] For the specific process of the above-mentioned NVME disk locking method, please refer to the corresponding content disclosed in the above-mentioned embodiment, which will not be repeated here.
[0079] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0080] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0081] The above is a detailed introduction to the NVME disk lock implementation method, device, equipment and medium provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for locking an NVME disk, characterized in that: Applicable to storage devices, including: Using a preset read command to read encrypted data from a preset storage space of the inserted NVME disk; the preset storage space is a storage space determined from a storage space related to the NVME disk controller; Decrypting the encrypted data to obtain decrypted data; Compare the decrypted data with the target data corresponding to the NVME disk; If the decrypted data is consistent with the target data, the NVME disk is allowed to go online; If the decrypted data is inconsistent with the target data, the NVME disk is not allowed to go online; The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space; The method of reading the encrypted data from the preset storage space of the inserted NVME disk by using the preset read command comprises: reading the encrypted data from the preset storage space of the inserted NVME disk by using the get features command carrying the specified feature ID; wherein the specified feature ID is a feature ID specified from the feature ID range reserved by the NVME protocol; The method of reading the encrypted data from the preset storage space of the inserted NVME disk by using the get features command carrying the specified feature ID comprises: reading the encrypted data from the preset storage space of the inserted NVME disk by using the get features command carrying the specified feature ID and the specified saved parameter; The encrypted data of the NVME disk that is allowed to go online is the encrypted data written into the preset storage space of the NVME disk by using the set features command carrying the specified feature ID before the NVME disk leaves the factory; Before comparing the decrypted data with the target data corresponding to the NVME disk, the method further includes: reading identification information of the NVME disk to obtain the target data of the NVME disk; the identification information includes the serial number of the NVME disk; Before the step of reading the encrypted data from the preset storage space of the inserted NVME disk by using the preset read command, the method further includes: reading the firmware version information of the inserted NVME disk; judging whether the firmware version information meets the preset version condition, and if the firmware version information meets the preset version condition, starting the step of reading the encrypted data from the preset storage space of the inserted NVME disk by using the preset read command; The determining whether the firmware version information satisfies the preset version condition includes: comparing the read firmware version information with the firmware version information of the lowest version firmware that provides the disk lock function, and determining whether the firmware version of the NVME disk is higher than the firmware version of the lowest version firmware that provides the disk lock function; if so, the preset version condition is met.
2. The NVME disk lock implementation method according to claim 1, characterized in that: If the decrypted data is inconsistent with the target data, the method further includes: Outputs an alarm with information about hard disk decryption failure.
3. An NVME disk locking device, characterized in that: Applicable to storage devices, including: An encrypted data reading module, used to read encrypted data from a preset storage space of an inserted NVME disk using a preset read command; the preset storage space is a storage space determined from a storage space related to the NVME disk controller; An encrypted data decryption module, used to decrypt the encrypted data to obtain decrypted data; A decrypted data comparison module, used to compare the decrypted data with the target data corresponding to the NVME disk; A hard disk online control module, used for allowing the NVME disk to go online if the decrypted data comparison module determines that the decrypted data is consistent with the target data; if the decrypted data comparison module determines that the decrypted data is inconsistent with the target data, then not allowing the NVME disk to go online; The encrypted data of the NVME disk that is allowed to go online is the target data corresponding to the NVME disk that is encrypted before the NVME disk leaves the factory and stored in the preset storage space; The encrypted data reading module is specifically used to read the encrypted data from the preset storage space of the inserted NVME disk using the get features command carrying the specified feature ID; wherein the specified feature ID is a feature ID specified from the feature ID range reserved by the NVME protocol; The encrypted data reading module is specifically used to read the encrypted data from the preset storage space of the inserted NVME disk using the get features command carrying the specified feature ID and the specified saved parameter; The encrypted data of the NVME disk that is allowed to go online is the encrypted data written into the preset storage space of the NVME disk by using the set features command carrying the specified feature ID before the NVME disk leaves the factory; The device is further used to read the identification information of the NVME disk to obtain the target data of the NVME disk; the identification information includes the serial number of the NVME disk; The device is further used to read the firmware version information of the inserted NVME disk; determine whether the firmware version information meets the preset version condition, and if the firmware version information meets the preset version condition, start the step of reading the encrypted data from the preset storage space of the inserted NVME disk using the preset read command; The device is also used to compare the read firmware version information with the firmware version information of the lowest version firmware that provides the disk lock function, and determine whether the firmware version of the NVME disk is higher than the firmware version of the lowest version firmware that provides the disk lock function. If so, the preset version condition is met.
4. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the NVME disk locking method as described in any one of claims 1 to 2.
5. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the NVME disk locking method as described in any one of claims 1 to 2.
