CN109447203A - Two dimensional code encryption and decryption method, device, Cloud Server and system - Google Patents
Two dimensional code encryption and decryption method, device, Cloud Server and system Download PDFInfo
- Publication number
- CN109447203A CN109447203A CN201811322863.5A CN201811322863A CN109447203A CN 109447203 A CN109447203 A CN 109447203A CN 201811322863 A CN201811322863 A CN 201811322863A CN 109447203 A CN109447203 A CN 109447203A
- Authority
- CN
- China
- Prior art keywords
- key
- dimensional code
- encryption
- product
- character string
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 238000012790 confirmation Methods 0.000 claims description 7
- 239000000047 product Substances 0.000 abstract description 101
- 239000010410 layer Substances 0.000 abstract description 7
- 239000002356 single layer Substances 0.000 abstract description 6
- 230000009286 beneficial effect Effects 0.000 abstract description 5
- 239000006227 byproduct Substances 0.000 abstract description 3
- 230000004044 response Effects 0.000 abstract description 2
- 238000004891 communication Methods 0.000 description 10
- 238000003860 storage Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 239000003814 drug Substances 0.000 description 3
- 229940079593 drug Drugs 0.000 description 3
- 238000012360 testing method Methods 0.000 description 3
- 238000010200 validation analysis Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000011017 operating method Methods 0.000 description 2
- 239000005022 packaging material Substances 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000001105 regulatory effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000003542 behavioural effect Effects 0.000 description 1
- 238000005314 correlation function Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 235000013399 edible fruits Nutrition 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K17/00—Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
- G06K17/0022—Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations arrangements or provisions for transferring data to distant stations, e.g. from a sensing device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/018—Certifying business or products
- G06Q30/0185—Product, service or business identity fraud
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Entrepreneurship & Innovation (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Accounting & Taxation (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a kind of two dimensional code encryption methods, comprising: based on current two dimensional code encryption requirements, confirms product two dimensional code character string corresponding with the encryption requirements;The first key that the product two dimensional code character string has been set is obtained, and corresponding second key is generated with the first key;Encryption key is generated according to the first key and the second key, with product two dimensional code character string described in generated encryption keys.The invention also discloses a kind of two dimensional code decryption method, device, Cloud Server and systems.The present invention by by product two dimensional code character string execute two layers of key cryptographic operation, two dimensional code character string i.e. two dimensional code is decrypted with forming decruption key by corresponding second key of single layer key input response, the privacy degrees for improving two-dimentional code encryption are realized, are avoided because the safety management that Key Exposure influences the management of product improves the beneficial effect of the confidentiality of two dimensional code character string in turn.
Description
Technical field
The present invention relates to two dimensional code encryption technology field more particularly to a kind of two dimensional code encryption and decryption methods, device, cloud
Server and system.
Background technique
Operation behavioural analysis is sold to the quality tracing of product, supervision, statistics dealer for convenience, production firm is general
Entire management process can be realized in the form of assigning two dimensional code in product packaging.And when the prior art is that product is endowed,
Production firm's server downloads the ciphertext encrypted, and obtains two dimensional code by the encrypted cipher text of decryption downloading to realize endowed behaviour
Make.It therefore is being the encrypted cipher text for first decrypting downloading to be needed before product is endowed, and key need to first be obtained by decrypting by the ciphertext of downloading,
Operation is decrypted by the key pair encryption ciphertext of acquisition.Currently used mode generally entrusts a people to hold for key
People is provided as encrypted cipher text decruption key by key holder to realize that decryption oprerations are endowed to product later.But applying this
When kind mode is endowed, if it will cause straight in the case where the safety guarantee of not next step if decruption key is revealed
Loss is connect, product safety is not had and ensures effect.
Above content is only used to facilitate the understanding of the technical scheme, and is not represented and is recognized that above content is existing skill
Art.
Summary of the invention
The main purpose of the present invention is to provide a kind of two dimensional code encryption methods, it is intended to solve the prior art in the management of product
Single layer key manner of decryption in, be easy single layer decrypt Key Exposure in the case where influence the management of product safety skill
Art problem.
To achieve the above object, the present invention provides a kind of two dimensional code encryption method, including the following contents:
Based on current two dimensional code encryption requirements, product two dimensional code character string corresponding with the encryption requirements is confirmed;
The first key that the product two dimensional code character string has been set is obtained, and corresponding with first key generation
Second key;
Encryption key is generated according to the first key and the second key, with product described in generated encryption keys
Two dimensional code character string.
Preferably, described based on current two dimensional code encryption requirements, confirm product two dimension corresponding with the encryption requirements
Before the step of code character sequence, further includes:
Product information is added in preset character string to generate the product two dimensional code based on the product information
Character string.
Preferably, the first key for obtaining the product two dimensional code character string and having set, and it is close with described first
Key generates the step of corresponding second key, further includes:
The first key and the second key are added to preset-key list to save the first key and second close
The incidence relation of key, wherein the cipher key list further includes the first key and the encryption key that the second key generates;
And according to the setting time of the first key, the first key and the second key validity period are registered.
To achieve the above object, the present invention also provides a kind of two dimensional code decryption methods, including the following contents:
When receiving first key, confirm whether the first key is effective;
When confirming that the first key is effective, the second key corresponding with the first key is obtained;
Decruption key is generated with the first key received and the second key got, and with the decryption key decryption
Corresponding product two dimensional code character string.
Preferably, described when confirming that the first key is effective, obtain the second key corresponding with the first key
The step of, further includes:
Read the validity period of the first key and the second key, and confirm current time whether the validity period when
Between in range;
When confirming that current time is in the time range of the validity period, confirm that the first key is effective.
Preferably, described when confirming that current time is in the time range of the validity period, confirm the first key
Effective step, further includes:
The contact method that the corresponding identifying code of the first key is back to the first key registration is generated, to verify
State the input source of first key;
The first key and identifying code are received at the same time and confirm that the first key and identifying code without mistaking, confirm
The input source of the first key is errorless.
Preferably, the validity period for reading the first key and the second key, and confirm current time whether in institute
After stating the step in the time range of validity period, further includes:
When confirming the first key not in the deadline range of validity period, confirms the first key failure, initiate
Reset the prompt information of first key.
In addition, to achieve the above object, the present invention also provides a kind of two dimensional code encryption device, the two dimensional code encryption device
It include: print module, memory, processor, the two dimensional code that be stored on the memory to run on the processor adds
The step of close program, the two dimensional code encipheror realizes two dimensional code encryption method as described above when being executed by the processor.
The present invention also provides a kind of Cloud Server, the Cloud Server includes: memory, processor, on the memory
It is stored with the two dimensional code decryption program that can be run on the processor, the two dimensional code decryption program is executed by the processor
The step of Shi Shixian two dimensional code decryption method as described above.
The present invention also provides a kind of two dimensional code encryption system, the two dimensional code encryption system includes: two dimension as described above
Code encryption device and Cloud Server as described above.
A kind of two dimensional code encryption method that the embodiment of the present invention proposes, based on current two dimensional code encryption requirements, confirmation with
The corresponding product two dimensional code character string of the encryption requirements;It is close to obtain the product two dimensional code character string has been set first
Key, and corresponding second key is generated with the first key;Encryption key is generated according to the first key and the second key,
With product two dimensional code character string described in generated encryption keys.The present invention passes through the two dimensional code character string that will be generated
The cryptographic operation of two layers of key is executed, is to respond corresponding second key pair two dimensional code character string by the input of single layer key
Two dimensional code is decrypted, and in the methods of the invention, user can not decrypt two dimensional code character string separately through one layer of key, realizes
The privacy degrees for improving two-dimentional code encryption are avoided because Key Exposure influences the safety management of the management of product and then improves two
Tie up the beneficial effect of the confidentiality of code character sequence.
Detailed description of the invention
Fig. 1 be the hardware running environment that the embodiment of the present invention is related to terminal apparatus structure schematic diagram;
Fig. 2 be another hardware running environment that the embodiment of the present invention is related to terminal apparatus structure schematic diagram;
Fig. 3 is the flow diagram of two dimensional code encryption method first embodiment of the present invention;
Fig. 4 is the flow diagram of two dimensional code decryption method first embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: based on current two dimensional code encryption requirements, confirmation and the encryption
The corresponding product two dimensional code character string of demand;Obtain the first key that the product two dimensional code character string has been set, and with
The first key generates corresponding second key;Encryption key is generated according to the first key and the second key, to have given birth to
At encryption keys described in product two dimensional code character string.
Generally entrusting a people due to currently used mode is key holder, is provided as encrypting by key holder close
The decruption key of text is to realize decryption oprerations and endowed to product after the decryption.But when such mode of application is endowed, if
If decruption key is revealed, it will cause direct losses in the case where the safety guarantee of not next step, do not have product
Safety guarantee effect.
The present invention provides a solution, and the encryption by the way that product two dimensional code character string to be executed to two layers of key is grasped
Make, with by corresponding second key of single layer key input response form decruption key to two dimensional code character string i.e. two dimensional code into
Row decryption, therefore user can not decrypt two dimensional code character string separately through one layer of key, realize and improve two-dimentional code encryption
Privacy degrees are avoided because Key Exposure influences the safety management of the management of product and then improves the secrecy of two dimensional code character string
The beneficial effect of property.
As shown in Figure 1, Fig. 1 is the terminal structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to.
The terminal of that embodiment of the invention can be PC, be also possible to smart phone, tablet computer, E-book reader, service
The packaged types such as device, portable computer or irremovable formula terminal device.
As shown in Figure 1, the terminal may include: processor 1001, such as CPU, network interface 1004, user interface
1003, memory 1005, communication bus 1002, printing device 1006.Wherein, communication bus 1002 for realizing these components it
Between connection communication.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard),
Optional user interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include
Standard wireline interface and wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to steady
Fixed memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of
The storage device of aforementioned processor 1001.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Fig. 1, can wrap
It includes than illustrating more or fewer components, perhaps combines certain components or different component layouts.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium
Believe module, Subscriber Interface Module SIM and two dimensional code encipheror.
In terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, carries out with background server
Data communication;User interface 1003 is mainly used for connecting client (user terminal), carries out data communication with client;And processor
1001 can be used for calling the two dimensional code encipheror stored in memory 1005, and execute following operation:
Based on current two dimensional code encryption requirements, product two dimensional code character string corresponding with the encryption requirements is confirmed;
The first key that the product two dimensional code character string has been set is obtained, and corresponding with first key generation
Second key;
Encryption key is generated according to the first key and the second key, with product described in generated encryption keys
Two dimensional code character string.
Further, processor 1001 can call the two dimensional code encipheror stored in memory 1005, also execute with
Lower operation:
Product information is added in preset character string to generate the product two dimensional code based on the product information
Character string.
Further, processor 1001 can call the two dimensional code encipheror stored in memory 1005, also execute with
Lower operation:
The first key and the second key are added to preset-key list to save the first key and second close
The incidence relation of key, wherein the cipher key list further includes the first key and the encryption key that the second key generates;
And according to the setting time of the first key, the first key and the second key validity period are registered.
As shown in Fig. 2, Fig. 2 is the terminal structure signal for another hardware running environment that the embodiment of the present invention is related to
Figure.
The terminal of that embodiment of the invention can be PC, be also possible to smart phone, tablet computer, E-book reader, portable
The packaged types such as computer, server or irremovable formula terminal device.
As shown in Fig. 2, the terminal may include: processor 2001, such as CPU, network interface 2004, user interface
2003, memory 2005, communication bus 2002.Wherein, communication bus 2002 is for realizing the connection communication between these components.
User interface 2003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user interface
2003 can also include standard wireline interface and wireless interface.Network interface 2004 optionally may include that the wired of standard connects
Mouth, wireless interface (such as WI-FI interface).Memory 2005 can be high speed RAM memory, be also possible to stable memory
(non-volatile memory), such as magnetic disk storage.Memory 2005 optionally can also be independently of aforementioned processor
2001 storage device.
It will be understood by those skilled in the art that the restriction of terminal structure shown in Figure 2 not structure paired terminal, can wrap
It includes than illustrating more or fewer components, perhaps combines certain components or different component layouts.
As shown in Fig. 2, as may include that operating system, network are logical in a kind of memory 2005 of computer storage medium
Believe module, Subscriber Interface Module SIM and two dimensional code decryption program.
In terminal shown in Fig. 2, network interface 2004 is mainly used for connecting background server, carries out with background server
Data communication;User interface 2003 is mainly used for connecting client (user terminal), carries out data communication with client;And processor
2001 can be used for calling the two dimensional code decryption program stored in memory 2005, and execute following operation:
When receiving first key, confirm whether the first key is effective;
When confirming that the first key is effective, the second key corresponding with the first key is obtained;
Decruption key is generated with the first key received and the second key got, and with the decryption key decryption
Corresponding product two dimensional code character string.
Further, processor 2001 can call the two dimensional code decryption program stored in memory 2005, also execute with
Lower operation:
Read the validity period of the first key and the second key, and confirm current time whether the validity period when
Between in range;
When confirming that current time is in the time range of the validity period, confirm that the first key is effective.
Further, processor 2001 can call the two dimensional code decryption program stored in memory 2005, also execute with
Lower operation:
The contact method that the corresponding identifying code of the first key is back to the first key registration is generated, to verify
State the input source of first key;
The first key and identifying code are received at the same time and confirm that the first key and identifying code without mistaking, confirm
The input source of the first key is errorless.
Further, processor 2001 can call the two dimensional code decryption program stored in memory 2005, also execute with
Lower operation:
When confirming the first key not in the deadline range of validity period, confirms the first key failure, initiate
Reset the prompt information of first key.
Referring to Fig. 3, Fig. 3 is the flow diagram of two dimensional code encryption method first embodiment of the present invention, and the two dimensional code adds
Decryption method includes:
Step S10 confirms product type of two-dimension codeword corresponding with the encryption requirements based on current two dimensional code encryption requirements
Accord with sequence;
According to current management of product demand, corresponding product information need to be formed to two dimensional code and carry out whole tracing management, be
It avoids two dimensional code from stealing the influence management of product by people, generates two dimensional code encryption requirements.Its two-dimentional code encryption demand can be produced based on new
The premises such as product or old product are initiated, and specific encryption requirements, which initiate setting, to be set by corresponding function,
This is seldom repeated.According to current two dimensional code encryption requirements, product two dimensional code character sequence corresponding with the encryption requirements is confirmed
Column, the product two dimensional code character string are the generated two dimensional code character string based on product, and the product two dimensional code
Character string may include multiple.
As described above, when confirming product two dimensional code character string corresponding with the encryption requirements, i.e., it is described to be based on working as
Before the step of preceding two dimensional code encryption requirements, confirmation product two dimensional code character string corresponding with the encryption requirements, also wrap
It includes:
Product information is added in preset character string to generate the product two dimensional code based on the product information
Character string.
Based on current product two dimensional code regulatory requirement, product letter corresponding with the product two dimensional code regulatory requirement is confirmed
Breath, the product information includes but is not limited to name of product, category, brand, packaging material specification, packaging material material etc., is specifically used for
The content for generating the product information of two-dimensional barcode information can be arranged by correlation function to be set.The product information having confirmed that is added to
In preset character string, to generate corresponding product two dimensional code character sequence according to the character string and the product information
Column.
Wherein, when product information is added to preset character string, the content of the product information can be parsed, it will
Parsing result is added in preset character string by default rule.In the methods of the invention, the preset character got
Sequence be to generate provided by product two dimensional code character string, therefore, the preset character string be it is pre-generated or
Pre-stored random character, and the preset character string before obtaining product information or gets product information
Meanwhile being generated by preset random rule, further, the default generation random rule of the preset character string can be by
Relevant random character function setting is set or by administrator's sets itself.It need to evade existing when setting preset character string
The information such as length, the character quantity of some random character input errors and character string, such as random character need to arrange when generating
Except contents such as O/o/0, specific preset character string create-rule also can be using existing random character generating mode herein
Seldom repeat.Based on such situation, the product two dimensional code character sequence is being generated by product information and preset character string
When column, the two dimensional code character string further need to be generated using default create-rule.Wherein, the default create-rule includes
But it is not limited to format, character sequence and the character information etc. of the product two dimensional code character string, can be set by relevant function
Set free setting.In addition, in the methods of the invention, the create-rule of the product two dimensional code character string may be defined as: business
Domain name+type identifier+time identifier+random character.And separated between character string with separator in same group, with another between group
One separator separates, and is formatted in the form of CSV.In the two dimensional code character string, the type identifier is
One English alphabet or number in addition to 0, o, O;Time identifier is a ten's digit;Random character be a string 0, o,
English alphabet or number other than O;Separator cannot be number or letter.
Step S20 obtains the first key that the product two dimensional code character string has been set, and raw with the first key
At corresponding second key;
It is operated, is obtained based on the product two dimensional code character string based on current product two dimensional code character sequential encryption
First key has been set, and the first key is what user was arranged in corresponding first key setting area;Or described first
Key is by corresponding administrative staff's default setting.In this way, having been set in the correspondence for getting the product two dimensional code character string
After determining first key, corresponding second key is generated with the first key.Wherein, when generating second key, according to
The the second key create-rule set is generated, and the second key create-rule includes but is not limited to byte quantity and word
Type etc. is accorded with, such as the generation byte quantity of the second key is set and is no less than 128 and must include number/letter/symbol etc.
Setting rule.
Step S30 generates encryption key according to the first key and the second key, with generated encryption keys
The product two dimensional code character string.
According to the first key of the product two dimensional code character string set and corresponding the second key generated, with institute
After stating first key and the second key generation encryption key, the product two dimensional code character string is encrypted.Wherein, with described
When one key and the second key generate encryption key, cryptographic operation, the reality of cryptographic operation are carried out by preset create-rule
Border operating procedure can be as described below:
1, first key and the second key are spliced;
2, spliced first key and the second key are reset according to preset order;
3, by after rearrangement first key and the second key using MD5 carry out hash twice.
As described above, product two dimensional code character string described in the encryption key generated with first key and the second key carries out
After cryptographic operation, to guarantee the first key, the encryption key of the second key generation and the product two dimensional code character string
Encryption and decryption oprerations it is normal, save the encryption key of the first key, the second key and generation, it is therefore, described to obtain
The first key for taking the product two dimensional code character string to set, and corresponding second key is generated with the first key
Step, further includes:
The first key and the second key are added to preset-key list to save the first key and second close
The incidence relation of key, wherein the cipher key list further includes the first key and the encryption key that the second key generates;
And according to the setting time of the first key, the first key and the second key validity period are registered.
It, will when the product two dimensional code character string described in the encryption keys generated by first key and the second key
The first key and the second key storage into corresponding preset-key list, the preset-key list realize when, with
The product two dimensional code character string is mark, and therefore, the preset-key list is the product two dimensional code character string pair
The cipher key list answered.By the preset-key list store the first key and the second key when, save described the
The incidence relation of one key and the second key, also, the encryption key of the first key and the generation of the second key is saved, into one
Step, the decruption key based on the first key and the generation of the second key can be also added in the preset-key list, with
Operation is decrypted to the product two dimensional code character string.
In addition, being that stored key information has been set separately in the preset-key list to improve secrecy effect
The time limit is imitated, in the present embodiment, sets the validity period of first key in preset-key list, it can setting based on the first key
It fixes time and the corresponding key being arranged calculates validity period of the first key effective period.For example, current first is close
The setting time of key is April 1, and the key effective period being arranged is 30 days, and therefore, the validity period of the first key is
April 1 to May 1.In setting the preset-key list when validity period of first key, described first can be directly saved
The setting time of key directly acquires when confirming whether first key is effective and calculates the key effective period that currently sets the
One key validity period confirmed whether the first key is effective in turn.In practical applications, the validity period of first key is set
Content can be determined based on the setting of validity period provided by current preset cipher key list option.
In the present embodiment, by the way that product two dimensional code character string to be executed to the cryptographic operation of two layers of key, to pass through single layer
Key input responds corresponding second key composition decruption key and two dimensional code character string, that is, two dimensional code is decrypted, therefore uses
Family can not decrypt two dimensional code character string separately through one layer of key, realize the privacy degrees for improving two-dimentional code encryption, avoid
Because Key Exposure influence the safety management of the management of product so that improve two dimensional code character string confidentiality beneficial effect.
With reference to Fig. 4, Fig. 4 is the flow diagram of two dimensional code decryption method first embodiment of the present invention, shown in above-mentioned
Embodiment, the two dimensional code decryption method includes:
Step S40 confirms whether the first key is effective when receiving first key;
Based on current decryption demand, the first key of user's input is received.Based on the first key received, institute is confirmed
Whether effective state first key, the confirmation whether effective mode of first key may be defined as confirming the first key whether with
Whether the registered first key of preset-key list is consistent, or confirms described the by parsing first key with parsing result
Whether one key effective, in the present embodiment, be defined as the first key whether with preset-key list registered first
Key agreement.
Step S50 obtains the second key corresponding with the first key when confirming that the first key is effective;
By the validation testing of defined first key, that is, confirm the first key whether with preset-key list
When the first key of one key pair is consistent, using the first key as condition, it is close to obtain corresponding with the first key second
Key.As described above, need to confirm that the first key is effective first, validation testing be confirm the first key whether with it is default
Registered first key is consistent in cipher key list, therefore in this manner, confirm the first key with it is registered
When first key is consistent, also need the validity period for confirming the first key, i.e., it is described when confirming that the first key is effective, it obtains
The step of taking the second key corresponding with the first key, further includes:
Read the validity period of the first key and the second key, and confirm current time whether the validity period when
Between in range;
When confirming that current time is in the time range of the validity period, confirm that the first key is effective.
When receiving the first key of user's input, confirming that the first key is registered in preset-key list
First key when, confirm that the first key is that target cipher key based on the target cipher key having confirmed that confirms the target cipher key
Whether it is effective target key, confirms the effective means of key pair, whether before the deadline to confirm the target cipher key, because
This, reads the time range of the target cipher key registered validity period, confirmation current time whether validity period time model
In enclosing;Alternatively, the key effective period for obtaining the setting time of the target cipher key and being currently arranged, according to the setting
Time and key calculate the time range of the validity period of the target cipher key effective period, then confirm current time whether
In the time range of the validity period of the target cipher key calculated.In this way, being determined by the validity period for setting key close
Other whether effective validation testings of key also belong in protection scope of the present invention.Therefore, in confirmation current time described the
When in the time range of the validity period of one key, confirm that the first key is effective, obtains the first key corresponding second
Key.
Further, when confirming current time not in the time range of the validity period of the first key, i.e., described
The validity period of the first key and the second key is read, and confirms current time whether in the time range of the validity period
The step of after, further includes:
When confirming the first key not in the deadline range of validity period, confirms the first key failure, initiate
Reset the prompt information of first key.
Based on the time range of first key corresponding validity period, current time not having in the first key is being confirmed
When in the time range of effect phase, confirms the first key failure, be based on such situation, to realize product two dimensional code character string
Decryption, initiate reset first key prompt information, with again according to the first key of input generate the second key add
The close product two dimensional code character string.
In addition, to improve secrecy effect, also needing to confirm the defeated of the first key when confirming that the first key is effective
Enter source, i.e., it is described when confirming that current time is in the time range of the validity period, confirm that the first key is effective
Step, further includes:
The contact method that the corresponding identifying code of the first key is back to the first key registration is generated, to verify
State the input source of first key;
The first key and identifying code are received at the same time and confirm that the first key and identifying code without mistaking, confirm
The input source of the first key is errorless.
When confirming that the first key is effective, generates identifying code corresponding with the first key and be back to described first
The contact method of key registration, wherein the first key in registration to when the preset-key list, it is close according to described first
The setting source of key, the contact method for obtaining the setting source are registered as the input source of the first key.Alternatively, setting
When the fixed first key, the registration source of the first key is added to the first key, is passed through described in parsing with this
First key confirms corresponding registration source, i.e., the described corresponding input source of first key.Wherein, the identifying code can be based on institute
It states first key to automatically generate, or registers in the first key to when preset-key list and given birth to automatically for the first key
At or the corresponding identifying code of distribution, therefore, there are incidence relations with the first key for the identifying code.By the identifying code
After being sent to the corresponding input source of the first key or contact method, first key and identifying code are received again.And
It receives first key and identifying code simultaneously and the first key and identifying code is without mistaking, confirm the input of the first key
Source is errorless.
Step S60 generates decruption key with the first key received and the second key got, and with the decryption
Key decrypts corresponding product two dimensional code character string.
According to the effective first key having confirmed that and the second key got, according to the first key and the second key
Decruption key is generated, to decrypt corresponding product two dimensional code character string.Wherein, it is generated by first key and the second key
When decruption key, the generation step of the encryption key based on the first key and the second key, according to the first key and
The operating procedure that second key generates decruption key can be as described below:
1, first key 1 and key 2 are spliced;
2, it is reset in a certain order after splicing;
3, hash twice is carried out using MD5 after resetting, decruption key is obtained, is decrypted.
As described above, decrypting corresponding product two dimension after the generation decruption key by first key and the second key
Code character sequence, the decryption oprerations are executed in corresponding vendor server, and the vendor server carry deciphering module with
And therefore print module after decryption oprerations, obtains the product two dimensional code character string, and further, manufacturer's service
Device is Sequence Transformed to print after two dimensional code by obtained product two dimensional code character, is obtained by the two dimensional code that scanning generates corresponding
Product information is to realize the safety management of the product.Wherein, the incidental product safety of product two dimensional code character string
The product information of management includes but is not limited to the brand of product, title, specification, the packaging time, the time of making the product, sells to dealer
Deng.
In the present embodiment, according to the first key received, effectively obtained and first key pair afterwards in verifying first key
The second key answered, decryption obtains corresponding two dimensional code character after generating decruption key by first key and the second key with this
Sequence obtains two dimensional code in turn and realizes product safety management, further realizes the beneficial effect for improving two dimensional code management safety
Fruit.
The present invention also provides two dimensional code encryption system, the two dimensional code encryption system realizes as described above two when being executed
Tie up the content of code encryption embodiment of the method and two dimensional code decryption method embodiment.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that the process, method, drug or the system that include a series of elements not only include those elements, and
And further include other elements that are not explicitly listed, or further include for this process, method, drug or system institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do
There is also other identical elements in the process, method of element, drug or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone,
Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of two dimensional code encryption method, which is characterized in that the two dimensional code encryption method the following steps are included:
Based on current two dimensional code encryption requirements, product two dimensional code character string corresponding with the encryption requirements is confirmed;
The first key that the product two dimensional code character string has been set is obtained, and generates corresponding second with the first key
Key;
Encryption key is generated according to the first key and the second key, with the two dimension of product described in generated encryption keys
Code character sequence.
2. two dimensional code encryption method as described in claim 1, which is characterized in that described to be needed based on current two-dimentional code encryption
Before the step of asking, confirming product two dimensional code character string corresponding with the encryption requirements, further includes:
Product information is added in preset character string to generate the product two dimensional code character based on the product information
Sequence.
3. two dimensional code encryption method as described in claim 1, which is characterized in that described to obtain the product two dimensional code character sequence
Arrange the first key set, and the step of corresponding second key is generated with the first key, further includes:
The first key and the second key are added to preset-key list to save the first key and the second key
Incidence relation, wherein the cipher key list further includes the first key and the encryption key that the second key generates;
And according to the setting time of the first key, the first key and the second key validity period are registered.
4. a kind of two dimensional code decryption method, which is characterized in that the two dimensional code decryption method the following steps are included:
When receiving first key, confirm whether the first key is effective;
When confirming that the first key is effective, the second key corresponding with the first key is obtained;
Decruption key is generated with the first key received and the second key got, and corresponding with the decryption key decryption
Product two dimensional code character string.
5. two dimensional code decryption method as claimed in claim 4, which is characterized in that described to confirm that the first key is effective
When, obtain the second key corresponding with the first key the step of, further includes:
Read the validity period of the first key and the second key, and confirm current time whether the validity period time model
In enclosing;
When confirming that current time is in the time range of the validity period, confirm that the first key is effective.
6. two dimensional code decryption method as claimed in claim 5, which is characterized in that described to confirm current time described effective
When in the time range of phase, the effective step of the first key is confirmed, further includes:
The contact method that the corresponding identifying code of the first key is back to first key registration is generated, to verify described the
The input source of one key;
The first key and identifying code are received at the same time and confirm the first key and identifying code without mistaking, described in confirmation
The input source of first key is errorless.
7. two dimensional code decryption method as claimed in claim 5, which is characterized in that the first key and second close of reading
The validity period of key, and confirm current time whether after the step in the time range of the validity period, further includes:
When confirming the first key not in the deadline range of validity period, confirms the first key failure, initiate again
Set the prompt information of first key.
8. a kind of two dimensional code encryption device, which is characterized in that the two dimensional code encryption device includes: print module, memory, place
Device is managed, the two dimensional code encipheror that can be run on the processor, the two dimension code encryption journey are stored on the memory
It is realized when sequence is executed by the processor as described in any one of claims 1 to 3 the step of two dimensional code encryption method.
9. a kind of Cloud Server, which is characterized in that the Cloud Server includes: memory, processor, is stored on the memory
There is the two dimensional code decryption program that can be run on the processor, it is real when the two dimensional code decryption program is executed by the processor
Now as described in any one of claim 4 to 7 the step of two dimensional code decryption method.
10. a kind of two dimensional code encryption system, which is characterized in that the two dimensional code encryption system includes: as claimed in claim 8
Two dimensional code encryption device and Cloud Server as claimed in claim 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811322863.5A CN109447203A (en) | 2018-11-07 | 2018-11-07 | Two dimensional code encryption and decryption method, device, Cloud Server and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811322863.5A CN109447203A (en) | 2018-11-07 | 2018-11-07 | Two dimensional code encryption and decryption method, device, Cloud Server and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109447203A true CN109447203A (en) | 2019-03-08 |
Family
ID=65551283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811322863.5A Pending CN109447203A (en) | 2018-11-07 | 2018-11-07 | Two dimensional code encryption and decryption method, device, Cloud Server and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109447203A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109344943A (en) * | 2018-09-30 | 2019-02-15 | 合肥译码智能科技有限公司 | A kind of method of embedded double two-dimensional barcode information secrecy |
CN114338176A (en) * | 2021-12-29 | 2022-04-12 | 支付宝(杭州)信息技术有限公司 | Data transmission method, device and network card |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103295046A (en) * | 2013-06-13 | 2013-09-11 | 北京网秦天下科技有限公司 | Method and device for generating and using safe two-dimensional codes |
CN104219626A (en) * | 2014-08-25 | 2014-12-17 | 北京乐富科技有限责任公司 | Identity authentication method and device |
CN105847011A (en) * | 2016-03-21 | 2016-08-10 | 华为技术有限公司 | Key loading method and device |
CN106878277A (en) * | 2017-01-06 | 2017-06-20 | 力同科技股份有限公司 | A kind of method and device based on DMR standard implementation voice encryptions |
CN107451643A (en) * | 2017-08-15 | 2017-12-08 | 北京航空航天大学 | Generation, recognition methods and the device of dynamic two-dimension code |
CN108243197A (en) * | 2018-01-31 | 2018-07-03 | 北京深思数盾科技股份有限公司 | A kind of data distribution, retransmission method and device |
-
2018
- 2018-11-07 CN CN201811322863.5A patent/CN109447203A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103295046A (en) * | 2013-06-13 | 2013-09-11 | 北京网秦天下科技有限公司 | Method and device for generating and using safe two-dimensional codes |
CN104219626A (en) * | 2014-08-25 | 2014-12-17 | 北京乐富科技有限责任公司 | Identity authentication method and device |
CN105847011A (en) * | 2016-03-21 | 2016-08-10 | 华为技术有限公司 | Key loading method and device |
CN106878277A (en) * | 2017-01-06 | 2017-06-20 | 力同科技股份有限公司 | A kind of method and device based on DMR standard implementation voice encryptions |
CN107451643A (en) * | 2017-08-15 | 2017-12-08 | 北京航空航天大学 | Generation, recognition methods and the device of dynamic two-dimension code |
CN108243197A (en) * | 2018-01-31 | 2018-07-03 | 北京深思数盾科技股份有限公司 | A kind of data distribution, retransmission method and device |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109344943A (en) * | 2018-09-30 | 2019-02-15 | 合肥译码智能科技有限公司 | A kind of method of embedded double two-dimensional barcode information secrecy |
CN114338176A (en) * | 2021-12-29 | 2022-04-12 | 支付宝(杭州)信息技术有限公司 | Data transmission method, device and network card |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103295046B (en) | The method and apparatus generated and use safe Quick Response Code | |
CN1985466B (en) | Method of delivering direct proof private keys in signed groups to devices using a distribution CD | |
US10045210B2 (en) | Method, server and system for authentication of a person | |
CN110401677B (en) | Method and device for acquiring digital copyright key, storage medium and electronic equipment | |
US8495383B2 (en) | Method for the secure storing of program state data in an electronic device | |
CN104471581B (en) | Media item is protected using media safety controller | |
CN109766134A (en) | System start method, device, electronic equipment and storage medium | |
CN108537314A (en) | Product marketing system and method based on Quick Response Code | |
CN112182596B (en) | Method for bidding and opening bid through electronic insurance policy system and data security method | |
KR101523309B1 (en) | A system and method for distributing application | |
CN103853943B (en) | program protection method and device | |
CN111339201B (en) | Evaluation method and system based on block chain | |
CN104320265A (en) | Authentication method and device for software platform | |
CN114266033A (en) | Verification code generation method and device, verification code login system and electronic equipment | |
CN110598429A (en) | Data encryption storage and reading method, terminal equipment and storage medium | |
CN107920060A (en) | Data access method and device based on account | |
CN103592927A (en) | Method for binding product server and service function through license | |
CN110135542B (en) | The method, apparatus and system of user's interactive mode Internet of Things verifying based on RF tag | |
CN109447203A (en) | Two dimensional code encryption and decryption method, device, Cloud Server and system | |
CN103236929B (en) | A kind of information processing method and deciphering device | |
CN110414269B (en) | Processing method, related device, storage medium and system of application installation package | |
CN107026841B (en) | Method and device for publishing works in network | |
CN111949996A (en) | Generation method, encryption method, system, device and medium of security private key | |
CN110532129A (en) | A kind of method, apparatus, equipment and the storage medium of file encryption storage | |
CN109462620A (en) | One kind realizing password method for retrieving and system based on a variety of safety verification modes |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190308 |
|
RJ01 | Rejection of invention patent application after publication |