Disclosure of Invention
The application aims to provide a method, a system, equipment and a computer readable storage medium for hard disk identification, which are used for preventing a user from replacing a hard disk provided by a non-server/storage manufacturer by himself.
In order to solve the above technical problem, the present application provides a hard disk identification method, including:
when equipment is powered on and started or a hard disk is inserted into the equipment, reading the unique identifier of the hard disk;
judging whether a ciphertext exists in a reserved area of the hard disk or not;
if so, reading the ciphertext, and decrypting the ciphertext into a plaintext by combining a preset key;
judging whether the plaintext is the same as the unique identifier;
and if the plaintext is different from the unique identifier, forbidding to use the hard disk.
Optionally, the decrypting the ciphertext into the plaintext by combining the preset key includes:
acquiring the equipment level of the current equipment;
searching a secret key corresponding to the equipment level in a preset secret key table;
and decrypting the ciphertext into plaintext by combining the key.
Optionally, when the ciphertext is not stored in the reserved area of the hard disk, the method further includes:
the hard disk is prohibited from being used.
Optionally, after prohibiting using the hard disk, the method further includes:
and outputting prompt information that the hard disk does not meet the standard.
The present application further provides a system for hard disk identification, the system comprising:
the reading module is used for reading the unique identifier of the hard disk when the equipment is powered on and started or the hard disk is inserted into the equipment;
the first judgment module is used for judging whether a ciphertext exists in a reserved area of the hard disk or not;
the decryption module is used for reading the ciphertext when the ciphertext exists in the reserved area of the hard disk and decrypting the ciphertext into plaintext by combining with a preset key;
the second judgment module is used for judging whether the plaintext is the same as the unique identifier or not;
and the first disabling module is used for disabling the hard disk when the plaintext is different from the unique identifier.
Optionally, the decryption module includes:
the obtaining submodule is used for obtaining the equipment level of the current equipment;
the searching submodule is used for searching the secret key corresponding to the equipment level in a preset secret key table;
and the decryption submodule is used for decrypting the ciphertext into plaintext by combining the secret key.
Optionally, the method further includes:
and the second forbidding module is used for forbidding to use the hard disk when the cipher text is not stored in the reserved area of the hard disk.
Optionally, the method further includes:
the determining module is used for determining the hard disk grade according to the input customization requirement;
the encryption module is used for encrypting the unique identifier of the hard disk by using the secret key corresponding to the hard disk level to obtain a ciphertext;
and the writing module is used for writing the ciphertext into the reserved area of the hard disk.
The present application further provides a hard disk identification device, which includes:
a memory for storing a computer program;
a processor for implementing the steps of the method for hard disk identification according to any one of the above claims when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of hard disk identification according to any of the preceding claims.
The hard disk identification method provided by the application comprises the following steps: when the equipment is powered on and started or the hard disk is inserted into the equipment, reading the unique identifier of the hard disk; judging whether a ciphertext exists in a reserved area of the hard disk; if so, reading the ciphertext, and decrypting the ciphertext into a plaintext by combining a preset key; judging whether the plaintext is the same as the unique identifier; and if the plaintext is different from the unique identifier, forbidding to use the hard disk.
According to the technical scheme provided by the application, the ciphertext is preset for the hard disk, so that when the equipment is powered on and started or the hard disk is inserted into the equipment, the unique identifier of the hard disk is read, and whether the ciphertext exists in the reserved area of the hard disk or not is judged; if so, reading the ciphertext, and decrypting the ciphertext into a plaintext by combining a preset key; judging whether the plaintext is the same as the unique identifier; if the plaintext is different from the unique identifier, the hard disk is forbidden to be used, so that the risk that a user replaces the hard disk provided by a non-server/storage manufacturer by himself is avoided, the problem that the reliability of the server/storage equipment is reduced is further avoided, and the probability of huge loss is reduced. The application also provides a system, equipment and computer readable storage medium for hard disk identification, which have the beneficial effects and are not repeated herein.
Detailed Description
The core of the application is to provide a method, a system, equipment and a computer readable storage medium for hard disk identification, which are used for preventing a user from replacing a hard disk provided by a non-server/storage manufacturer by himself.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For the server/storage device, it is required to have good reliability because the loss and cost of data loss, shutdown and line stop caused by hard disk failure are huge, and the maintenance cost is high, so the hard disk used by the server/storage device is generally an industrial hard disk, and the stability and reliability of the industrial hard disk are much higher than those of a consumer hard disk.
However, for the user, considering the cost or data transfer, the hard disk provided by the server/storage manufacturer may be replaced by the consumer hard disk by himself, which causes the reliability of the server/storage device to be reduced and even brings huge loss and cost, and based on this, the present application provides a method for identifying the hard disk, which is used for solving the above problems.
Referring to fig. 1, fig. 1 is a flowchart of a hard disk identification method according to an embodiment of the present disclosure.
The method specifically comprises the following steps:
s101: when the equipment is powered on and started or the hard disk is inserted into the equipment, reading the unique identifier of the hard disk;
the unique identifier of the hard disk mentioned herein may specifically include, but is not limited to, at least one of a hard disk ID, an SN code, and a PN code.
S102: judging whether a ciphertext exists in a reserved area of the hard disk;
if yes, go to step S103;
optionally, when the cipher text is not stored in the reserved area of the hard disk, it is proved that the hard disk is not a hard disk provided by a server/storage manufacturer, and a consumer-grade hard disk replaced by a user with a high probability is provided, and at this time, the hard disk can be prohibited from being used, so as to further avoid the problem of reliability reduction of the server/storage device, and reduce the probability of occurrence of huge loss.
S103: reading the ciphertext, and decrypting the ciphertext into a plaintext by combining a preset key;
optionally, the ciphertext mentioned here is obtained by encrypting the unique identifier in combination with a preset key, and the ciphertext is set for the hard disk meeting the requirement in advance, so that the hard disk can be used by the device, where the process of setting the ciphertext for the hard disk in advance mentioned here may specifically be:
determining the level of the hard disk according to the input customization requirement;
encrypting the unique identifier of the hard disk by using the secret key corresponding to the hard disk level to obtain a ciphertext;
and writing the cipher text into the reserved area of the hard disk.
The encryption mentioned here may be encryption according to a preset symmetric encryption algorithm, which may include but is not limited to at least one of AES encryption algorithm, DES encryption algorithm, SM4 encryption algorithm, and the server/storage vendor may select according to the actual production environment;
when the reserved area of the hard disk has the ciphertext, the hard disk is indicated to be a hard disk provided by a server/storage manufacturer possibly, the ciphertext is read at the moment, and the ciphertext is decrypted into a plaintext by combining a preset key, so that whether the hard disk is the hard disk provided by the server/storage manufacturer is judged by judging whether the plaintext is the same as the unique identifier;
optionally, the ciphertext is decrypted into a plaintext by combining with a preset key, where the preset key may specifically be a key set by a server/storage manufacturer according to conditions such as a production environment, or may also be a key acquired by logging in a preset website by a system.
S104: judging whether the plaintext is the same as the unique identifier;
if not, the step S105 is executed;
when the plaintext is different from the unique identifier, the plaintext indicates that the hard disk and the device may not be manufactured by the same server/storage manufacturer, or the hard disk and the device belong to different grades, that is, the hard disk does not meet the requirements of the device, and the hard disk is forbidden at this moment;
optionally, when the plaintext is the same as the unique identifier, the hard disk can be normally used
S105: the hard disk is prohibited from being used.
Preferably, after the hard disk is forbidden to be used, prompt information that the hard disk does not meet the standard can be output, so that a user can replace the hard disk meeting the requirement in time.
Based on the technical scheme, the method for identifying the hard disk, provided by the application, has the advantages that the cipher text is preset for the hard disk, so that when equipment is powered on and started or the hard disk is inserted into the equipment, the unique identifier of the hard disk is read, and whether the cipher text exists in the reserved area of the hard disk or not is judged; if so, reading the ciphertext, and decrypting the ciphertext into a plaintext by combining a preset key; judging whether the plaintext is the same as the unique identifier; if the plaintext is different from the unique identifier, the hard disk is forbidden to be used, so that the risk that a user replaces the hard disk provided by a non-server/storage manufacturer by himself is avoided, the problem that the reliability of the server/storage equipment is reduced is further avoided, and the probability of huge loss is reduced.
For the step S103 of the previous embodiment, the ciphertext is decrypted into a plaintext by combining with the preset key, and specifically, the corresponding key may also be selected according to the device level of the current device, which is described below with reference to fig. 2.
Referring to fig. 2, fig. 2 is a flowchart illustrating an actual representation manner of S103 in the method for identifying a hard disk provided in fig. 1.
The method specifically comprises the following steps:
s201: acquiring the equipment level of the current equipment;
the device classes referred to herein may be specifically classified as low-end, medium-end, high-end devices.
S202: searching a key corresponding to the equipment level in a preset key table;
s203: the cipher text is decrypted into plaintext in combination with the key.
The equipment level can be divided according to the application environment and the equipment attribute of the equipment, and the equipment in different levels has different requirements on the rotating speed, the medium and the interface type of the hard disk, so that when the cipher text is set for the hard disk, the hard disks with different attributes can be encrypted by different secret keys, and based on the cipher text encryption method, when the cipher text is decrypted into the plaintext by combining with the preset secret key, the equipment level of the current equipment is firstly obtained; then, a secret key corresponding to the equipment level is searched in a preset secret key table; and finally, the cipher text is decrypted into a plaintext by combining the key, and the decryption of the cipher text is completed.
Referring to fig. 3, fig. 3 is a structural diagram of a hard disk identification system according to an embodiment of the present disclosure.
The system may include:
the reading module 100 is configured to read a unique identifier of a hard disk when the device is powered on and started or the hard disk is inserted into the device;
a first judging module 200, configured to judge whether a ciphertext exists in a reserved area of the hard disk;
the decryption module 300 is configured to, when a ciphertext exists in the reserved area of the hard disk, read the ciphertext and decrypt the ciphertext into a plaintext by combining with a preset key;
a second judging module 400, configured to judge whether the plaintext is the same as the unique identifier;
a first disabling module 500 for disabling the hard disk when the plaintext is different from the unique identifier.
Referring to fig. 4, fig. 4 is a block diagram of another hard disk identification system according to an embodiment of the present disclosure.
The decryption module 300 may include:
the obtaining submodule is used for obtaining the equipment level of the current equipment;
the searching submodule is used for searching the secret key corresponding to the equipment level in a preset secret key table;
and the decryption submodule is used for decrypting the ciphertext into a plaintext by combining the key.
The system may further comprise:
and the second forbidding module is used for forbidding to use the hard disk when the cipher text is not stored in the reserved area of the hard disk.
The system may further comprise:
the determining module is used for determining the hard disk grade according to the input customization requirement;
the encryption module is used for encrypting the unique identifier of the hard disk by using the secret key corresponding to the hard disk level to obtain a ciphertext;
and the writing module is used for writing the ciphertext into the reserved area of the hard disk.
The various components of the above system may be practically applied in the following embodiments:
when the equipment is powered on and started or the hard disk is inserted into the equipment, the reading module reads the unique identifier of the hard disk; the first judging module judges whether a ciphertext exists in a reserved area of the hard disk or not; when the reserved area of the hard disk does not contain the ciphertext, the second forbidding module forbids to use the hard disk;
when a cipher text is stored in a reserved area of the hard disk, the obtaining submodule obtains the equipment level of the current equipment; the searching submodule searches the secret key corresponding to the equipment level in a preset secret key table; the decryption submodule decrypts the ciphertext into a plaintext by combining the secret key; the second judging module judges whether the plaintext is the same as the unique identifier; when the plaintext is different from the unique identifier, the first disabling module disables the hard disk; the output module outputs prompt information that the hard disk does not meet the standard.
Referring to fig. 5, fig. 5 is a structural diagram of a hard disk identification device according to an embodiment of the present application.
The hard disk identification device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 622 (e.g., one or more processors) and memory 632, one or more storage media 630 (e.g., one or more mass storage devices) storing applications 642 or data 644. Memory 632 and storage medium 630 may be, among other things, transient or persistent storage. The program stored in the storage medium 630 may include one or more modules (not shown), each of which may include a sequence of instructions operating on the device. Still further, the central processor 622 may be configured to communicate with the storage medium 630 and execute a series of instruction operations in the storage medium 630 on the hard disk identification device 600.
Hard disk identification apparatus 600 may also include one or more power supplies 626, one or more wired or wireless network interfaces 650, one or more input-output interfaces 658, and/or one or more operating systems 641, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps in the hard disk identification method described in fig. 1 to 2 above are implemented by the hard disk identification device based on the structure shown in fig. 5.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the module described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a function calling device, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The method, system, device and computer readable storage medium for hard disk identification provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.