Disclosure of Invention
The invention mainly aims to provide a password processing method, which aims to ensure the password safety and simultaneously realize accurate password reading, thereby improving the success rate of password use.
In order to achieve the above object, the present invention provides a cryptographic processing method, including the steps of:
acquiring encryption state information corresponding to a network access point, and acquiring password information of the network access point;
generating a password file according to the encryption state information and the password information;
and correspondingly storing the password file and the encryption state information at a preset storage position corresponding to the network access point.
Optionally, the step of generating a password file according to the encryption state information and the password information includes:
when the encryption state information is first state information, encrypting the password information by adopting a preset encryption algorithm;
and writing the encrypted password information into a preset file to obtain the password file.
And when the encryption state information is second state information, writing the password information into the password file.
Optionally, the step of obtaining the password information of the network access point includes:
acquiring a plaintext password of the network access point;
generating a corresponding characteristic field according to the encryption state information;
and generating the password information according to the characteristic field and the plaintext password.
Optionally, the step of generating cipher information according to the characteristic field and the plaintext cipher includes:
combining the characteristic field and the plaintext password to form a splicing code;
and carrying out printable character coding on the spliced code by adopting a preset coding mode.
Optionally, the step of performing printable character encoding on the spliced field in a preset encoding manner includes:
and encoding the spliced field by adopting a Base64 encoding mode.
Optionally, the step of acquiring encryption status information corresponding to the network access point includes:
issuing inquiry information as to whether a password of the network access point is encrypted;
receiving feedback information based on the query information;
and determining the encryption state information according to the feedback information.
In addition, in order to achieve the above object, the present application also proposes another cryptographic processing method, which includes the following steps based on the cryptographic file saved by the first cryptographic processing method:
when a login instruction of a network access point is received, acquiring encryption state information and a password file in a preset storage position;
analyzing the information in the password file according to the encryption state information to obtain password information;
and acquiring a login password of the network access point based on the password information.
Optionally, the analyzing information in the password file according to the encryption state information, and the step of obtaining password information includes:
when the encryption state information is first state information, decrypting information in the password file by adopting a preset decryption algorithm to obtain the password information;
and when the encryption state information is second state information, taking the information in the password file as the password information.
Optionally, the step of obtaining a login password of the network access point based on the password information includes:
when the password information is in a Base64 encoding format, decoding the password information by adopting a Base64 decoding mode to obtain code information;
and extracting the login password from the code information.
Optionally, the step of extracting the login password from the code information includes:
determining a characteristic field according to the encryption state information;
and intercepting codes outside the characteristic field in the code information as the login password.
In addition, in order to achieve the above object, the present application also proposes a control device including: a memory, a processor and a cryptographic processing program stored on the memory and executable on the processor, the cryptographic processing program, when executed by the processor, implementing the steps of the cryptographic processing method as claimed in any one of the above.
In addition, in order to achieve the above object, the present application also proposes a network device including the control apparatus as described above.
In addition, in order to achieve the above object, the present application also proposes a readable storage medium, on which a cryptographic processing program is stored, the cryptographic processing program implementing the steps of the cryptographic processing method as described in any one of the above when executed by a processor.
The invention provides a password processing method, which generates a password file according to encryption state information and password information of a network access point and stores the password file, can judge the encryption state of the password information according to the encryption state information when a subsequent network access point logs in to call a password in the password information, and carries out differentiation processing on the password information based on the encryption state, thereby avoiding that the password cannot be used due to messy codes obtained by analyzing the password information in an improper mode when the password in the password file is analyzed subsequently, realizing accurate and effective extraction of the password in the password information based on the encryption state, ensuring the safety of the password and realizing accurate reading of the password, and further improving the success rate of password use.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows: acquiring encryption state information corresponding to a network access point, and acquiring password information of the network access point; generating a password file according to the encryption state information and the password information; and correspondingly storing the password file and the encryption state information at a preset storage position corresponding to the network access point.
In the prior art, some passwords are encrypted and then stored, so that the security of the passwords is improved. However, since not all passwords are encrypted and stored, when a password is acquired, if a password that is not encrypted is decrypted, a messy code is likely to occur, and the password cannot be normally used.
The invention provides the solution, and aims to ensure the password safety and simultaneously realize the accurate password reading, thereby improving the success rate of password use.
The invention provides a control device which can be applied to processing network related passwords (such as login passwords).
In an embodiment of the present invention, referring to fig. 1, a cryptographic processing apparatus includes: a processor 1001 such as a CPU, a memory 1002, a network interface 1003, and the like. The memory 1002 may be a high-speed RAM memory or a non-volatile memory such as a disk memory. The memory 1002 may alternatively be a storage device separate from the processor 1001. The memory 1002 and the network interface 1003 are both connected to the processor 1001. Here, the network interface 1003 specifically refers to an interface for accessing the internet or a local area network.
Those skilled in the art will appreciate that the configuration of the device shown in fig. 1 is not intended to be limiting of the device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a password processing program may be included in the memory 1002, which is a readable storage medium. In the apparatus shown in fig. 1, the processor 1001 may be configured to call a cryptographic processing program stored in the memory 1002 and perform operations of relevant steps of the cryptographic processing method in the following embodiments.
The invention also provides a password processing method which is mainly applied to processing of network passwords in the android system.
Referring to fig. 2, a first embodiment of the cryptographic processing method of the present invention is provided, where the cryptographic processing method includes:
step S10, acquiring encryption state information corresponding to a network access point, and acquiring password information of the network access point;
the encryption state information is specifically state feature information representing whether the password is subjected to encryption processing. When a preset instruction (such as an instruction for logging in the network access point for the first time) is received, the encryption state information corresponding to the network access point can be acquired. The network access point is specifically an access channel for accessing a preset network. Specifically, the network access point herein refers to a WIFI hotspot. Different network access points are correspondingly provided with different encryption state information. The encryption status information may be specifically configured by default by the network, or may be obtained by acquiring a parameter set by the user. The encryption status information may specifically comprise first status information characterizing that encryption is required and second status information characterizing that encryption is not required. And each network access point can be correspondingly configured with a flag parameter for representing the encryption state information. The flag parameter value of 1 can be used as the representation of the first state information, and the flag parameter value of 2 can be used as the standard of the second state information. Accordingly, the read flag value can be used as encryption state information.
Specifically, the step of acquiring the encryption status information corresponding to the network access point includes: issuing inquiry information as to whether a password of the network access point is encrypted; receiving feedback information based on the query information; and determining the encryption state information according to the feedback information. Specifically, the query information may be sent out in a manner of text display, voice prompt, or the like, and the user may input the feedback information by operating the network device or the like after receiving the query information. The feedback information includes first information about that encryption is required and second information about that encryption is not required. Therefore, when the feedback information is the first information, the encryption state information is determined to be the first state information; and when the feedback information is the second information, determining that the encryption state information is the second state information.
In addition to the encryption status information characterizing whether or not to encrypt, in other embodiments, the encryption status information may also characterize how to encrypt. Specifically, different encryption algorithms may be provided, and different encryption algorithms characterize different encryption state information.
The password information specifically refers to relevant information representing a password for logging in the network access point, and may specifically be a plaintext password input by the user, or may be password representation information obtained after processing the plaintext password input by the user. Therefore, the plaintext password in the parameters input by the user can be directly read as the password information; and after the plaintext password input by the user is read, the plaintext password is processed according to a preset mode to obtain password information.
Step S20, generating a password file according to the encryption state information and the password information;
different encryption state information corresponds to different password information processing methods, and can be specifically set according to actual use requirements. And determining a password information processing method corresponding to the encryption state information, and generating a password file after processing the password information by adopting the determined password information processing method. For example, when the encryption state information specifically includes first state information and second state information, and when the encryption state information is the first state information, the password information is processed in a first manner to obtain a password file; and when the encryption state information is second state information, processing the password information in a second mode to obtain a password file.
And step S30, correspondingly storing the password file and the encryption state information at a preset storage position corresponding to the network access point.
Different preset storage positions are correspondingly arranged on different network access points and used for storing all related data of the network access points, so that the password file and the encryption state information are stored in the preset storage positions, and when the network access points are subsequently logged in, the passwords of the network access points can be read from the preset storage positions so as to realize the logging-in of the network access points. Specifically, the password file and the encryption state information are both stored in the wpa _ supplicant.conf corresponding to the current network access point.
The password processing method provided by the embodiment of the invention generates and stores the password file according to the encryption state information and the password information of the network access point, can judge the encryption state of the password information according to the encryption state information when the password in the password information needs to be called when the network access point logs in subsequently, and carries out differentiation processing on the password information based on the encryption state, so that the problem that the password cannot be used due to the fact that the password is garbled by analyzing the password information in an improper mode when the password in the password file is analyzed subsequently is avoided, the password in the password information can be accurately and effectively extracted based on the encryption state, the password safety is ensured, and the password is accurately read at the same time, so that the success rate of the password use is improved.
Further, based on the first embodiment, a second embodiment of the cryptographic processing method is provided. In the second embodiment, referring to fig. 3, the step S20 includes:
when the encryption state information is first state information, executing step S21 and step S22; when the encryption status information is the second status information, step S23 is performed.
The first state information is state information representing that the password needs to be encrypted; the second state information is state information characterizing that the password does not require encryption.
S21, encrypting the password information by adopting a preset encryption algorithm;
the preset encryption algorithm may be a pre-designated algorithm for encrypting the password. In addition, the preset encryption algorithm may further be an algorithm for encrypting the password determined based on the first state information. Different first state information may correspond to different preset encryption algorithms.
The preset encryption algorithm may specifically include at least one of a DES encryption algorithm, an AES encryption algorithm, and an RSA encryption algorithm.
Step S22, writing the encrypted password information into a preset file to obtain the password file;
and step S23, writing the password information into the password file.
In this embodiment, the encryption state information is used for performing differential processing of encryption and non-encryption on the password information, so that the password of the network access point can be stored according to the user requirement, for example, the password of the public network can be processed in a non-encryption manner, the efficiency of reading the subsequent password can be improved, and the password of the private network can be processed in an encryption manner, so that the security of the password is ensured.
Further, based on any of the above embodiments, a third embodiment of the cryptographic processing method of the present application is provided. In a third embodiment, referring to fig. 4, the step of acquiring the password information of the network access point includes:
step S11, acquiring a plaintext password of the network access point;
specifically, the plaintext password may be obtained by reading login information input by the user. For example, if the user sets the login password of the access point to "abc123" in the network access point, the user can read "abc123" to obtain the plaintext password.
Step S12, generating a corresponding characteristic field according to the encryption state information;
different encryption status information corresponds to different characteristic fields. Specifically, when the flag value representing the encryption state information is 1, the corresponding characteristic field is true; when the flag value representing the encryption status information is 2, the corresponding characteristic field is false.
And S13, generating the password information according to the characteristic field and the plaintext password.
And synthesizing the characteristic field and the plaintext password to obtain a code, and directly or after processing, obtaining password information.
In this embodiment, the password information is generated based on the feature field corresponding to the encryption state information and the plaintext password, so that the length of the stored password information can be increased, the difficulty of password cracking is increased, the password leakage when the system is invaded is effectively avoided, and the password security is improved.
Specifically, in the third embodiment, specifically, the step S13 may specifically include: combining the characteristic field with the plaintext cipher to form a concatenated code (e.g., "true abc 123"); and adopting a preset coding mode to carry out printable character coding on the splicing code. The preset encoding mode can be set according to actual requirements, for example, the splicing field is encoded by adopting a Base64 encoding mode. Through carrying out printable character coding on the spliced code, the problem that a messy code is formed during encryption to cause that an accurate plaintext password cannot be decrypted when special characters or spaces exist in the password can be avoided, so that the integrity during password storage and the accuracy during password reading are further improved.
Further, based on any of the above embodiments, a fourth embodiment of the cryptographic processing method of the present application is provided. In a fourth embodiment, referring to fig. 5, the cryptographic processing method includes the steps of:
step S100, when a login instruction of a network access point is received, encryption state information and a password file in a preset storage position are obtained;
the login instruction is specifically sent by a user operating a network device, and can also be automatically generated when the system detects the network disconnection. And reading the encryption state information and the password file in a preset storage position corresponding to the network access point. Specifically, the flag value is read as the encryption state information.
Step S200, analyzing the information in the password file according to the encryption state information to obtain password information;
the information in the password file is specifically information characterizing the password of the network access point. And determining the analysis mode of the information in the password file based on the encryption state information, and processing the information in the password file by adopting the determined analysis mode to obtain the password information representing the login password.
Specifically, when the encrypted state information is first state information, decrypting information in the password file by using a preset decryption algorithm to obtain the password information; and when the encryption state information is second state information, taking the information in the password file as the password information. The predetermined decryption algorithm is a processing algorithm that is the inverse process of the predetermined encryption algorithm in the above embodiment. The encryption state information is first state information, which indicates that the information in the password file is encrypted in the storage process, and the information needs to be decrypted to obtain password information representing the login password; the encryption state information is second state information which indicates that the information in the password file is not encrypted in the storage process, and the password information representing the login password can be obtained without decryption.
And step S300, acquiring a login password of the network access point based on the password information.
When the password information is a plaintext password, the password information can be directly used as a login password; when the password information is not a plaintext password, the password information can be further analyzed to obtain a login password. Specifically, when the password information is in a Base64 encoding format, decoding the password information by adopting a Base64 decoding mode to obtain code information; and extracting the login password from the code information. In the process of extracting the login password from the code information, whether a characteristic field corresponding to encryption state information is added in the code information or not can be judged, if yes, the characteristic field is determined according to the encryption state information, and codes except the characteristic field are intercepted from the code information to serve as the login password; if not, the code information can be directly used as the login password. The method comprises the steps that setting parameters of a system can be obtained, and whether a characteristic field corresponding to encryption state information is added in code information or not is judged according to the setting parameters; and if the code information does not exist, the code information is indicated to be not added with the characteristic field corresponding to the encryption state information.
In this embodiment, when the network access point logs in, the information in the password file is analyzed based on the encryption state information, so that differential analysis of the information in the password file is realized based on different encryption states, the accuracy of the obtained login password is ensured, and the network access point can be successfully logged in. Whether the password is encrypted in the storage process is judged based on the encryption state information, if so, the login password is extracted after the password file is processed by a decryption algorithm, and if not, the login password is directly extracted without decryption, so that the condition that the password file which is not encrypted is processed by the decryption algorithm to obtain messy codes is avoided, the login password corresponding to the network access point can be accurately and successfully obtained, and the network access point is successfully logged in. Furthermore, the accurate extraction of the login password can be realized by correspondingly decoding the code mode during password storage and identifying the characteristic field.
In addition, an embodiment of the present invention further provides a network device, where the network device includes the control apparatus in the foregoing embodiment. The control device manages the network password according to the relevant steps in any embodiment of the password processing method, so that the password storage safety is guaranteed, and meanwhile, the password can be successfully and accurately extracted. .
In addition, an embodiment of the present invention further provides a readable storage medium, where a cryptographic processing program is stored on the readable storage medium, and when the cryptographic processing program is executed by a processor, the cryptographic processing program implements the relevant steps of any embodiment of the cryptographic processing method.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, a network device, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.