CN111130785A - Method and device for generating RSA encryption algorithm key based on real-time passenger flow model - Google Patents

Method and device for generating RSA encryption algorithm key based on real-time passenger flow model Download PDF

Info

Publication number
CN111130785A
CN111130785A CN201811288365.3A CN201811288365A CN111130785A CN 111130785 A CN111130785 A CN 111130785A CN 201811288365 A CN201811288365 A CN 201811288365A CN 111130785 A CN111130785 A CN 111130785A
Authority
CN
China
Prior art keywords
prime number
positive integer
real
passenger flow
obtaining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811288365.3A
Other languages
Chinese (zh)
Other versions
CN111130785B (en
Inventor
宋逸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811288365.3A priority Critical patent/CN111130785B/en
Publication of CN111130785A publication Critical patent/CN111130785A/en
Application granted granted Critical
Publication of CN111130785B publication Critical patent/CN111130785B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3006Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters
    • H04L9/302Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters involving the integer factorization problem, e.g. RSA or quadratic sieve [QS] schemes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides a method and a device for generating an RSA encryption algorithm key based on a real-time passenger flow model, wherein the method comprises the following steps: executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values; substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer; repeating the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values; substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer; generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number; the embodiment of the invention achieves the true random effect through the real-time passenger flow model, and can obtain the secret key of the RSA algorithm with higher security.

Description

Method and device for generating RSA encryption algorithm key based on real-time passenger flow model
Technical Field
The invention relates to the technical field of network information security, in particular to a method and a device for generating an RSA encryption algorithm key based on a real-time passenger flow model.
Background
The RSA encryption algorithm is a common public key encryption algorithm at present, and is based on a number theory that factorization of product of two large prime numbers is extremely difficult, and the algorithm is as follows: the algorithm of RSA involves three parameters, n, e1, e 2. Where n is the product of two large prime numbers p, q, and the number of bits occupied by n in binary representation is the so-called key length. e1 and e2 are a pair of related values, e1 can be arbitrarily chosen, but e1 is required to be relatively prime to (p-1) × (q-1); e2 was selected, requiring (e2 × e1) ≡ 1(mod (p-1) × (q-1)). (n, e1), (n, e2) are key pairs. Where (n, e1) is the public key and (n, e2) is the private key. The RSA encryption and decryption algorithms are completely the same, and if a is a plaintext and B is a ciphertext, then: A.ident.Be2(mod n);B≡Ae1(mod n); e1 and e2 may be used interchangeably, i.e.: A.ident.Be1(mod n);B≡Ae2(mod n)。
The large prime numbers p, q are usually obtained by generating a random positive integer by a random function, detecting whether it is a prime number using a prime number detection algorithm, and if it is not a prime number, testing its neighboring positive integer until a prime number is found.
However, most of random numbers generated by the random function are pseudo-random numbers, which are generated by simulation according to a certain algorithm, and the result is determined, and the random numbers can also be designed artificially, are not truly random numbers satisfying unpredictability, and may cause the key of the generated RSA encryption algorithm to be cracked, thereby having a certain potential safety hazard.
Disclosure of Invention
The present invention provides a method and apparatus for generating RSA encryption algorithm keys based on a real-time passenger flow model that overcomes, or at least partially solves, the above-mentioned problems.
In a first aspect, an embodiment of the present invention provides a method for generating an RSA encryption algorithm key based on a real-time passenger flow model, including:
executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values;
substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer;
repeating the step of obtaining random numerical values based on the real-time passenger flow model for n times to obtain a second group of numerical values;
substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer;
generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number;
the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
In a second aspect, an embodiment of the present invention provides an apparatus for generating an RSA encryption algorithm key based on a real-time passenger flow model, including:
the first numerical value generation module is used for executing the step of obtaining the random number n times based on the real-time passenger flow model to obtain a first group of numerical values;
the first prime number generation module is used for substituting the first group of numerical values into a polynomial expression to obtain a first positive integer and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer;
the second numerical value generation module is used for repeatedly executing the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values;
the second prime number generation module is used for substituting the second group of numerical values into the polynomial expression to obtain a second positive integer and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer;
the key generation module is used for generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number;
the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the program to implement the steps of the method as provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method as provided in the first aspect.
The method and the device for generating the RSA encryption algorithm key based on the real-time passenger flow model, provided by the embodiment of the invention, have the advantages that the random number is generated by acquiring the number of real-time passengers in any area based on the real-time passenger flow model, and then the large prime number is obtained, so that the true random effect is achieved, and the RSA encryption algorithm key with higher safety can be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for generating an RSA encryption algorithm key based on a real-time passenger flow model according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an apparatus for generating an RSA encryption algorithm key based on a real-time passenger flow model according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, a schematic flow chart of a method for generating an RSA encryption algorithm key based on a real-time passenger flow model according to an embodiment of the present invention includes:
step 10, executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values;
the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
Specifically, m regions are randomly selected by using a random function, a region may refer to 90 administrative regions in a certain province, for example, 90 administrative regions in Zhejiang province, and 90 combinations are generated by randomly selecting m regionsmAnd (4) seed preparation.
The real-time passenger flow model is a technology for acquiring the number of visitors in a region in real time through mobile phone signaling, the number of visitors in each time point in the region is unpredictable and unboundable, and real random can be realized based on a value acquired by the number of the visitors in real time.
Every time the step of obtaining the random number based on the real-time passenger flow model is executed, a numerical value obtained through calculation according to the number of the real-time passenger flows is obtained, n numerical values can be obtained through the step of obtaining the random number based on the real-time passenger flow model for n times, and the n numerical values are called as a first group of numerical values.
And 20, substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer.
Specifically, on the basis of obtaining the first set of values, the polynomial expression is used for converting the first set of values into a first positive integer, and the purpose of doing so is to realize the digit control of the first positive integer through the polynomial expression.
The prime number detection algorithm is an algorithm capable of detecting whether a number is a prime number, and the embodiment of the invention adopts the existing prime number detection algorithm to detect whether the first positive integer is a prime number, for example, the Miller-rabin algorithm can be adopted, and a prime number detection method combining the fisher's theorem algorithm and the Miller-rabin algorithm can also be adopted.
And if the detection result shows that the first positive integer is a prime number, storing the first positive integer as a first prime number. If the detection result is that the first positive integer is not a prime number, the positive integers adjacent to the first positive integer are tested until a prime number is found, and the found prime number closest to the first positive integer is taken as a first prime number.
And step 30, repeatedly executing the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values.
Specifically, two random numbers are needed for generating the RSA encryption algorithm key, and the foregoing step has obtained one random number, and in this step, another random number is obtained: and repeatedly executing the step of randomly selecting m areas by using a random function, acquiring the real-time passenger flow number of the m areas based on a real-time passenger flow model, calculating the step of acquiring a numerical value n times according to the real-time passenger flow number, and recording a group of numerical values acquired at the moment as a second group of numerical values. Since the region is randomly selected, the number of people in the passenger flow is varied in real time, and thus the second set of values is also truly random.
And step 40, substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer.
Specifically, the synchronization step 20 converts the second set of values into the second positive integer by using the same polynomial expression on the basis of obtaining the second set of values, and the purpose of this is to realize the digit control of the second positive integer by the polynomial expression.
And detecting whether the second positive integer is a prime number by adopting the conventional prime number detection algorithm, and if the detection result is that the second positive integer is a prime number, storing the second positive integer as the second prime number. If the detection result is that the second positive integer is not a prime number, the positive integers adjacent to the second positive integer are tested until a prime number is found, and the found prime number closest to the second positive integer is taken as a second prime number.
And 50, generating a secret key of the RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number.
Specifically, based on the first prime number and the second prime number, calculating a key length n as p × q according to an RSA algorithm, where p is the first prime number and q is the second prime number, and further obtaining e1 and e2, where e1 and e2 are a pair of related values, and e1 is relatively prime to (p-1) × (q-1); and e2 is selected, requiring (e2 × e1) ≡ 1(mod (p-1) × (q-1)), constituting a public key (n, e1) and a private key (n, e 2).
The sender encrypts a plaintext A by using a public key (n, e1), and transmits a ciphertext B to the receiver; the receiving party decrypts the ciphertext by using a private key (n, e2) to restore a text segment C with actual semantics; comparing A and C, if A and C are consistent, the method of the embodiment is proved to be feasible.
The method for generating the RSA encryption algorithm key based on the real-time passenger flow model, provided by the embodiment of the invention, is used for acquiring the number of real-time passengers in any area based on the real-time passenger flow model to generate the random number, so that the large prime number is obtained, the true random effect is achieved, and the RSA encryption algorithm key with higher safety can be obtained.
Based on the content of each embodiment, the step of obtaining the number of real-time passenger flows in the m regions based on the real-time passenger flow model specifically includes:
aiming at any one of the m regions, acquiring user position information based on mobile phone signaling data;
and counting the total number of users in the current area based on the user position information, deleting the number of users in the current area in a working place and a frequent residence time and the number of users in the current area, wherein the residence time is less than the preset time, and obtaining the number of real-time passenger flows in the current area.
Specifically, the mobile phone signaling data can provide extremely accurate user position information, the user position information is obtained based on the mobile phone signaling data, the total number of users in the current area is counted, the users include users in the current area at a working place and a frequent stop, users passing through the current area and tourists in the current area, the number of the tourists in the current area is counted in real time, the number of the users in the current area at the working place and the frequent stop needs to be subtracted from the total number of the users, and the number of the users whose residence time is less than the preset time (namely, the users passing through the current area) is finally obtained.
The same steps are executed for any one of the m regions, and finally the real-time passenger flow number of the m regions can be obtained respectively.
The real-time passenger flow number is completely unpredictable, has the characteristics of unpredictability and poverty, and is a true random number. Therefore, the embodiment of the invention can obtain the real random number based on the real-time passenger flow model.
Based on the content of the foregoing embodiments, the polynomial expression specifically includes:
Figure BDA0001849569450000061
wherein, if sgn (x)i) If the number is the ith number in the first group of numbers, y is a first positive integer; if sgn (x)i) And if the number is the ith number in the second group of numbers, y is a second positive integer.
Specifically, the above polynomial expression may ensure that the obtained first positive integer or second positive integer is an n-bit binary number according to the definition of a binary number.
Based on the content of the foregoing embodiments, the step of obtaining the first prime number by using a prime number detection algorithm based on the first positive integer specifically includes:
detecting whether the first positive integer is a prime number by using a prime number detection algorithm, and if the first positive integer is the prime number, storing the first positive integer as a first prime number; alternatively, the first and second electrodes may be,
if the first positive integer is not a prime number, obtaining a prime number closest to the first positive integer, and storing the prime number closest to the first positive integer as a first prime number.
Specifically, an existing prime number detection algorithm is adopted to detect whether a first positive integer is a prime number, and if the detection result is that the first positive integer is a prime number, the first positive integer is stored as a first prime number.
And if the detection result shows that the first positive integer is not a prime number, searching for the prime number closest to the first integer. Specifically, the first positive integer is subjected to addition processing, whether the processed first positive integer is a prime number or not is continuously detected, if the number obtained after addition is a prime number, the first positive integer subjected to addition is taken as a first prime number, if the number obtained after addition is not a prime number, the first positive integer is continuously added until a prime number closest to the first positive integer is obtained, and the prime number closest to the first positive integer is taken as the first prime number.
Based on the content of each of the above embodiments, the step of obtaining the second prime number by using the prime number detection algorithm based on the second positive integer specifically includes:
if the second positive integer is judged to be more than or equal to two times of the first positive integer, detecting whether the second positive integer is a prime number or not by using a prime number detection algorithm, and if the second positive integer is the prime number, storing the second positive integer as a second prime number; alternatively, the first and second electrodes may be,
and if the second positive integer is not a prime number, acquiring a prime number closest to the second positive integer, and storing the prime number closest to the second positive integer as a second prime number.
Specifically, in order to improve the security of the RSA encryption algorithm, n ═ pq is not easily decomposed, p and q are required to satisfy a certain mathematical relationship in addition to prime numbers, and it has been analyzed that when q is greater than or equal to 2p, the key of the RSA encryption algorithm has higher security.
Therefore, before detecting whether the second positive integer is a prime number by using the existing prime number detection algorithm, whether the second positive integer is more than or equal to two times of the first positive integer is judged.
If the second positive integer is judged to be more than or equal to two times of the first positive integer, detecting whether the second positive integer is a prime number or not by using a prime number detection algorithm, and if the second positive integer is the prime number, storing the second positive integer as a second prime number; alternatively, the first and second electrodes may be,
if the second positive integer is not a prime number, obtaining a prime number closest to the second positive integer, adding one to the second positive integer, continuously detecting whether the processed second positive integer is a prime number, if the number obtained after adding one is a prime number, taking the second positive integer after adding one as the second prime number, if the number obtained after adding one is still not a prime number, continuously adding one until the prime number closest to the second positive integer is obtained, and taking the prime number closest to the second positive integer as the second prime number.
Based on the content of each of the above embodiments, the step of obtaining the second prime number by using the prime number detection algorithm based on the second positive integer specifically includes:
if the second positive integer is judged to be smaller than twice of the first positive integer, updating the second positive integer by twice of the second positive integer;
judging whether the updated second positive integer is a prime number or not by using a prime number detection algorithm, and if the updated second positive integer is a prime number, storing the updated second positive integer as a second prime number; alternatively, the first and second electrodes may be,
if the updated second positive integer is not a prime number, obtaining a prime number closest to the updated second positive integer, and storing the prime number closest to the updated second positive integer as a second prime number.
Specifically, if judged to haveIf the second positive integer is less than twice the first positive integer, in order to make the first prime number and the second prime number still satisfy the condition that the second prime number is greater than or equal to twice the first prime number, the second positive integer is updated by twice the second positive integer, i.e. q is made to be twice the second positive integer0=2q0And detecting whether the updated second positive integer is a prime number by using a prime number detection algorithm.
If the updated second positive integer is a prime number, saving the updated second positive integer as a second prime number; alternatively, the first and second electrodes may be,
if the updated second positive integer is not a prime number, obtaining a prime number closest to the updated second positive integer, performing addition processing on the updated second positive integer, continuously detecting whether the processed second positive integer is a prime number, if the number obtained after the addition is a prime number, using the second positive integer after the addition as the second prime number, if the number obtained after the addition is not a prime number, continuously adding one until the prime number closest to the updated second positive integer is obtained, and storing the prime number closest to the updated second positive integer as the second prime number.
Based on the content of the above embodiments, the step of obtaining a numerical value according to the real-time passenger flow number calculation specifically includes:
substituting the number of the real-time passenger flow into a symbolic function to obtain a numerical value; wherein the sign function is:
Figure BDA0001849569450000091
wherein, f (x)<At 0, sgn (f (x)) is-1; when f (x) is 0, sgn (f (x)) is 0; f (x)>At 0, sgn (f (x)) is 1; x is the number ofa,xb,xcThe number of the real-time passenger flow in the m regions is respectively, and m is 3.
Specifically, when m is 3, the real-time passenger flow number of three areas can be obtained based on the real-time passenger flow model, and is marked as (x)a,xb,xc)。
The realization mode of obtaining a numerical value according to the real-time passenger flow number calculation is to substitute the obtained real-time passenger flow numbers of m areas into a self-defined sign function to obtain a numerical value sgn (x).
Wherein the content of the first and second substances,
Figure BDA0001849569450000092
after the number of the real-time passenger flow in m areas is obtained, the value of f (x) can be obtained, and further the value of sgn (x) can be obtained, namely a numerical value is obtained.
Based on the content of the foregoing embodiments, the value of m is 3, and the value of n is 1024.
Specifically, according to the proven conclusion, in order to ensure the security of the public key and the private key, the length of the ideal secret key n needs to be more than 1024 bits, and the values of p and q should satisfy q ≧ 2p, in order to satisfy the above security requirement, the method for generating the RSA encryption algorithm secret key based on the real-time passenger flow model provided by the embodiment of the present invention includes the following steps:
randomly selecting three regions by using a random function, acquiring the real-time passenger flow number of the three regions based on a real-time passenger flow model, and substituting the real-time passenger flow number into a sign function to obtain a value 1024 times to obtain a first group of values;
substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, detecting whether the first positive integer is a prime number by using a prime number detection algorithm, and if the first positive integer is the prime number, storing the first positive integer as a first prime number; or if the first positive integer is not a prime number, acquiring a prime number closest to the first positive integer, and storing the prime number closest to the first positive integer as a first prime number;
repeatedly executing the step of randomly selecting three areas by using the random function again, acquiring the real-time passenger flow number of the three areas based on a real-time passenger flow model, and substituting the real-time passenger flow number into a symbolic function to obtain a numerical value 1024 times to obtain a second group of numerical values;
substituting the second group of numerical values into the polynomial expression to obtain a second positive integer;
judging whether the second positive integer is more than or equal to two times of the first positive integer, if so, detecting whether the second positive integer is a prime number by using a prime number detection algorithm, and if so, storing the second positive integer as a second prime number; or if the second positive integer is not a prime number, acquiring a prime number closest to the second positive integer, and storing the prime number closest to the second positive integer as a second prime number; alternatively, the first and second electrodes may be,
if the second positive integer is judged to be smaller than twice of the first positive integer, updating the second positive integer by twice of the second positive integer; judging whether the updated second positive integer is a prime number or not by using a prime number detection algorithm, and if the updated second positive integer is a prime number, storing the updated second positive integer as a second prime number; or, if the updated second positive integer is not a prime number, obtaining a prime number closest to the updated second positive integer, and saving the prime number closest to the updated second positive integer as a second prime number.
And generating a key of the RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number.
The method for generating the RSA encryption algorithm key based on the real-time passenger flow model provided by the embodiment of the invention obtains the real-time number of passengers in any region through the real-time passenger flow model to achieve the true random effect, has the characteristics of unpredictability and invisibility, and generates the large prime numbers p and q meeting the safety requirement through the symbolic function and the polynomial expression, so that the key of the RSA encryption algorithm with higher safety can be obtained.
As shown in fig. 2, a schematic structural diagram of an apparatus for generating an RSA encryption algorithm key based on a real-time passenger flow model according to an embodiment of the present invention includes: a first numerical value generation module 21, a first prime number generation module 22, a second numerical value generation module 23, a second prime number generation module 24, and a key generation module 25, wherein,
the first numerical value generating module 21 is configured to execute the step of obtaining the random number n times based on the real-time passenger flow model to obtain a first group of numerical values.
The step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
Specifically, the first value generation module 21 randomly selects m regions using a random function, where a region may refer to 90 administrative regions in a certain province, for example, 90 administrative regions in Zhejiang province, and 90 combinations are generated by randomly selecting m regionsmAnd (4) seed preparation.
The real-time passenger flow model is a technology for acquiring the number of visitors in a region in real time through mobile phone signaling, the number of visitors in each time point in a region is unpredictable and unboundable, and the first value generation module 21 can truly realize randomness based on a value acquired by the real-time passenger flow number.
The first numerical value generation module 21 obtains a numerical value calculated according to the number of real-time passenger flows each time the step of obtaining the random number based on the real-time passenger flow model is executed, and obtains n numerical values by executing the step of obtaining the random number based on the real-time passenger flow model n times, wherein the n numerical values are called as a first group of numerical values.
A first prime number generating module 22, configured to substitute the first group of values into a polynomial expression to obtain a first positive integer, and obtain a first prime number based on the first positive integer by using a prime number detection algorithm.
Specifically, the first prime number generation module 22 converts the first group of values into the first positive integer by using the polynomial expression on the basis of obtaining the first group of values, and the purpose of doing so is to realize the digit control of the first positive integer by using the polynomial expression.
The prime number detection algorithm is an algorithm capable of detecting whether a number is a prime number, the first prime number generation module 22 detects whether the first positive integer is a prime number by using an existing prime number detection algorithm, for example, a Miller-rabin algorithm may be used, or a prime number detection method combining a fisher-labs theorem algorithm and a Miller-rabin algorithm may be used.
If the detection result is that the first positive integer is a prime number, the first prime number generation module 22 saves the first positive integer as a first prime number. If the detection result is that the first positive integer is not a prime number, the positive integers adjacent to the first positive integer are tested until a prime number is found, and the first prime number generation module 22 takes the found prime number closest to the first positive integer as the first prime number.
And the second numerical value generating module 23 is configured to repeatedly execute the step of obtaining the random number based on the real-time passenger flow model n times to obtain a second group of numerical values.
Specifically, two random numbers are required for generating the RSA encryption algorithm key, the first value generation module 21 has obtained one random number, and the second value generation module 23 obtains another random number: and repeatedly executing the step of randomly selecting m areas by using a random function, acquiring the real-time passenger flow number of the m areas based on a real-time passenger flow model, calculating the step of acquiring a numerical value n times according to the real-time passenger flow number, and recording a group of numerical values acquired at the moment as a second group of numerical values. Since the region is randomly selected, the number of people in the passenger flow is varied in real time, and thus the second set of values is also truly random.
And a second prime number generating module 24, configured to substitute the second group of values into the polynomial expression to obtain a second positive integer, and obtain a second prime number based on the second positive integer by using a prime number detection algorithm.
Specifically, the second prime number generation module 24 converts the second group of values into a second positive integer by using the same polynomial expression on the basis of obtaining the second group of values, and the purpose of doing so is to realize the digit control of the second positive integer through the polynomial expression.
The second prime number generation module 24 detects whether the second positive integer is a prime number by using an existing prime number detection algorithm, and stores the second positive integer as the second prime number if the detection result indicates that the second positive integer is a prime number. If the detection result is that the second positive integer is not a prime number, the positive integers adjacent to the second positive integer are tested until a prime number is found, and the found prime number closest to the second positive integer is taken as a second prime number.
And a key generation module 25, configured to generate a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first and second prime numbers.
Specifically, the key generation module 25 calculates a key length n ═ p × q according to an RSA algorithm based on the first prime number and the second prime number, where p is the first prime number and q is the second prime number, and then obtains e1 and e2, where e1 and e2 are a pair of related values, and e1 is relatively prime to (p-1) × (q-1); and e2 is selected, requiring (e2 × e1) ≡ 1(mod (p-1) × (q-1)), constituting a public key (n, e1) and a private key (n, e 2).
The device for generating the RSA encryption algorithm key based on the real-time passenger flow model, provided by the embodiment of the invention, acquires the number of real-time passengers in any area based on the real-time passenger flow model to generate the random number, further acquires the large prime number, achieves the true random effect, and can obtain the RSA encryption algorithm key with higher safety.
As shown in fig. 3, a schematic structural diagram of an electronic device provided in an embodiment of the present invention is shown, where the electronic device may include: a processor (processor)301, a memory (memory)302, and a bus 303; the processor 301 and the memory 302 respectively complete communication with each other through a bus 303; the processor 301 is configured to call program instructions in the memory 302 to execute the method for generating RSA encryption algorithm keys based on real-time passenger flow model according to the embodiments, which includes: executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values; substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer; repeating the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values; substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer; generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number; the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people; wherein m and n are positive integers greater than or equal to 1.
Furthermore, the logic instructions in the memory 302 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
An embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, is implemented to perform the method for generating an RSA encryption algorithm key based on a real-time passenger flow model, which is provided in the foregoing embodiments, and the method includes: executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values; substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer; repeating the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values; substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer; generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number; the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people; wherein m and n are positive integers greater than or equal to 1.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (11)

1. A method for generating an RSA encryption algorithm key based on a real-time passenger flow model is characterized by comprising the following steps:
executing the step of obtaining random numbers based on the real-time passenger flow model for n times to obtain a first group of numerical values;
substituting the first group of numerical values into a polynomial expression to obtain a first positive integer, and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer;
repeating the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values;
substituting the second group of numerical values into the polynomial expression to obtain a second positive integer, and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer;
generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number;
the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
2. The method according to claim 1, wherein the step of obtaining the real-time passenger flow population of the m regions based on the real-time passenger flow model comprises:
aiming at any one of the m regions, acquiring user position information based on mobile phone signaling data;
and counting the total number of users in the current area based on the user position information, deleting the number of users in the current area in a working place and a frequent residence time and the number of users in the current area, wherein the residence time is less than the preset time, and obtaining the number of real-time passenger flows in the current area.
3. The method according to claim 1, wherein the polynomial expression is specifically:
Figure FDA0001849569440000011
wherein, if sgn (x)i) If the number is the ith number in the first group of numbers, y is a first positive integer; if sgn (x)i) And if the number is the ith number in the second group of numbers, y is a second positive integer.
4. The method according to claim 1, wherein the step of obtaining the first prime number using a prime number detection algorithm based on the first positive integer comprises:
detecting whether the first positive integer is a prime number by using a prime number detection algorithm, and if the first positive integer is the prime number, storing the first positive integer as a first prime number; alternatively, the first and second electrodes may be,
if the first positive integer is not a prime number, obtaining a prime number closest to the first positive integer, and storing the prime number closest to the first positive integer as a first prime number.
5. The method according to claim 1, wherein the step of obtaining the second prime number using a prime number detection algorithm based on the second positive integer comprises:
if the second positive integer is judged to be more than or equal to two times of the first positive integer, detecting whether the second positive integer is a prime number or not by using a prime number detection algorithm, and if the second positive integer is the prime number, storing the second positive integer as a second prime number; alternatively, the first and second electrodes may be,
and if the second positive integer is not a prime number, acquiring a prime number closest to the second positive integer, and storing the prime number closest to the second positive integer as a second prime number.
6. The method according to claim 1, wherein the step of obtaining the second prime number using a prime number detection algorithm based on the second positive integer comprises:
if the second positive integer is judged to be smaller than twice of the first positive integer, updating the second positive integer by twice of the second positive integer;
judging whether the updated second positive integer is a prime number or not by using a prime number detection algorithm, and if the updated second positive integer is a prime number, storing the updated second positive integer as a second prime number; alternatively, the first and second electrodes may be,
if the updated second positive integer is not a prime number, obtaining a prime number closest to the updated second positive integer, and storing the prime number closest to the updated second positive integer as a second prime number.
7. The method according to claim 1, wherein said step of obtaining a value based on said real-time passenger flow count comprises:
substituting the number of the real-time passenger flow into a symbolic function to obtain a numerical value; wherein the sign function is:
Figure FDA0001849569440000021
wherein, f (x)<At 0, sgn (f (x)) is-1; when f (x) is 0, sgn (f (x)) is 0; f (x)>At 0, sgn (f (x)) is 1; x is the number ofa,xb,xcThe number of the real-time passenger flow in the m regions is respectively, and m is 3.
8. The method of claim 1, wherein m has a value of 3 and n has a value of 1024.
9. An apparatus for generating an RSA encryption algorithm key based on a real-time passenger flow model, comprising:
the first numerical value generation module is used for executing the step of obtaining the random number n times based on the real-time passenger flow model to obtain a first group of numerical values;
the first prime number generation module is used for substituting the first group of numerical values into a polynomial expression to obtain a first positive integer and obtaining a first prime number by using a prime number detection algorithm based on the first positive integer;
the second numerical value generation module is used for repeatedly executing the step of obtaining the random number based on the real-time passenger flow model for n times to obtain a second group of numerical values;
the second prime number generation module is used for substituting the second group of numerical values into the polynomial expression to obtain a second positive integer and obtaining a second prime number by using a prime number detection algorithm based on the second positive integer;
the key generation module is used for generating a key of an RSA encryption algorithm according to the RSA encryption algorithm based on the first prime number and the second prime number;
the step of obtaining the random number based on the real-time passenger flow model specifically comprises the following steps: randomly selecting m areas by using a random function, acquiring the number of real-time passenger flow people of the m areas based on a real-time passenger flow model, and calculating to obtain a numerical value according to the number of the real-time passenger flow people;
wherein m and n are positive integers greater than or equal to 1.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 8 are implemented when the processor executes the program.
11. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN201811288365.3A 2018-10-31 2018-10-31 Method and device for generating RSA encryption algorithm key based on real-time passenger flow model Active CN111130785B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811288365.3A CN111130785B (en) 2018-10-31 2018-10-31 Method and device for generating RSA encryption algorithm key based on real-time passenger flow model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811288365.3A CN111130785B (en) 2018-10-31 2018-10-31 Method and device for generating RSA encryption algorithm key based on real-time passenger flow model

Publications (2)

Publication Number Publication Date
CN111130785A true CN111130785A (en) 2020-05-08
CN111130785B CN111130785B (en) 2022-11-29

Family

ID=70485725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811288365.3A Active CN111130785B (en) 2018-10-31 2018-10-31 Method and device for generating RSA encryption algorithm key based on real-time passenger flow model

Country Status (1)

Country Link
CN (1) CN111130785B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1253437A (en) * 1998-07-16 2000-05-17 日本电气株式会社 Common cryptographic key cipher system possessing enhanced protection to prevent selective cipher script attack
CN1937493A (en) * 2006-09-27 2007-03-28 深圳兆日技术有限公司 RSA ciphering method for realizing quick big prime generation
CN102437912A (en) * 2012-01-06 2012-05-02 厦门博鼎智文传媒科技有限公司 Digital rights management method based on N RSA (Rivest Shamir Adleman) encryption algorithms based on chaotic algorithm

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1253437A (en) * 1998-07-16 2000-05-17 日本电气株式会社 Common cryptographic key cipher system possessing enhanced protection to prevent selective cipher script attack
CN1937493A (en) * 2006-09-27 2007-03-28 深圳兆日技术有限公司 RSA ciphering method for realizing quick big prime generation
CN102437912A (en) * 2012-01-06 2012-05-02 厦门博鼎智文传媒科技有限公司 Digital rights management method based on N RSA (Rivest Shamir Adleman) encryption algorithms based on chaotic algorithm

Also Published As

Publication number Publication date
CN111130785B (en) 2022-11-29

Similar Documents

Publication Publication Date Title
Ma et al. Cryptanalysis of an image block encryption algorithm based on chaotic maps
EP3134994B1 (en) Method of obfuscating data
CN108964916B (en) Signature generation method, generation device, signature verification method and verification device
CN110400162B (en) Data processing method, device, server and system
Alawida et al. A novel hash function based on a chaotic sponge and DNA sequence
Abd El-Wahed et al. Efficiency and security of some image encryption algorithms
Yayik et al. Neural network based cryptography
Lal et al. Modified trial division algorithm using KNJ-factorization method to factorize RSA public key encryption
Kumar et al. Overview of information security using genetic algorithm and chaos
Alkhodaidi et al. Scalable shares generation to increase participants of counting-based secret sharing technique
WO2016063512A1 (en) Mac tag list generating apparatus, mac tag list verifying apparatus, mac tag list generating method, mac tag list verifying method and program recording medium
CN111130785B (en) Method and device for generating RSA encryption algorithm key based on real-time passenger flow model
Kumar et al. A secured cryptographic model using intertwining logistic map
Gavini et al. Lossless watermarking technique for copyright protection of high resolution images
Hanchinamani et al. A novel approach for image encryption based on parametric mixing chaotic system
CN114221753B (en) Key data processing method and electronic equipment
CN112491840B (en) Information modification method, device, computer equipment and storage medium
Gorbenko et al. Analysis of Potential Post-Quantum Schemes of Hash-Based Digital Signatur
CN110011790B (en) Anti-quantum key negotiation method based on coding
Ortiz et al. Encryption through the Use of Fractals
RP Keyed-CAHASH: a new fast keyed hash function based on cellular automata for authentication
Krishna et al. Web and network communication security algorithms
CN117811722B (en) Global parameter model construction method, secret key generation method, device and server
Elamir et al. Review of Advanced Techniques for Data Security Technology and Applications
Kumar et al. An Efficient and Robust Facial Image Encryption Algorithm for Biometric Identity Systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant