A computer software encryption protection method
Through the two-factor authentication of CPU identity key and ECDSA algorithm, combined with behavior monitoring of TOTP and machine learning models, the problem of insufficient security of traditional identity authentication and behavior monitoring is solved, and high-intensity user identity authentication and behavior monitoring is achieved to ensure that System security.
Patent Information
- Application Number
- CN202410239780.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-03-04
AI Technical Summary
Traditional user authentication methods have insufficient security and are susceptible to password cracking and identity impersonation attacks. Traditional behavior monitoring methods are difficult to accurately identify abnormal behaviors, resulting in the existence of security vulnerabilities.
The CPU identity key and ECDSA algorithm are used for two-factor authentication, and a one-time password is generated through the TOTP algorithm for the second verification. Combined with the machine learning model, a behavior baseline model is established to identify abnormal behaviors, and a user account is locked.
It significantly improves the security strength of user identity verification, prevents fake identity theft of important data, monitors user operation behavior in real time, takes protective measures quickly, protects the system security, and enhances the encryption strength and the accuracy of behavior monitoring.
Smart Images

Figure CN118051891B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software security technology, and in particular to a computer software encryption protection method. Background Art
[0002] With the widespread application of computer software in daily life and business, the demand for data security and user privacy protection is growing. However, traditional user identity authentication methods have insufficient security and are vulnerable to attacks such as password cracking and identity impersonation. At the same time, monitoring and analyzing user behavior has become crucial to cope with evolving network threats and internal security risks. Therefore, seeking a comprehensive computer software encryption protection method that can effectively authenticate identities and monitor user behavior has become an urgent problem to be solved.
[0003] Traditional user authentication methods often rely on simple username and password combinations, which are vulnerable to password guessing and dictionary attacks. In addition, a single authentication method cannot provide sufficient security and can be easily bypassed or impersonated. At the same time, traditional behavior monitoring methods usually lack in-depth analysis of user behavior and have difficulty accurately identifying abnormal behavior, resulting in security vulnerabilities. Therefore, a comprehensive solution that combines cryptography technology and machine learning methods is needed to improve the security and accuracy of user authentication and behavior monitoring.
[0004] In the related art, Chinese patent document CN113780817A1 provides a software protection method, device, system, CPU chip and electronic device, wherein the software protection method is applied to the computing core in the CPU chip of the user device, and the method includes: after detecting the trigger operation of the user to use the software, instructing the security processor SP to perform the identity identification of the user device, wherein the identity identification includes: using the public key in the signature certificate to verify the user certificate, and using the private key derived from the CPU chip identity key to verify the public key in the user certificate; if the SP successfully identifies the user device identity, the user is allowed to use the software. However, this solution only relies on the public key signature verification of the signature certificate, and cannot prevent the certificate from being tampered with or forged. Summary of the invention
[0005] 1. Technical problems to be solved
[0006] In view of the low security problem of encryption software in the prior art, the present application provides a computer software encryption protection method, which improves the security of encryption software by performing double identity authentication through CPU identity key and ECDSA algorithm.
[0007] 2. Technical solution
[0008] The purpose of this application is achieved through the following technical solutions.
[0009] The embodiment of the present specification provides a computer software encryption protection method, including: using the identity key of the CPU to encrypt the account password input by the user to generate a digital signature A1; obtaining the stored user identity information, using the public key corresponding to the identity key of the CPU to sign the obtained user identity information, and generating a digital signature A2; matching the digital signature A1 and the digital signature A2, if they are consistent, passing the preliminary verification of the user identity; when the preliminary verification passes, receiving the one-time password TOTP1 input by the user; and using the time seed synchronized with the user, generating the one-time password TOTP2 at the current moment through the TOTP algorithm, matching the generated one-time password TOTP2 with the received one-time password TOTP1, if they are consistent, passing the second verification; when the second verification passes, lifting the access restriction on the encryption software and allowing the user to access the encryption software; obtaining the behavior data of the user accessing the encryption software including the login time, login location and access operation, and establishing a behavior baseline model according to the behavior data; using a machine learning model to detect the user's behavior baseline model, and when an abnormality is detected, locking the user account and denying access; the time seed is generated by the system clock and random number of the CPU.
[0010] Among them, the CPU identity key refers to the encryption key that is solidified (hard-coded) inside the secure and reliable CPU chip, and the key is used to prove the identity of the CPU. In this application, the account password entered by the user is encrypted and signed to generate a digital signature A1. Here, the CPU identity key is used as the private key of the ECDSA algorithm, and the password is signed based on the private key, which can prove that the signature comes from a trusted CPU. The corresponding public key is used to verify the validity of the signature A1. Here, the CPU identity public key corresponds to the private key, which is used by the recipient to verify the legitimacy of the signature. Since the identity key exists inside the CPU hardware and cannot be read or tampered with, the signature authentication based on the key is reliable and trustworthy. The signature generated using the hardware key is more secure and difficult to be imitated or forged.
[0011] Among them, the TOTP algorithm is a time-based one-time password algorithm. Its full name is Time-based One-time Password algorithm. In this application, the TOTP algorithm uses a time seed and a hash algorithm to generate a dynamic one-time password. The time seed is synchronized in advance by the server and the client. After the preliminary verification is passed, the server generates a one-time password TOTP2 at the current moment. The password is calculated and generated by the TOTP algorithm based on the time seed synchronized between the server and the user. The client also independently calculates the current one-time password TOTP1 based on the same time seed and submits it to the server. After receiving the TOTP1 sent by the client, the server matches it with the TOTP2 generated by itself. If they are consistent, the second layer of verification is passed. This mechanism can prevent the password from being captured and used multiple times. A new one-time password is required for each verification, which is highly secure. Using the time seed to update the password can also prevent replay attacks.
[0012] Specifically, the account password entered by the user is securely encrypted to generate a digital signature A1 for subsequent user identity verification. The user enters the account password. The CPU identity key is used to perform password encryption operations to ensure that the encryption process is secure and reliable. The generated encrypted password and the CPU private key are used to execute the digital signature algorithm to generate a digital signature A1. The stored user identity information is obtained, and the user identity information is signed using the public key corresponding to the CPU identity key to generate a digital signature A2 for verifying the integrity of the user identity. The user's identity information, such as user name, permissions, etc., is obtained from secure storage. The digital signature algorithm is executed on the user identity information using the public key corresponding to the CPU identity key to generate a digital signature A2. The user identity is initially verified by matching digital signatures A1 and A2. The digital signature A1 entered by the user and the stored digital signature A2 are obtained. The digital signature verification is performed using the CPU's public key to ensure that A1 and A2 are generated by the same private key. If A1 and A2 match, the initial verification of the user identity is passed, and the user is allowed to continue to access the system.
[0013] Specifically, after the initial verification is passed, the one-time password TOTP1 provided by the user is received as the input for the second verification. After the user passes the initial verification, the system prompts the user to enter the one-time password TOTP1. Through the secure channel, the system receives and records the TOTP1 entered by the user. Using the time seed synchronized with the user, the one-time password TOTP2 at the current moment is generated through the TOTP algorithm. The system uses the time seed synchronized with the user (clock-based seed). Using the TOTP algorithm, combined with the time seed and the current moment, the one-time password TOTP2 at the current moment is generated. The generated one-time password TOTP2 is matched with the one-time password TOTP1 entered by the user to complete the second verification. The system obtains the TOTP1 entered by the user and the generated TOTP2. The matching operation of TOTP1 and TOTP2 is performed. If the match is successful, the second verification is passed and the system confirms that the user identity is valid. Through the synchronization of the TOTP algorithm and the time seed, different one-time passwords are generated at each moment. Through the matching of the TOTP1 entered by the user and the TOTP2 generated by the system, the verification of the user identity is further strengthened and the security of the system is improved. This method is highly effective in preventing security threats such as replay attacks and eavesdropping.
[0014] Specifically, after passing the second verification, the user is allowed to access the encryption software. After passing the second verification, the system removes the access restriction on the encryption software. The user can access the encryption software normally and perform corresponding operations. Collect the user's behavior data in the encryption software, including information such as login time, login location, and access operation. The system records the user's behavior data such as login time, login location, and access operation in the encryption software. The data may include the user's operation log, system log, etc. Establish a behavior baseline model based on the user's normal behavior data for subsequent anomaly detection. Use machine learning algorithms to analyze and model the user's normal behavior data. Establish a behavior baseline, including the user's typical login time, common location, and normal access operation. Use a machine learning model to compare the user's actual behavior with the behavior baseline to detect abnormal behavior. Use machine learning methods such as supervised learning or unsupervised learning to compare the user's actual behavior with the established behavior baseline. When the model detects abnormal behavior, trigger a security alarm or take corresponding security measures. When abnormal user behavior is detected, take corresponding security measures, such as locking the user account, denying access, etc. When the machine learning model detects abnormal behavior, the system can take security measures actively, such as locking the user account, sending security notifications, etc. The time seed is used to generate a one-time password that is synchronized with the user. It is generated by the CPU system clock and random numbers. The CPU system clock is used as part of the time seed to ensure time synchronization. Random numbers are introduced to increase the complexity of the seed and improve security. By comprehensively applying the steps of removing access restrictions, user behavior data collection, machine learning model detection and exception handling, and time seed generation, secure access and accurate monitoring of users in encryption software are achieved. By establishing a behavioral baseline model and introducing machine learning, the system can more flexibly adapt to normal behavioral changes of users and respond to abnormal behaviors in a timely manner, improving the overall security of the system.
[0015] Further, generating a digital signature A1 includes: obtaining the account password input by the user; using the elliptic curve digital signature algorithm ECDSA encryption engine in the CPU storing the Twisted Edwards curve parameters to generate the digital signature A1. The Twisted Edwards curve is an elliptic curve, which is a deformation constructed based on the Edwards curve. The general equation form of the Twisted Edwards curve is ax 2 +by 2 =1+dx 2 y 2, where a, b, d are the parameters of the curve, and x, y are the coordinates of the points on the curve. In this application, in the process of generating a digital signature, the user's account password is mapped to a point on the curve as the input of ECDSA, and then the ECDSA algorithm is run based on the constructed Twisted Edwards curve to generate a signature.
[0016] Furthermore, the elliptic curve digital signature algorithm ECDSA encryption engine in the CPU storing the Twisted Edwards curve parameters is used to generate a digital signature A1, including: constructing an improved Twisted Edwards curve equation: ax 2 +by 2 +cz 2 =1+dx 2 y 2 , where a, b, d are curve parameters, x and y are point coordinates; z is the third variable introduced, and c is the coefficient of variable z; obtain the account and password entered by the user; use the hash mapping algorithm to hash the account and password to a point on the constructed TwistedEdwards curve as the input point of the ECDSA encryption algorithm; generate a key pair using the ECDSA encryption algorithm based on the constructed Twisted Edwards curve; perform ECDSA encryption operation based on the Twisted Edwards curve, input point and key pair as input parameters to obtain a digital signature A1.
[0017] Specifically, the introduction of the third variable z increases the number of variables in the curve equation, making the curve equation more complex, the curve shape more diverse, and improving security strength. Attackers need to crack more complex curve equations, which increases the difficulty of cracking. By modulating z through the coefficient c of variable z, the degree of influence of z on the curve equation can be controlled, forming curve equations of various shapes, further enhancing security. The three-variable curve equation can define an elliptic curve in three-dimensional space, while the original two-variable curve equation can only define a curve on a two-dimensional plane, adding one dimension of complexity. In elliptic curve encryption, the introduction of variable z can be used to define the third coordinate of an elliptic curve point, increasing the complexity of representing points on the curve and improving security strength. Compared with fixed curve equations, the adjustable variables in the improved equation provide the ability to generate different curves, so that curve equation parameters can be customized for different users, improving the flexibility of encryption.
[0018] The hash mapping algorithm is an algorithm that maps data to a point on an elliptic curve. In this application, the user account password is obtained, and a hash value is generated using a hash algorithm (such as SHA256). The generated hash value is used as the horizontal coordinate x, and according to the improved Twisted Edwards curve equation ax 2 +by2 +cz 2 =1+dx 2 y 2 , and the ordinate y corresponding to x is obtained by calculation. The corresponding point on the curve is determined by the coordinate pair (x, y) as the input point of the ECDSA algorithm. In the ECDSA signature process, this point and the private key are used to perform the signature operation and output the signature. Through hash mapping, data of any length can be mapped to an elliptic curve point within a fixed domain, providing input for the elliptic curve encryption algorithm. Specifically, the following hash mapping algorithms can be used to map the account password to a point on the Twisted Edwards curve: SHA-256 hash mapping, SHA-3 hash mapping, Bloom filter mapping, or dynamic kx mapping.
[0019] More specifically, select the SHA3-512 hash algorithm, enter the expanded account password, and calculate the 512-bit hash value hash. Use the high 256 bits of the hash value hash as the horizontal coordinate x, and the low 256 bits as the vertical coordinate y. Substitute x and y into the Twisted Edwards curve equation: ax 2 +by 2 +cz 2 =1+dx 2 y 2 , determine the value of z by solving the calculation. Use the solved (x, y, z) as the three-dimensional coordinates of the input point to represent a point P on the curve. Convert the three-dimensional coordinate form of point P into a sequential string format as the input of the ECDSA algorithm.
[0020] Specifically, obtain the user account and password, and use hash mapping to calculate a point P on the Twisted Edwards curve as the input point. Select a random integer k, calculate r = pubkey × k to get the coordinates of point r, hash the account and password to calculate the hash value h, and calculate Output signature (r, s) as digital signature A1.
[0021] Furthermore, the ECDSA encryption algorithm is used to generate a key pair, including: selecting a random number seed S with a length of m bits; performing hash calculation using the SHA-256 algorithm to obtain hash(S); dividing hash(S) into a first part and a second part by interception, with the first part being used as a random number sequence; performing XOR with the random number seed S on the second part to obtain a random number seed S'; repeating the above hash calculation, updating the random number seed S', and outputting the first part as a random number sequence until the random number sequence is greater than a preset length; obtaining a random number with an ordinal number of Q in the random number sequence as a private key privkey; obtaining the point with the largest order in the Twisted Edwards curve as a generator P; and calculating a public key pubkey=privkey×P.
[0022] Specifically, a random binary sequence of length m bits is selected as the random number seed S. The value of m needs to be determined according to the security strength requirements, and is usually 256 bits or higher. The random number seed S is padded to meet the input length requirements of the SHA-256 algorithm. The padded seed is used as input to run the compression function and iterative operation of the SHA-256 algorithm. A 256-bit hash value output is obtained, namely hash(S). Through the hash operation of SHA-256, the statistical correlation existing in the random number seed can be eliminated and the unpredictability of the random number can be enhanced. Based on the output hash(S) as a new seed, the SHA-256 operation can be repeatedly performed for iterative reinforcement to output a stronger random number.
[0023] Specifically, the 256-bit hash value hash(S) generated in the previous step is divided into two parts, each of which is 128 bits long: the first part is the high 128 bits of hash(S), which is used as a random number sequence, and the second part is the low 128 bits of hash(S). The second part is bit-level XORed with the initial seed S to obtain a 128-bit new seed S': By intercepting and XORing, the new seed S' will have a lower correlation than the original seed S, improving unpredictability. Repeat SHA-256 based on S' to generate hash(S'), intercept and XOR to generate a new seed, and iterate to enhance randomness. Repeat the iteration to generate a random bit sequence of sufficient length as the random number input for key generation.
[0024] Specifically, repeat the hash operation to update the seed, perform SHA-256 operation on the seed S, generate hash(S), divide hash(S) into two equal parts, the first part is used as the random number sequence, and the second part is XORed with S to obtain a new seed S'. Replace S, use S' as the new seed, and return. Repeat until the accumulated random number sequence is greater than the preset private key length n. From the generated random number sequence, select a random number r with ordinal number Q as the private key privkey. Q can be a pre-selected fixed ordinal number or a random number that meets the requirements. Delete the generated intermediate results and only keep the final private key.
[0025] Among them, the order of a point on an elliptic curve refers to the minimum number of times that continuous point addition operations can return to the origin O. The maximum order means that the order of the point reaches the maximum value n on the curve. A generator refers to a group element with an order of group order n. For an elliptic curve group, its generator P refers to a curve point with an order of curve order n. In this application, a generator point P with the largest order on the Twisted Edwards curve, that is, equal to the curve order n, is selected. Such a point P can return to the infinite point O by performing point addition operations n times in a row, and n is the minimum positive integer multiple thereof. Using the generator point with the largest order can make the point multiplication result evenly distributed on the entire elliptic curve group, thereby improving the encryption strength.
[0026] Specifically, obtain the maximum order point on the Twisted Edwards curve, that is, the generator point P, construct the TwistedEdwards curve equation, and determine the curve parameters a, b, and d. The order n of the curve is obtained by mathematical calculation. Traverse all points on the curve as candidate generator points. Perform order calculation for each candidate point P: initialize the counter i=1. Repeat the point addition operation P+P,......., until point O is obtained. Record the minimum number of times i that reaches O, which is the order r of point P. Compare the number of counts r of all candidate points. Select a point with r equal to n as the generator point P. Store the generator point P for key generation and cryptographic operations. By traversing the search point with an order equal to the curve order n, the generator of the Twisted Edwards curve can be obtained, and then applied to subsequent elliptic curve cryptography operations.
[0027] Furthermore, the digital signature A1 includes an ordered pair (r, s) of a coordinate point r and an integer U; the coordinate point r: r = pubkey × k, k represents a random integer; the integer U: And round up; h represents the hash value obtained by performing a hash operation on the account and password data entered by the user through a hash algorithm.
[0028] Furthermore, the hash value h is calculated, including: initializing 8 32-bit constant values; obtaining the account password input by the user, and dividing it into data blocks of 512 bits; performing the following operations on each data block: performing Boolean logic operations and modulo 32 addition to calculate the compression function value; performing random permutation sorting on the calculated compression function value; performing modulo 32 addition on the permutation sorting result and the current hash value to update the hash value; iterating the calculation until all data blocks are processed; merging the calculated hash values and outputting a 256-bit value as the final hash value h.
[0029] Specifically, initialize 8 32-bit unsigned integer constant values IV1, IV2, ..., IV8 as initial vectors. Obtain the account password entered by the user and divide it into data blocks M1, M2, .... Mn according to 512 bits. For each data block Mi, perform the following: perform Boolean logic operations (AND, OR, XOR, etc.) with the constant IV to obtain 8 32-bit intermediate values, perform modulo 32 addition operations on the 8 intermediate values, calculate the modulo 32 addition results as the compression function output of the block, randomly permute and sort the compression function output, perform modulo 32 addition on the permutation results and the current cumulative hash value H, update the hash value H, repeat step 3, and process all data blocks. The final hash value H is used as the hash result of the account password. By implementing hash algorithms through operations such as Boolean operations, modular addition operations, and permutation, the hash strength can be improved and application data can be mapped consistently without collision.
[0030] Among them, Boolean logic operation refers to the logic operation performed on Boolean type values (0 or 1), and common ones are AND (&), OR (|), XOR (^), NOT (~), etc. In the present application, it is a bit-level logic operation on 32-bit unsigned integers. For example, an "XOR" operation is performed on two 32-bit values, and the corresponding bits are XORed. Among them, modulo 32 addition refers to the operation of adding two 32-bit unsigned integers and then taking the remainder of 232. It is equivalent to retaining only the lower 32 bits of the addition result. The compression function is a function that compresses and maps variable-length input to a fixed-length output. In the present application, modulo 32 addition is performed on multiple 32-bit intermediate values of the compression function. Here, the 32-bit integer value calculated by Boolean operation and modular addition is output as the compression function of the input block.
[0031] Specifically, divide the user account password into 512-bit blocks to obtain the data block sequence M1, M2, ..., Mn. Take each data block Mi in turn, perform Boolean logic operations, modular addition and permutation operations, and update the hash value H. Repeat the process until all data blocks are traversed. The account password is divided into m 512-bit blocks, and then iterative calculations are performed to obtain m 32-bit intermediate hash values H1, H2, ..., Hm. These m 32-bit hash values are connected in sequence to generate a 32*m-bit combination value. The combination value is padded and expanded to 256 bits, and then the lower 256 bits are intercepted as the final hash output h. By iterative calculation and hash merging, account passwords of arbitrary length can be hashed, and fixed-length hash values can be output as input for subsequent operations.
[0032] Furthermore, matching the digital signature A1 and the digital signature A2 includes: obtaining the digital signature A1, the digital signature A1 including the ordered pair (r, s) of the coordinate point r and the integer U; obtaining the digital signature A2 generated according to the user identity information and based on the LWE algorithm; using the locally stored LWE algorithm to decrypt the private key, performing LWE decryption on the user identity information in the digital signature A2, and obtaining the plaintext of the user identity information; performing a SHA256 hash operation on the obtained plaintext of the user identity information to generate a hash value e; inputting the coordinate point r, the integer U, the hash value e and the public key pubkey, and verifying the validity of the digital signature A1 through the ECDSA algorithm; if the verification is successful, the digital signature A1 and the digital signature A2 match, and the preliminary verification passes.
[0033] Among them, an ordered pair refers to a set containing two objects, where the order of the objects is important. Written in the form of (x, y), where x is the first object and y is the second object. In this application, the digital signature A1 is an ordered pair (r, s). r is a coordinate point in the signature, representing the first part of the signature. s is an integer representing the second part of the signature. As an ordered pair (r, s) of signatures, the order of r and s cannot be exchanged, otherwise the signature cannot be verified. Through the ordered pair representation, the signature can be represented as two related but semantically different components consisting of a coordinate point and an integer.
[0034] Among them, the LWE algorithm is a public key encryption algorithm based on the problem of learning with errors. It uses a random linear equation system and an error term to generate a public-private key pair, and performs encryption and signing operations. In this application, a random linear equation system is constructed to generate an LWE public-private key pair. The user identity information is signed using the private key, and the signature A2 is obtained by calculation. The correctness of the signature A2 can be verified using the corresponding public key. Specifically, the decryption private key of the LWE algorithm is taken out from the local secure storage. The private key is used to perform the LWE decryption operation on the input digital signature A2. After successful decryption, the plaintext of the user identity information contained in the signature can be obtained. The plaintext identity information obtained by decryption is hashed by SHA256. The plaintext information is input and passed through the compression function and iterative operation of SHA256. The output length is a hash value of 256 bits, denoted as e. The plaintext hash value e obtained by decryption is compared with the identity information hash value e' registered during the submitted signature process. If the two are consistent, the verification signature A2 passes and the user identity is legal; otherwise, the verification fails.
[0035] Specifically, use the ECDSA algorithm to verify the validity of the digital signature A1, input the verification material, the coordinate point r and the integer s, which form the digital signature A1, the hash value e of the user identity information, and the public key pubkey of the ECDSA algorithm. Calculate u1 and u2, Here n is the order of the curve. Calculate the point product, use u1 and u2 to perform point product operations with the public key pubkey respectively, and get two points Pu1 and Pu2 on the curve. Pu1=u1×pubkey, Pu2=u2×pubkey. Judge equality. If Pu1 and Pu2 are equal, the verification is successful and the signature A1 is valid. Otherwise, the verification fails and the signature is invalid. The two signatures match, indicating that the digital signature A1 has passed the verification and matches the signature A2, and the preliminary verification of the user's identity has passed.
[0036] Furthermore, a behavioral baseline model is established, including: obtaining behavioral data including login time, login location and access operations; parsing the login time, obtaining time granularity information, and dividing a day into 24-hour intervals as the characteristics of the time distribution histogram statistics; parsing the login location, obtaining address information, and dividing the address into two categories: inside the office area and outside the office area as the characteristics of the location distribution histogram statistics; parsing the access operation, and dividing the operation into two categories: read-write operation and setting operation as the characteristics of the operation distribution histogram statistics; using a one-dimensional discrete histogram statistical function to obtain a feature vector of the time distribution histogram statistics; using a binary statistical function to obtain a feature vector of the location distribution histogram statistics; using a binary statistical function to obtain a feature vector of the operation distribution histogram statistics; splicing the obtained feature vector of the time distribution histogram statistics, the feature vector of the location distribution histogram statistics, and the feature vector of the operation distribution histogram statistics as the statistical feature vector of the behavioral data.
[0037] Among them, the baseline model is a concept in machine learning, which refers to a standard model of normal behavior established. In this application, the normal login time, location and operation behavior data of the user on the encryption software are obtained. Based on these behavior data, a machine learning algorithm (such as LSTM neural network) is used to establish a user behavior baseline model. The model determines the characteristics of the user's normal time distribution, location distribution and operation distribution by learning the behavior data pattern. In subsequent monitoring, the new behavior data can be compared with the normal pattern generated by the baseline model to determine whether there is an abnormality. If the new data deviates significantly from the baseline, it indicates that the user behavior is abnormal, and the account may be stolen or there is an internal leak. By establishing a baseline model, the abnormal situation of user behavior can be monitored in real time, which plays a role in security monitoring of the encryption software. In short, the baseline model realizes real-time monitoring and risk identification of user behavior by patterning normal behavior.
[0038] Among them, the one-dimensional discrete histogram statistical function is a mathematical tool used to count and express the distribution of one-dimensional discrete data. The one-dimensional discrete histogram statistical function performs statistical analysis on the data of one-dimensional discrete variables, uses histogram bar charts to visualize its distribution characteristics, and can be converted into vectors for machine learning. This statistical analysis method is widely used to process data of categorical variables.
[0039] Among them, the binary statistical function is a function method for performing statistical counting on binary variables. In this application, the variables are divided into two categories, such as the location is divided into two categories: inside the office area and outside the office area. For each data sample, determine which category it belongs to. Perform statistical counting: the number of samples belonging to class 1 is recorded as n1, and the number of samples belonging to class 2 is recorded as n2. (n1, n2) is formed into a tuple to represent the statistical distribution of the binary variable. Using binary statistics for the location variable, the number of logins inside and outside the office area is obtained to form a location distribution feature vector. Using binary statistics for the operation variable, the number of read, write and set operations is obtained to form an operation distribution feature vector. These two feature vectors reflect the location and operation preferences of user behavior, and are input into the machine learning model to establish a behavioral baseline. During detection, the location and operation distribution of the new sample are compared with the baseline to determine the risk.
[0040] Specifically, obtain the user's login time, login location, and access operation behavior data on the encryption software. Parse the login time to obtain time granularity information, accurate to the hour level. Divide the 24 hours of a day into 24 intervals, count the distribution of user login times, and form time distribution characteristics. Parse the login location to determine whether it is inside or outside the office area, and divide it into two categories. Count the distribution of user logins in these two locations to form location distribution characteristics. Parse the access operation, read and write files and set software parameters, and divide them into two types of operations. Count the number of operations of the two types to form operation distribution characteristics. The above three characteristics can all be represented by a 24-interval histogram to reflect the user behavior pattern. These feature data will be input into the machine learning model to train the user behavior baseline. During detection, compare the difference between the new behavior and the baseline pattern to achieve risk identification.
[0041] Specifically, the 24 hours of a day are flattened into 24 intervals in chronological order as the horizontal axis of the histogram. The count of the interval in which the user's login time falls is increased by 1. Traverse all user login time data and count the number of logins in different time intervals. The number of logins in each time interval is used as the height of the corresponding interval histogram. Finally, a 24-column time distribution histogram is formed. This histogram reflects the distribution of users logging into the software at different times. The 24 column heights of the histogram form a 24-dimensional time feature vector. Each element value in the vector represents the statistical value of the number of logins in the time interval. This feature vector will be input into the machine learning model to train the baseline pattern of user time distribution. During detection, the distance between the new vector and the baseline vector is calculated to determine whether the time distribution is abnormal.
[0042] Specifically, the three feature vectors of time distribution, location distribution, and operation distribution have been extracted separately. The time distribution feature vector is 24-dimensional, indicating the login distribution in 24 time intervals. The location distribution feature vector is 2-dimensional, indicating the number of logins inside and outside the office area. The operation distribution feature vector is also 2-dimensional, indicating the number of read, write, and set operations. In order to comprehensively express the user behavior characteristics, the above three vectors need to be spliced together. Set the splicing order, first splice the time distribution, then the location distribution, and finally the operation distribution. In this order, connect the elements of the three vectors together in sequence. Obtain the final behavior statistical feature vector, with a dimension of 24+2+2=28 dimensions. This 28-dimensional vector, as a whole, reflects the time, location, and operation preferences of the user behavior. This feature vector will be input into the machine learning model to establish a user behavior baseline. When detecting risks, the difference between the new sample behavior vector and the baseline vector can be calculated.
[0043] Furthermore, a behavioral baseline model is established, including: using the obtained statistical feature vector to train an LSTM neural network as a behavioral baseline model. Among them, the full name of LSTM is Long Short-Term Memory network, which is a special recurrent neural network structure. In this application, the characteristic of the LSTM network is that it can learn the long-term dependencies of long sequence data. By inputting the statistical feature sequence of user behavior, LSTM can learn its timing law. The LSTM model is trained using the previously extracted behavioral statistical feature vector. The LSTM network structure contains memory units that can remember long-term behavior patterns. After model training, the LSTM network can establish a behavioral baseline for normal users. When a new user behavior vector is input, its deviation from the baseline can be calculated. If the deviation exceeds the preset threshold, it indicates that the user behavior is abnormal. Finally, the user behavior baseline modeling and risk identification based on the LSTM network are completed.
[0044] Specifically, user behavior data is obtained in the early stage, and statistical feature vectors of time, location, and operation are extracted. LSTM network model is constructed, and the input layer dimension is the same as the feature vector. The number of LSTM memory units is set to determine the network structure. Define the network output result, the probability of the user being normal or abnormal. Collect a large number of behavioral feature vector samples of normal users. Use these samples to train the LSTM network and learn the behavior pattern. Optimize the network parameters through the back propagation algorithm. Iterate the training multiple times to make the network output result consistent with the sample label. When the model training error is small enough, the network training process is completed. At this time, the trained LSTM network can represent the baseline of normal user behavior. For the new input behavior sample, the network output result is calculated to judge whether it is normal or abnormal. Finally, LSTM is used to obtain a behavioral baseline model that can detect abnormalities.
[0045] Furthermore, anomaly detection includes: using a behavior baseline model based on an LSTM neural network to detect the acquired behavior data, obtaining a detection score, and determining whether the user's behavior is abnormal based on the detection score.
[0046] Specifically, the LSTM model of the user behavior baseline has been trained in the previous section. Get new user behavior data and perform the same feature extraction. Input the extracted time, location, and operation feature vectors into the LSTM model. The LSTM model calculates the deviation of the behavior sample from the learned baseline pattern. The larger the deviation, the less the sample matches the normal behavior. Convert the deviation value to a detection score in the [0,1] interval as the final anomaly score. Set a threshold, and if the score exceeds 0.8, it is considered abnormal behavior. Based on the detection score, it can be determined whether the user's specific behavior is risky. Detect and score the user's multiple behaviors to comprehensively determine their risk level. If multiple behavior detections exceed the threshold, it is confirmed that the user is abnormal. Finally, the LSTM model is used to complete the detection and identification of risks.
[0047] 3. Beneficial effects
[0048] Compared with the prior art, the advantages of this application are:
[0049] The dual authentication mechanism using the ECDSA digital signature algorithm and the LWE encryption algorithm can significantly improve the security strength of user authentication compared to a single authentication algorithm and prevent forged identities from stealing important data.
[0050] Introducing TOTP time one-time password for the second level of verification can effectively resist replay attacks and prevent attackers from logging in and authenticating by recording user data;
[0051] Establish a behavior baseline model based on user behavior data and apply LSTM neural network for anomaly detection, which can monitor user operation behavior in real time. When abnormal behavior is detected, protective measures can be taken quickly to protect system security.
[0052] Improving the random number generation scheme of the ECDSA algorithm can enhance the randomness and unpredictability of private keys, prevent private keys from being predicted by attacks, and improve encryption strength;
[0053] The random permutation improvement of the hash algorithm can effectively resist attacks such as differential analysis and improve the security of cryptography;
[0054] Modeling with multi-dimensional features such as time, location, and operation can fully reflect user behavior patterns and improve the accuracy of the behavior baseline model;
[0055] Applying LSTM neural networks to perform powerful time series models can detect complex abnormal behavior patterns. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0057] Figure 1 is an exemplary flow chart of a computer software encryption protection method according to some embodiments of this specification;
[0058] Figure 2 is an exemplary flow chart of generating a digital signature A1 according to some embodiments of this specification;
[0059] Figure 3 is an exemplary flowchart of generating a fused feature vector according to some embodiments of this specification. DETAILED DESCRIPTION
[0060] The method and system provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0061] Figure 1 This is an exemplary flow chart of a computer software encryption protection method shown in some embodiments of this specification. For preliminary verification, the user enters the account and password, which are signed by the ECDSA encryption engine of the CPU to generate a digital signature A1. The locally stored user identity information is obtained, and the public key corresponding to the CPU is used to sign it to generate a digital signature A2. A1 and A2 are matched. If they are consistent, the user passes the preliminary verification. For the second verification, the user enters the one-time password TOTP1. Based on the time seed, a one-time password TOTP2 is generated by the TOTP algorithm. Compare TOTP1 and TOTP2. If they are consistent, the second verification passes. After both of the above verifications are passed, the access restrictions on the target software are lifted, allowing the user to use it normally. The user's login time, location, and operation behavior data are recorded. A user behavior baseline model is established through machine learning technology. Detect whether the user behavior is abnormal with the baseline model. If there is an abnormality, the user account is locked. The time seed is generated by the CPU clock and random numbers, and is synchronized and updated with the user end in real time.
[0062] Figure 2 The exemplary flow chart of generating a digital signature A1 according to some embodiments of the present specification includes: obtaining an account password input by a user, using the ECDSA encryption engine in the CPU, and performing a signature operation based on the stored Twisted Edwards curve parameters: constructing a Twisted Edwards curve equation, selecting parameters a=1, b=2, c=3, d=4, and the curve equation is: ax 2+by 2 +cz 2 =1+dx 2 y 2 , which constructs a specific TwistedEdwards curve. Map the account password hash to the curve point, the account is "alice", and the password is "password123". Perform SHA-256 hashing on the account password connection string to obtain a 256-bit hash value: 7c222fb2927d828af22f592134e8932480637c0d191e4fb63022ce85c0e02f85, and then convert this hash value into the coordinates (x, y) of a point on the curve as the input point. The mapping result is point (123, 456). Use this point as the input of the ECDSA signature. Select a random seed S, select a 128-bit random seed: S = 1010010110111100101110101011001. Perform SHA-256 hash calculation to obtain a 256-bit hash value: hash(S) = 110010100110111001, ........, 101010101101. XOR the second part with S as the new seed S': S' = 0100111010111000101101110101010. Repeat the SHA-256 calculation to update the seed and obtain more random number sequences. Specify Q = 250, then take the random number 1100101001 of sequence number 250 as privkey. Get the generator point P, calculate the order of the curve n=521 by mathematical methods, traverse the points (x, y) on the curve, point A (2, 3): set counter i=1, repeat the point addition operation A+A,..., until A+A+,.......,+A=O is obtained, record the smallest i=157, that is, the order of point A is 157. Find the point with order equal to n, repeat the above traversal, and find a point P (555, 666), whose order is calculated to be 521. Therefore, point P is determined to be the generator of the curve, and its maximum order is equal to the curve order n. The coordinates of the curve generator point P are (x, y)=(555, 666). Calculate the public key, using point multiplication operation: pubkey=privkey×P, where privkey is regarded as a large integer on the elliptic curve. Finally, the public key coordinates (X, Y) are obtained, (888, 999). In this way, the key pair (privkey, pubkey) is obtained for ECDSA signature.
[0063] Initialize 8 32-bit constants IV1, ......., IV8, get the account "alice", password "password123", and process them in blocks. The ASCII code of the account "alice" is split into the following 16-byte data blocks: 61, 6c, 69, 63, 65, 70, 61, 73, 73, 77, 6f, 72, 64, 31, 32, 33. Initial vector, set 8 32-bit initial vectors: IV1 = 0x11111111, IV2 = 0x22222222, ......., IV8 = 0x88888888. Boolean logic XOR operation, XOR the 16 bytes of account "alice" with IV: 61 XOR IV1 = 0x73, 6c XOR IV2 = 0x52, 69 XOR IV3 = 0x59, 63 XOR IV4 = 0x4c, 65 XOR IV5 = 0x64, ...., 33 XOR IV8 = 0x8b. Modulo 32 addition, add the XOR results modulo 32 in sequence: 0x73 + 0x52 = 0x125 mod 0x20 = 0x29, 0x29 + 0x59 = 0x082 mod 0x20 = 0x17, 0x17 + 0x4c = 0x063 mod 0x20 = 0x23, ...., 0x36 + 0x8b = 0x0c1 mod 0x20 = 0x11. The modular addition result of the previous step is randomly shuffled in permutation order: 23, 88, 62, 107, 39, 68, 41, 117. This completes the Boolean logic operation, modular addition and permutation processing of a data block. The IV is updated and the new IV is used as the initial vector for the next data processing block. Repeat the processing of all account data blocks, merge the output hashes, and concatenate them to obtain a 32*8=256-bit binary sequence as the final hash value h, h=IV1||IV2||,.......,||IV8, with a length of 256 bits, which is used as the message digest for subsequent signatures.
[0064] Verify the digital signature. A2 is a signature generated based on the LWE algorithm, which contains the user's identity information. Take out the decryption private key of the LWE algorithm from the local secure storage, take A2 as input, and use the LWE decryption algorithm and private key to perform decryption operations. If the decryption is successful, the original identity information plaintext contained in A2 can be extracted. Get the identity information plaintext after LWE decryption, such as "Alice#1990#CA", input the plaintext into the SHA256 hash function operation, divide the input into blocks, iterate the compression function operation for each data block, and output a 256-bit hash value as the hash result after the iterative operation. The obtained 256-bit hash value is used as e for subsequent signature verification. Input, r, s: coordinate points and integers in signature A1, e: SHA256 hash value of user identity information, pubkey: public key of ECDSA algorithm. n is the order of the elliptic curve, and the point multiplication operation is performed on the curve, n = 115792089237316195423570985008687907853269984665640564039457584007908834671663. s = 987654321, r = (x1, y1) / / coordinate point, e = 329947240237082359482345123463452134569, pubkey = (x, y) / / public key point, then:
[0065] Pu1=u1×pubkey=(x3,y3) / / Calculate the dot product of u1 and the public key. Pu2=u2×pubkey=(x4,y4) / / Calculate the dot product of u2 and the public key. If (x3,y3)==(x4,y4), the verification is successful.
[0066] Figure 3 This is an exemplary flow chart for generating a fusion feature vector according to some embodiments of this specification, so that the server can collect the log data uploaded by the client in real time, and store the log persistently in the database for preservation. The server parses the log data, extracts the time, location, and operation features, inputs the LSTM model for detection, and obtains the detection score. The server reads the client log data from the database, parses the log, extracts the time field as the time feature: divides the 24 hours of a day into 24 time periods, calculates the frequency of sample access to each time period as the time distribution, obtains a 24-dimensional time feature vector, extracts the location field as the location feature: divided into office and outside, counts the number of visits to the two types of locations, obtains a 2-dimensional location feature vector, extracts the operation field as the operation feature: divided into read and write operations, counts the number of operations of the two types, and obtains a 2-dimensional operation feature vector.
[0067] Specifically, the client log data format is: {timestamp: "2023-03-01 08:00:00", location: "office", operation: "read"}. The server receives the log and saves it to the logs table in the MySQL database. The log is read from the logs table and feature extraction is performed: the timestamp is parsed into hourly time periods: 08:00-09:00 hours is set as time period 1, and 09:00-10:00 hours is set as time period 2. The time period with the most times is set to 1, and the others are set to 0. The location is set to 1 for "office" and 0 for "outside". The operation is set to 1 for "read" and 0 for "write". The time feature vector time_fv = 0, 1, 0, 0, 1, ..., 0, the location feature vector loc_fv = [1, 0] (2D), and the operation feature vector op_fv = 1, 0.
[0068] Concatenate the three vectors to obtain a 28-dimensional fused feature vector, time feature (24 dimensions): [0.1, 0.2, 0.5, 0.3, ......., ......., 0.1], location feature (2 dimensions): [0.7, 0.3], operation feature (2 dimensions): [0.6, 0.4]. Concatenate the three vectors to obtain a 28-dimensional fused vector: [0.1, 0.2, 0.5, 0.3, ......., ......., 0.1, 0.7, 0.3, 0.6, 0.4]. Input to the trained LSTM model to obtain the detection score, input layer: 28 input nodes, matching 28-dimensional feature vector, hidden layer: 64 LSTM memory units, output layer: 1 output node, representing the detection score. Input feature vector: x = [0.1, 0.2, 0.5, 0.3, ......., ......., 0.1, 0.7, 0.3, 0.6, 0.4]. LSTM layer operation: x is input into the memory unit, and the four gate operations are performed in sequence to calculate the weights of the input gate, forget gate, and output gate, and the hidden state and memory unit are recursively updated. After being processed by the LSTM layer, the output layer obtains a score between (0, 1). In this example, the detection score of the LSTM output is 0.83. If the score exceeds the threshold, it is considered to be abnormal. The score of 0.83 exceeds the threshold of 0.8 and is determined to be an abnormal mode.
[0069] The detection module determines whether there is an abnormality based on the detection score. If an abnormality is detected, a response of access denial is returned to the client. The client receives the response and prompts the user account to be locked. The server records the log and locks the account.
[0070] The invention of the present application and its implementation methods are described schematically above. The description is not restrictive. Without departing from the spirit or basic features of the present application, the present application can be implemented in other specific forms. What is shown in the accompanying drawings is only one of the implementation methods of the invention of the present application. The actual structure is not limited to this. Any figure mark in the claims should not limit the claims involved. Therefore, if ordinary technicians in this field are inspired by it, without departing from the purpose of the present invention, they can creatively design structural methods and embodiments similar to the technical solution, which should all fall within the scope of protection of this patent. In addition, the word "include" does not exclude other elements or steps, and the word "one" before the element does not exclude the inclusion of multiple elements. The multiple elements stated in the product claim can also be implemented by one element through software or hardware. The words "first", "second", etc. are used to indicate names, and do not indicate any specific order.
Claims
1. A computer software encryption protection method, include: Use the CPU's identity key to encrypt the user's account password and generate a digital signature A 1 ; Obtain the stored user identity information, and generate a digital signature A based on the user identity information and the LWE algorithm 2 ; Match digital signature A 1 and digital signature A 2 , if they are consistent, the user's identity is initially verified; After the initial verification is passed, the one-time password TOTP entered by the user is received 1 ; and use the time seed synchronized with the user to generate the one-time password TOTP at the current moment through the TOTP algorithm 2 , generate a one-time password TOTP 2 and received one-time password TOTP 1 Matching is performed, and if they are consistent, the second verification is passed; After passing the second verification, the access restriction to the encryption software is lifted, allowing the user to access the encryption software; Obtain behavioral data of users accessing encryption software, including login time, login location, and access operations, and establish a behavioral baseline model based on the behavioral data; Use machine learning models to detect user behavior baseline models. When anomalies are detected, lock the user account and deny access. The time seed is generated by the CPU system clock and random numbers; Generate digital signature A 1 ,include: Get the account and password entered by the user; The digital signature A is generated by using the elliptic curve digital signature algorithm ECDSA encryption engine in the CPU that stores the Twisted Edwards curve parameters. 1 ; Match digital signature A 1 and digital signature A 2 ,include: Get digital signature A 1 , digital signature A 1 An ordered pair (r, s) consisting of a coordinate point r and an integer U, where s is an integer; Obtain the digital signature A generated based on the user identity information and the LWE algorithm 2 ; Use the locally stored LWE algorithm to decrypt the private key and sign the digital signature A 2 Perform LWE decryption on the user identity information in the image to obtain the plain text of the user identity information; Perform SHA256 hash operation on the plain text of the obtained user identity information to generate a hash value e; Input the coordinate point r, integer U, hash value e and public key pubkey, and verify the digital signature A through the ECDSA algorithm 1 effectiveness; If the verification is successful, the digital signature A 1 and digital signature A 2 Matched, preliminary verification passed.
2. The computer software encryption protection method according to claim 1, Features: The digital signature A is generated by using the elliptic curve digital signature algorithm ECDSA encryption engine in the CPU that stores the Twisted Edwards curve parameters. 1 ,include: Construct the improved Twisted Edwards curve equation: ax 2 +by 2 +cz 2 =1+dx 2 y 2 Among them, a, b, d are curve parameters, x and y are point coordinates; z is the third variable introduced, and c is the coefficient of variable z; Get the account and password entered by the user; Through the hash mapping algorithm, the account password is hashed and mapped to a point on the constructed Twisted Edwards curve as the input point of the ECDSA encryption algorithm; Generate a key pair using the ECDSA encryption algorithm based on the constructed Twisted Edwards curve; Perform ECDSA encryption operation based on the Twisted Edwards curve, input point and key pair as input parameters to obtain the digital signature A 1 .
3. The computer software encryption protection method according to claim 2, Features: Generate a key pair using the ECDSA encryption algorithm, including: Select a random number seed S with a length of m bits; Use the SHA-256 algorithm to perform hash calculation and obtain hash(S); The hash(S) is divided into the first part and the second part by interception, the first part is used as the random number sequence; the second part is XORed with the random number seed S to be the random number seed S'; Repeat the above hash calculation, update the random number seed S', and output the first part as the random number sequence until the random number sequence is greater than the preset length; Get the random number with sequence number Q in the random number sequence as the private key privkey; Get the point with the largest order in the Twisted Edwards curve as the generator P; Calculate the public key pubkey = privkey × P; The length of the first part and the second part is 128 bits.
4. The computer software encryption protection method according to claim 3, Features: The digital signature A1 contains an ordered pair (r, s) of a coordinate point r and an integer U, where s is an integer; Coordinate point r: r = pubkey × k, where k represents a random integer; Integer U: And round up; h represents the hash value obtained by performing a hash operation on the account and password data input by the user through a hash algorithm.
5. The computer software encryption protection method according to claim 4, Features: Calculate the hash value h, including: Initialize 8 32-bit constant values; Get the account and password entered by the user and split them into 512-bit blocks; Perform the following operations on each data block: Perform Boolean logic operations and modulo 32 addition to calculate the compression function value; Randomly permute and sort the calculated compression function values; Perform modulo 32 addition on the permutation sort result and the current hash value to update the hash value; Iterate the calculation until all data blocks are processed; Combine the calculated hash values and output a 256-bit value as the final hash value h; Wherein, obtaining the final hash value h includes: Obtain the account and password entered by the user, divide the input account and password into multiple data blocks according to the length of 512 bits, and obtain the data block sequence M1, M2, ....., Mm; After performing Boolean logic operation on the data block Mi and the constant IV, an addition operation is performed with modulo 32 to calculate the compression function value; Randomly permute and sort the calculated compression function values; Perform a modulo 32 addition operation on the result after permutation sorting and the current cumulative hash value {Hi} to obtain an updated hash value Hi; Repeat the hash value update step until all data blocks are traversed to obtain hash values H1, H2, ..., Hm; Connect the m 32-bit intermediate hash values in order to obtain a 32*m-bit combined value. Determine the length of the obtained 32*m-bit combination value. If the length of the combination value is less than 256 bits, add padding bits to extend the combination value to 256 bits. Otherwise, truncate it to 256 bits. The resulting 256-bit value is output as the final hash value h.
6. The computer software encryption protection method according to claim 1, Features: Establish a behavioral baseline model, including: Obtain behavioral data including login time, login location, and access operations; Parse the login time, obtain the time granularity information, and divide a day into 24-hour intervals as the feature of the time distribution histogram statistics; Parse the login location, obtain address information, and divide the address into two categories: inside the office area and outside the office area as the characteristics of the location distribution histogram statistics; Parse access operations and classify them into two categories: read and write operations and set operations as the features of operation distribution histogram statistics; Using one-dimensional discrete histogram statistical function, the characteristic vector of time distribution histogram statistics is obtained; Using binary statistical function, the characteristic vector of location distribution histogram statistics is obtained; Using a binary statistical function, the characteristic vector of the operation distribution histogram statistics is obtained; The obtained feature vector of the time distribution histogram statistics, the feature vector of the location distribution histogram statistics, and the feature vector of the operation distribution histogram statistics are concatenated to serve as the statistical feature vector of the behavior data.
7. The computer software encryption protection method according to claim 6, Features: Establish a behavioral baseline model, including: The obtained statistical feature vector is used to train the LSTM neural network as the behavioral baseline model.
8. The computer software encryption protection method according to claim 7, Features: Anomaly detection, including: The behavioral baseline model based on the LSTM neural network is used to detect the acquired behavioral data, obtain the detection score, and judge whether the user's behavior is abnormal based on the detection score.
