CN108628925A - The method that the method for key write-in, key use - Google Patents

The method that the method for key write-in, key use Download PDF

Info

Publication number
CN108628925A
CN108628925A CN201711320451.3A CN201711320451A CN108628925A CN 108628925 A CN108628925 A CN 108628925A CN 201711320451 A CN201711320451 A CN 201711320451A CN 108628925 A CN108628925 A CN 108628925A
Authority
CN
China
Prior art keywords
key
index
physics
logic
application
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
CN201711320451.3A
Other languages
Chinese (zh)
Other versions
CN108628925B (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.)
PAX Computer Technology Shenzhen Co Ltd
Original Assignee
PAX Computer Technology Shenzhen 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 PAX Computer Technology Shenzhen Co Ltd filed Critical PAX Computer Technology Shenzhen Co Ltd
Priority to CN201711320451.3A priority Critical patent/CN108628925B/en
Publication of CN108628925A publication Critical patent/CN108628925A/en
Application granted granted Critical
Publication of CN108628925B publication Critical patent/CN108628925B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07GREGISTERING THE RECEIPT OF CASH, VALUABLES, OR TOKENS
    • G07G1/00Cash registers

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a kind of method of key write-in, and this method includes:It receives key inquiry request and applies corresponding key, wherein key inquiry request carries application identities and corresponding logic index;Key resource lock is obtained according to key inquiry request, so that key resource lock locks key resource;Logic is searched from default corresponding table index corresponding physics index according to key inquiry request, when application identities difference, the identical corresponding different physics index of logic index;When searching successfully, the physics that application corresponding key write-in is found is indexed into corresponding system safety zone, discharges key resource lock.In addition, additionally providing a kind of device and a kind of method that key uses and device, a kind of computer equipment and storage medium of key write-in.

Description

The method that the method for key write-in, key use
Technical field
The present invention relates to field of computer technology, method, apparatus, computer equipment more particularly to a kind of write-in of key And a kind of storage medium and method, apparatus that key uses, computer equipment and storage medium.
Background technology
In traditional technology, the key of the application in POS (Point Of Sale, payment terminal) system is all to share object Manage memory space, that is to say, that the key of same physical index can be accessed using A and using B, exactly because each answer All it is corresponding corresponding physical key index with the middle cipher key index used, the problem of key covering occurs so frequently resulting in.
Invention content
Based on this, it is necessary in view of the above-mentioned problems, shared key causes key to cover between offer one kind solving application Key write-in method, apparatus, computer equipment and storage medium and key use method, apparatus, computer equipment And storage medium.
A kind of method of key write-in, this method include:
Receive key inquiry request and apply corresponding key, wherein key inquiry request carry application identities and Corresponding logic index;
Key resource lock is obtained according to key inquiry request, so that key resource lock locks key resource;
Search from default corresponding table logic according to key inquiry request and index corresponding physics index, when application identities not Meanwhile the identical corresponding different physics index of logic index;
When searching successfully, the physics that application corresponding key write-in is found is indexed into corresponding system safety Area discharges key resource lock.
It searches logic from default corresponding table according to key inquiry request in one of the embodiments, and indexes corresponding object After reason index, further include:When searching failure, vacant physics rope is searched from default corresponding table according to key inquiry request Draw;Application identities and corresponding logic index are established into correspondence with the physics index found, update default corresponding table.
In one of the embodiments, when searching failure, sky is searched from default corresponding table according to key inquiry request After remaining physics index, further include:When not finding vacant physics index in default corresponding table, then inspection is held close Whether the application of key is unloaded;If the application for holding key is unloaded, is deleted from default corresponding table and apply counterlogic Index corresponding physics index.
It searches logic from default corresponding table according to key inquiry request in one of the embodiments, and indexes corresponding object Reason index, when application identities difference, the identical corresponding different physics index of logic index, including:Default corresponding table is obtained, Corresponding table includes the mapping relations of application identities corresponding logic index and physics index, wherein when application identities difference, phase The corresponding different physics index of same logic index;According to key inquiry request, lookup is corresponding with application identities from corresponding table Logic indexes corresponding physics index.
The physics that application corresponding key write-in is found is indexed into corresponding system safety in one of the embodiments, Area, including:Judge whether using corresponding key be to retain key;When the corresponding key of application is non-reserved key, then will The physics found using the write-in of corresponding key indexes corresponding system safety zone.
A kind of device of key write-in, the device include:
Key inquiry request receiving module, for receiving key inquiry request and applying corresponding key, wherein key is looked into It askes request and carries application identities and corresponding logic index;
First key resource lock acquisition module, for obtaining key resource lock according to key inquiry request, so that key provides Source lock locking key resource;
First physics index search module, for searching logic index pair from default corresponding table according to key inquiry request The physics index answered, when application identities difference, the identical corresponding different physics index of logic index;
Writing module, for when searching successfully, the physics index that application corresponding key write-in is found to be corresponding System safety zone discharges key resource lock.
Method, apparatus, computer equipment and the storage medium of above-mentioned key write-in, terminal is by receiving key inquiry request With using corresponding key, which carries the corresponding logic index of application identities.Terminal is according to receiving Key inquiry request go obtain key resource lock, key resource lock will lock key resource, terminal according to key inquiry request from The logic is inquired in default corresponding table indexes corresponding physics index, wherein when application identities difference, identical logic index Correspond to different physics indexes.When finding corresponding physics index, the corresponding key write-in of the application received is looked into The physics found indexes corresponding system safety zone, final to discharge key resource index.Therefore, the key of different application is written Different physics indexes corresponding system safety zone, avoids the problem of shared key causes key to cover between applying.
A kind of method that key uses, this method include:
It receives key and uses request, wherein key carries application identities using request and corresponding logic indexes;
Acquisition request key resource lock is used according to key is received, so that key resource lock locks key resource;
Using request from default corresponding table search logic according to key and index corresponding physics and index, when application identities not Meanwhile the identical corresponding different physics index of logic index;
When searching successfully, corresponding key is indexed to physics and is used, key resource lock is discharged.
A kind of device that key uses, the device include:
Key uses request receiving module, uses request for receiving key, wherein key carries application using request Mark and corresponding logic index;
Second key resource lock acquisition module, for using acquisition request key resource lock according to reception key, so that close Key resource lock locks key resource;
Second physics index search module, for searching logic index pair from default corresponding table using request according to key The physics index answered, when application identities difference, the identical corresponding different physics index of logic index;
Key uses module, for when searching successfully, indexing corresponding key to physics and using, release key money It locks in source.
Method, apparatus, computer equipment and the storage medium that above-mentioned key uses, terminal are asked by receiving key use It asks, which carries application identities using request and corresponding logic indexes, close using acquisition request according to key is received Key resource lock, in order to lock key resource.Terminal is searched using request from default corresponding table according to the key received Logic indexes corresponding physics index, wherein when application identities difference, the identical corresponding different physics rope of logic index Draw.When successfully finding corresponding physics index, then corresponding key can be indexed to physics and used, finally discharged close Key resource lock.Due to the corresponding different physics index of the logic index used in each application, that is, there is corresponding independent key Space, therefore, in multiple applications simultaneously in use, only allowing using corresponding key corresponding using would not cause close The conflict of key index.
A kind of computer equipment, including memory, processor and storage can be run on a memory and on a processor Computer program, the processor realize the step in the method for above-mentioned key write-in when executing described program.
A kind of computer equipment, including memory, processor and storage can be run on a memory and on a processor Computer program, the processor realize the step in the method that above-mentioned key uses when executing described program.
A kind of computer readable storage medium, is stored thereon with computer program, which realizes when being executed by processor Step in the method for above-mentioned key write-in.
A kind of computer readable storage medium, is stored thereon with computer program, which realizes when being executed by processor Step in the method that above-mentioned key uses.
Description of the drawings
Fig. 1 is the flow chart for the method that key is written in one embodiment;
Fig. 2 is the flow chart for the method that key is written in another embodiment;
Fig. 3 is to search logic from default corresponding table according to key inquiry request in one embodiment to index corresponding physics The flow chart of index;
Fig. 4 is that the physics that application corresponding key write-in is found is indexed corresponding system safety zone in one embodiment Flow chart;
Fig. 5 is the flow chart for the method that key is written in another embodiment;
Fig. 6 is the schematic diagram for the method that key is written in one embodiment;
Fig. 7 is the flow chart for the method that key uses in one embodiment;
Fig. 8 is the structure diagram for the device that key is written in one embodiment;
Fig. 9 is the structure diagram for the device that key uses in one embodiment;
Figure 10 is the structure chart of the inside of one embodiment Computer equipment.
Specific implementation mode
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.
As shown in Figure 1, in one embodiment, providing a kind of method of key write-in, this method is to be applied to terminal In be illustrated.Including:
Step 102, it receives key inquiry request and applies corresponding key, wherein key inquiry request carries application Mark and corresponding logic index.
Specifically, application here is generally referred to as the application in terminal, and so-called key is a kind of parameter, it is possible to understand that Key is one piece of data, each key has corresponding independent space.Wherein, the key in is all used to effectively supervise Using corresponding key, in general, using logic to index in.So-called logic index is virtual index, different application Logic index can repeat.Wherein, index refers to that individual, physics the value to one or more columns per page in database table carries out A kind of storage organization of sequence can quickly search the space of required key storage by index.Further, terminal can lead to Relevant applications trigger key inquiry request is crossed, and Password Input is sent to by key inquiry request and using corresponding key Equipment.Due to can by different applications trigger key inquiry requests, and it is commonly used use logic to index, it is therefore, close Application identities and the corresponding logic index of application identities are carried in key inquiry request.Wherein, application identities are for uniquely marking Know application.
Step 104, key resource lock is obtained according to key inquiry request, so that key resource lock locks key resource.
Specifically, it after the cipher input equipment in terminal receives key inquiry request, goes to obtain according to key inquiry request Take key resource lock, wherein the effect of key resource lock is to ensure during key is written, and is not beaten by other application It is disconnected, therefore, it is necessary to by key resource lock by key resource lock.Wherein, key resource refers to what a series of key formed Resource.In general, after key resource is locked, the related application in addition to triggering key inquiry request, other application cannot all visit Ask key resource.
Step 106, logic is searched from default corresponding table according to key inquiry request and indexes corresponding physics index, when answering When with identifying different, the identical corresponding different physics index of logic index.
Specifically, the cipher input equipment in terminal is after by key resource by the locking of the key resource lock that gets, It is corresponding there are application identities, application identities due to having corresponding table in advance in the key management unit in terminal, in the correspondence table Logic indexes and the logic indexes the mapping relations between corresponding physics index.Due to, using logic index only It is a virtual index, therefore different application is identified corresponding application and can be indexed using same logic.But when using mark When knowing different, i.e., when the corresponding application of application identities is different, the identical corresponding different physics index of logic index.Wherein, institute Meaning physics index refers to storing the corresponding space of key by index search.Specifically, the cipher input equipment in terminal is logical It crosses and query interface is called to be indexed from key management unit according to the application identities carried in key inquiry request and corresponding logic In correspondence table in search the corresponding logic of the application identities and index corresponding physics index.
Step 108, when searching successfully, the physics that application corresponding key write-in is found is indexed into corresponding system and is pacified The whole district discharges key resource lock.
Specifically, since physics index is the index in the space for storing key, then it can be indexed by physics and rapidly be searched To storage key space, therefore by searching for physics index can quickly find corresponding system safety zone.So-called system System safety zone refers to the space of the safety storage key in POS (Point Of Sale, payment terminal) system.Due in order to anti- Only multiple apply clashes in cipher key processes are written, use key resource lock locking key resource mechanism, therefore Success needs to discharge key resource lock by behind the safety zone of key writing system, for the key energy of another follow-up application Enough it is successfully written.Specifically, it is corresponded to when success finds application identities counterlogic index from the correspondence table kept in advance Physics index when, terminal is written to the corresponding system arrived by physics index search by what is received using corresponding key In safety zone, finally key resource lock is discharged.
In the present embodiment, terminal is by receiving key inquiry request and corresponding key, the key inquiry request being applied to take With the corresponding logic index of application identities.Terminal goes to obtain key resource lock, key according to the key inquiry request received Resource lock will lock key resource, and terminal inquires the logic from default corresponding table according to key inquiry request and indexes corresponding object Reason index, wherein when application identities difference, identical logic index corresponds to different physics indexes.When finding correspondence Physics index when, what will be received indexes corresponding system safety zone using the physics that finds of corresponding key write-in, most Release key resource index eventually.Therefore, different physics is written into the key of different application and indexes corresponding system safety zone, no The problem of shared key causes key to cover between applying only is avoided, and also avoids key and is interrupted in ablation process The problem of.
In one embodiment, the method for key write-in further includes:When searching failure, according to key inquiry request from pre- If searching vacant physics index in corresponding table;Application identities and corresponding logic index are built with the physics index found Vertical correspondence updates default corresponding table.
In one embodiment, the method for key write-in further includes:When not finding vacant object in default corresponding table When reason index, then check whether the application for holding key is unloaded;If the application for holding key is unloaded, from default correspondence Application identities counterlogic is deleted in table indexes corresponding physics index.
Fig. 2 shows the methods that key in one embodiment is written, and this method is to be applied to be illustrated in terminal. Including:
Step 202, it receives key inquiry request and applies corresponding key, wherein key inquiry request carries application Mark and corresponding logic index.
Specifically, terminal can be by relevant applications trigger key inquiry request, while will trigger key inquiry request It is sent to cipher input equipment using corresponding key.Due in terminal using be logic index, and logic indexes It is virtual index, therefore the logic index that different application uses can repeat.Wherein, since key inquiry request can be by not With applications trigger, therefore carried in key inquiry request triggering key inquiry request the corresponding application identities of application and This using logic index.
Step 204, key resource lock is obtained according to key inquiry request, so that key resource lock locks key resource.
Specifically, it since the key entry device in terminal is after receiving key inquiry request, can be inquired according to key Request goes to obtain key resource lock.Due to avoiding the problem that preventing the application in triggering key request corresponding close using covering It is interrupted by other application in key ablation process, it is therefore desirable to by obtaining key resource lock by key resource lock.
Step 206, judge index corresponding object according to whether key inquiry request finds logic from default corresponding table Reason index, if so, entering step 208;Conversely, then entering step 210.
Specifically, the cipher input equipment in terminal is after locking key resource by the key resource got, Query interface need to be called to find key inquiry from the correspondence table kept in advance in key management unit according to key inquiry request The logic carried in request indexes corresponding physics index.Further, include the corresponding application name of application identities in corresponding table Title, logic index and the logic index the mapping relations between corresponding physics index, wherein when application identities difference, The identical corresponding different physics index of logic index.Mapping relations include but not limited to, as Apply Names be A, A using Logic index be 1, corresponding physics index is 2;Apply Names are A, A using logic index be 2, corresponding physics Index is 1, Apply Names B, B using logic index be 1, corresponding physics index is 3;Using B, B using Logic index be 2, corresponding physics index is 4.Specifically, judge that the key entry device in terminal is asked according to key inquiry Seeking Truth is no to find corresponding physics index, if so, entering step 208;Conversely, then entering step 210.
Step 208, the physics that application corresponding key write-in is found is indexed into corresponding system safety zone, discharges key Resource lock.
Specifically, cipher input equipment is inquired according to key inquiry request calling query interface from key management unit close When the logic that key inquiry request carries indexes corresponding physics index, since physics index refers to the space for storing key, each There are one corresponding indexes in space, can pass through the index search to the corresponding space of storage key.Therefore, cipher input equipment tune The physics searched using the write-in of corresponding key received is indexed into corresponding system safety zone with cipher key interface is write.Due to, The mechanism of key resource lock is used in the ablation process of key, therefore, successfully by the key writing system safety of application Qu Hou need to discharge key resource lock.
Step 210, judge whether vacant physics index is searched from default corresponding table according to key inquiry request, if It is then to enter step 212;Conversely, then entering step 214.
Specifically, when cipher input equipment calls query interface to be inquired from key management unit according to key inquiry request When the logic that key inquiry request carries indexes corresponding physics index failure, illustrate that the corresponding logic index of the application identities exists There is no corresponding physics to index in the correspondence table kept in advance in key management unit.Therefore, it is answered to be established in corresponding table With the mapping relations between title, the corresponding logic index of application identities and physics index, vacant physics is needed to index ability It establishes.Therefore need to judge to call whether query interface finds vacant physics from key management unit according to key inquiry request Index, if so, entering step 212;Conversely, then entering step 214.
Step 212, application identities and corresponding logic index are established into correspondence with the physics index found, more New default corresponding table.
Specifically, when according to key inquiry request call query interface vacant physics rope is found from key management unit When drawing, illustrate to there is vacant physics to index corresponding key storage space to store the key of the application, therefore need to be in key pipe Manage device correspondence table in establish triggering key inquiry request application, and using logic index with find it is vacant Physics index between mapping relations, update key management unit in correspondence table.Finally, in updated key management unit It can reflect the mapping relations between application identities, logic index and the physics index of the application in corresponding table.
Step 214, check whether the application for holding key is unloaded, if so, entering step 216;Conversely, then entering step Rapid 210.
Specifically, when according to key inquiry request call query interface vacant physics rope is found from key management unit When drawing unsuccessfully, illustrating does not have vacant physics to index corresponding space in key management unit can store the key of the application.Therefore, It needs to search from the application for holding key in terminal.Further, by check hold key application whether be unloaded come Vacant physics index is obtained, if so, entering step 216;If checking, the application for holding key is not unloaded, is directly reported an error Inform terminal.
Step 216, it is deleted from default corresponding table and indexes corresponding physics index using counterlogic.
Specifically, when key management unit checks that the application for holding key is unloaded, then it need to delete and use from corresponding table Mapping relations between identifying the application identities of the unloading, logic index is indexed with corresponding physics, which is indexed and is become It is indexed at vacant physics, in order to establish the application mark for identifying triggering key inquiry request application in corresponding table Know, using logic index vacant physics index between corresponding mapping relations.That is, recycling is unloaded Using the key held, after the key of recycling unloading application, due to having vacant physics index in default corresponding table, then return Step 210 is searched vacant physics to updated corresponding table and is indexed again.
In the present embodiment, when the key resource that terminal is got is inadequate, then it can index to come by searching for vacant physics The correspondence between Apply Names and corresponding logic index and the physics index found is established, corresponding table is updated.Such as When fruit does not find vacant physics index, key management unit is also needed by checking whether the application for holding key is unloaded, if When the application for the key held is unloaded, then the corresponding physics index of application of unloading is deleted from corresponding table, it will be to the physics Index carries out sub-distribution again.It not only ensure that the key of each application has independent key space, but also unloaded by recycling The key of application reduce the waste of key resource.
In one embodiment, as shown in figure 3, searching logic index pair from default corresponding table according to key inquiry request The physics index answered, when application identities difference, the identical corresponding different physics index of logic index, including:
Step 302, default corresponding table is obtained, corresponding table includes that the corresponding logic index of application identities is reflected with what physics indexed Penetrate relationship, wherein when application identities difference, the identical corresponding different physics index of logic index.
Due to having corresponding table in advance in the key management unit in terminal, application identities, application are reflected in the correspondence table It identifies corresponding logic index and the logic indexes mapping relations between corresponding physics index.Since different application identifies Corresponding application may be reused same logic index, therefore mapping relations are it is understood that when application identities difference, identical The corresponding different physics index of logic index.Specifically, terminal first obtains the correspondence table kept in advance from key management unit.
Step 304, it is corresponding that logic index corresponding with application identities is searched from corresponding table according to key inquiry request Physics indexes.
After obtaining the correspondence table that keeps in advance in key management unit, since terminal passes through relevant applications trigger key Inquiry request, thus key inquiry request carry application identities for identifying the application and should using logic rope Draw.Due to that can reflect the mapping relations between application identities, logic index and physics index, terminal meeting in corresponding table Query interface is called to search physics index corresponding with logic index from the correspondence table got according to key inquiry request, then Corresponding key storage space is searched by physics index.
In one embodiment, as shown in figure 4, the physics that application corresponding key write-in is found is indexed corresponding system System safety zone, including:
Step 402, judge whether using corresponding key be to retain key, if when non-reserved key, then entering step 404。
Since terminal is before manufacture, in order to meet the demands such as manufacture key prepackage, therefore it is notified that key management in advance Device is by the way of retaining key statement.So-called reservation key statement refers to being indexed by the certain physics of relevant file state Occupied by the appointed application of key, key management unit cannot go out declared encryption key distribution when distributing physics index. In general, retaining key cannot be written into, but it can directly use the reservation key.Therefore, it is necessary to judge using correspondence Key whether be retain key, if retain key, then be used directly the reservation key;If this is using corresponding key When non-reserved key, then 404 are entered step.
Step 404, the physics that application corresponding key write-in is found is indexed into corresponding system safety zone.
When it is non-reserved key to judge the corresponding key of application, since physics index search to storage key can be passed through Space, i.e. system safety zone.Therefore it will receive and pacified by the system that physics index search arrives using the write-in of corresponding key In the whole district, wherein the system safety zone refers to the space of the safety storage key of POS system.
Fig. 5 shows the flow chart for the method that key is written in one embodiment, and this method is to be applied to carry out in terminal It illustrates.Including:
Step 502, it receives key inquiry request and applies corresponding key, wherein key inquiry request carries application Mark and corresponding logic index.
Specifically, since terminal can be by relevant applications trigger key inquiry request, in triggering key inquiry request This is sent to cipher input equipment using corresponding key simultaneously.In general, in terminal using be logic index, institute The index that logic index is virtual is called, the logic index that different application uses can repeat.The logic rope used such as Apply Names A It is cited as 1, Apply Names are the logic index or 1 that B is used.Further, since key inquiry request can pass through difference Applications trigger, therefore carried in key inquiry request for identify triggering key inquiry request application application identities, with And should using logic index.
Step 504, key resource lock is obtained according to key inquiry request, so that key resource lock locks key resource.
Since the key entry device in terminal is after receiving key inquiry request, due to that need to avoid being written in key The problem of being interrupted by other application in journey.It then needs to be gone to obtain key resource lock according to key inquiry request, be passed through using lock mechanism Key resource lock is by key resource lock.Wherein, key resource lock is for ensureing in key ablation process not by other application It interrupts, key resource is the key by a series of application as resource.Specifically, before the key ablation process of application, It need to prevent other application from interrupting the key ablation process by key resource lock by key resource lock.
Step 506, default corresponding table is obtained, corresponding table includes that the corresponding logic index of application identities is reflected with what physics indexed Penetrate relationship, wherein when application identities difference, the identical corresponding different physics index of logic index.
Due to having corresponding table in advance in the key management unit in terminal, which reflects that application identities are corresponding and answers With title, using logic index and physics index between mapping relations.Since logic index is virtual index, Therefore different application, which can use, repeats same logic and indexes, but even if the logic index that uses of different application is identical, But corresponding physics index difference.That is, when application identities difference, the identical corresponding different physics of logic index Index.As shown in fig. 6, the logic index used using 1 is 1,2 and 3, the logic index used using 2 is 1,2 and 3, application The 3 logics indexes used are 1,2 and 3, and correspond to that physics in table indexes marked as 1-100, then apply the 1 logic index used Be 1 for 1 corresponding physics index, the logic index that is used using 1 be 2 corresponding physics indexes be 2, the logic that is used using 1 The logic index that it is 3 that index indexes for 3 corresponding physics, is used using 2 is that 1 corresponding physics index is 5, is used using 2 The logic index that it is 8 that logic index indexes for 2 corresponding physics, is used using 2 is that 3 corresponding physics indexes are 9, make using 3 The logic index that logic index for 1 corresponding physics index is 6, is used using 3 be 2 corresponding physics indexes be 7 and The logic index used using 3 is 99 etc. for 3 corresponding physics indexes.
Step 508, judge index corresponding object according to whether key inquiry request finds logic from default corresponding table Reason index, if so, entering step 510;Conversely, then entering step 516.
After obtaining the correspondence table that keeps in advance in key management unit, since terminal passes through relevant applications trigger key Inquiry request, wherein the key inquiry request carry this using logic index.Therefore, need to judge to be looked into according to key Ask request call search interface whether searched from default corresponding table this using logic index corresponding physics and index, if It is then to enter step 510;Conversely, then entering step 516.If as shown in fig. 6, by application 1 triggering key inquiry request, by The logic index used in application 1 is 1,2 and 3, if therefore calling lookup interface from default correspondence according to key inquiry request Found in table when logic index for 1 corresponding physics index is 1 or logic index be 2 corresponding physics indexes be 2 or Logic index is 3 for 3 corresponding physics indexes.As long as that is, individually being found pair in the logic index used using 1 When the physics index answered, it all can be considered and search successfully, then enter step 510;Conversely, then entering step 516.
Step 510, judge whether using corresponding key be to retain key, if so, entering step 512;Conversely, then into Enter step 514;
Since terminal is before manufacture, in order to meet the demands such as manufacture key prepackage, key management unit need to be notified using guarantor The mode for staying key to state.Wherein, it refers to the key quilt by the certain physics indexes of relevant file state to retain key statement Occupied by specified application, key management unit cannot separate declared key when distributing physics index.Due to protecting It is that cannot be written into stay key, it is therefore desirable to judge whether using corresponding key be to retain key.As shown in fig. 6, key pipe It manages occupied by the appointed application of key of the device by physics index for 4 and 100 before terminal manufacture, therefore, in distribution physics rope When drawing, physics cannot be indexed and separated for 4 and 100 key.
Step 512, directly using reservation key.
Since key management unit is had been assigned with by the key of relevant file state certain physics index before manufacture Using occupied, and retain key and cannot be written into.Therefore, if judging the key of the application of triggering key inquiry request It is when retaining key, then the key of the application is cannot to be written in the safety of POS system, can directly use the key.
Step 514, the physics that application corresponding key write-in is found is indexed into corresponding system safety zone, release Key resource lock.
When it is non-reserved key to judge the application of triggering key inquiry request, then can safely be deposited by physics index search Store up the system safety zone of key.The key of the application is written to the system safety zone found and carries out secure storage key.By In, during key is written, using lock mechanism, therefore after successfully key is written in system safety zone, need Key resource lock is discharged, in order to which another follow-up application being capable of successful access key resource.
Step 516, judge whether vacant physics index is searched from default corresponding table according to key inquiry request, if It is then to enter step 518;Conversely, then entering step 520.
Specifically, when cipher input equipment calls correspondence table of the query interface from key management unit according to key inquiry request When corresponding with the logic index that key inquiry request the carries physics of middle inquiry is indexed unsuccessfully, illustrate triggering key inquiry request Apply does not have corresponding physics to index in the correspondence table kept in advance.I.e., it has no a space pre-set To store the key of the application.Then need in the correspondence table in key management unit establish with should using logic index pair The physics index answered, therefore vacant physics need to be found and index and could realize.Further, judge according in key inquiry request What whether the logic index of carrying was searched in preset corresponding table indexes to vacant physics, if so, 518 are entered step,; Conversely, then entering step 520.
Step 518, application identities and corresponding logic index are established into correspondence with the physics index found, more New default corresponding table.
When successfully finding vacant physics index, then the correspondence table that key management unit is kept in advance is updated. Specifically, in correspondence table in key management unit by vacant physics index and triggering key inquiry request using Logic index establishes mapping relations.For example, it is 1,2 and 3 to be indexed using 2 logic in corresponding table, logic index is 1,2 and 3 It is all indexed without corresponding physics, therefore one of logic can be indexed and be with the hollow remaining physics index of corresponding table for 1 88 establish mapping relations, and corresponding table is updated.Correspondence table in key management unit after final updating can reflect Mapping relations between the logic index used in the application 2 of the triggering key inquiry request and physics index.
Step 520, check whether the application for holding key is unloaded, if so, entering step 522;Conversely, then directly reporting It is wrong.
When searching vacant physics index failure, then the application to having held key in terminal is needed to check.Specifically , it checks whether the application for holding key is unloaded, if check that the application for holding key is unloaded, enters step 522;Instead If it directly reports an error check that the application for holding key is not unloaded.
Step 522, then application identities counterlogic is deleted from default corresponding table indexes corresponding physics index.
Specifically, when key management unit checks that the application for holding key is unloaded, then need to be deleted from corresponding table should Mapping relations between being indexed with corresponding physics using logic index.That is, hold in recycling unloading application After key, there will be vacant physics index in corresponding table, then return to step 516 looks into updated preset table again Vacant physics is looked for index.If key management unit checks that the application 3 for holding key has been unloaded, in the correspondence kept in advance Using the logic index in 3 for 1 corresponding physics index be 2 in table, logic index is that 2 corresponding physics indexes are 3, then will answer The logic index used with 3 indexes the mapping relations between being 2 and is deleted for 1 and physics, or logic index is corresponded to for 2 Physics index deleted for the mapping relations between 3, it is specific delete then need is according to the specifically used logics index of application 3 1 or 2.
In the present embodiment, by distributing different applications to independent key space, only permit using corresponding key space Perhaps key individually accesses.Therefore, the problem of common storage space between each application covers so as to cause key is not only avoided, And it can be by using the mechanism of recycling to reduce the waste of key resource the application unloaded.
Fig. 7 shows the flow chart for the method that key uses in one embodiment, and this method is to be applied to carry out in terminal For example, including:
Step 702, it receives key and uses request, wherein key carries application identities using request and corresponding patrols Collect index.
Here application is generally referred to as the application in terminal, is encrypted due to can each be applied by key pair, Then need to get this in the space of storage key using corresponding key.Therefore, made by relevant applications trigger key With request.Due to using be logic index, and logic index is virtual index, it is different using logic Index is recursive.Wherein, index refers to that individual, physics the value to one or more columns per page in database table is arranged A kind of storage organization of sequence can quickly search the space of required key storage by index.Specifically, terminal can pass through phase The applications trigger key use request of pass, and key is sent to Password Input and is set using request and the corresponding key of application It is standby.It is asked due to that can be used by different applications trigger keys, the key is tactile for identifying using being carried in request Send out key using request application application identities and should using logic index.
Step 704, according to key is received using acquisition request key resource lock, so that key resource lock locking key provides Source.
After cipher input equipment in terminal receives key using request, acquisition key is gone to provide using request according to key It locks in source.So-called key resource lock is during ensureing key use, not interrupted by other application.Therefore, it need to be provided by key Lock a series of key resource lock for forming keys in source.In general, after by key resource lock, in addition to triggering key use is asked Except the related application asked, other application can not all access key resource.
Step 706, it logic from default corresponding table is searched using request according to key indexes corresponding physics and index, when answering When with identifying different, the identical corresponding different physics index of logic index.
Specifically, the cipher input equipment in terminal by key resource lock by after key resource lock, since key makes With carried in request using logic index, then can index pair that be kept in advance from key management unit according to the logic It answers and searches corresponding physics index in table.Wherein, have in corresponding table the application of application identities title, using logic Mapping relations between index and corresponding physics index.Generally, due to using logic index may be reused, But it is different and is different physics index using due to application identities difference, then identical logic index is corresponding.That is, The key of different application is in different key storage spaces.
Step 708, when searching successfully, corresponding key is indexed to physics and is used, key resource lock is discharged.
After the logic carried in finding key using request indexes corresponding physics index, since physics index is to deposit The index of key space is stored up, therefore can be indexed by physics and quickly find storage key space.Due to the key of each application There is individual memory space, therefore the key in the storage key space to finding uses, and can pass through the key pair Using the operations such as being encrypted.Since multiple apply is clashed in using cipher key processes in order to prevent, key money is used Source lock locking key resource mechanism, therefore be successfully found storage key space when, and to the key in the key space into It exercises after using, key resource lock need to be discharged.
In the present embodiment, terminal by receive key using request, the key using request carry application identities and Corresponding logic index uses acquisition request key resource lock, in order to lock key resource according to key is received.Terminal root Logic is searched from default corresponding table using request according to the key received and index corresponding physics index, wherein when application is marked When knowing different, the identical corresponding different physics index of logic index.It, then can be right when successfully finding corresponding physics index Physics indexes corresponding key and is used, and finally discharges key resource lock.Due to the logic index used in each application Corresponding different physics index, i.e., each application have the space of independent storage key, therefore, in multiple applications while using When, only allow using corresponding key corresponding using the conflict of cipher key index will not be caused.
As shown in figure 8, providing a kind of device 800 of key write-in, which includes:
Key inquiry request receiving module 802, for receiving key inquiry request and applying corresponding key, wherein close Key inquiry request carries application identities and corresponding logic index.
First key resource lock acquisition module 804, for obtaining key resource lock according to key inquiry request, so that key Resource lock locks key resource.
First physics index search module 806, for searching logic rope from default corresponding table according to key inquiry request Draw corresponding physics index, when application identities difference, the identical corresponding different physics index of logic index.
Writing module 808, for when searching successfully, the physics that application corresponding key write-in is found being indexed and is corresponded to System safety zone, discharge key resource lock.
In one embodiment, the device 800 of key write-in further includes searching module (not shown) and correspondence Module (not shown) is established, wherein:
Searching module, for when searching failure, vacant object to be searched from default corresponding table according to key inquiry request Reason index.
Corresponding relation building module, for building application identities and corresponding logic index with the physics index found Vertical correspondence updates default corresponding table.
In one embodiment, the device 800 of key write-in further includes checking module (not shown) and removing module (not shown), wherein:
Module is checked, for when not finding vacant physics index in default corresponding table, then checking and holding key Application whether be unloaded.
If removing module is deleted from default corresponding table and is patrolled using correspondence be unloaded for holding the application of key Collect the corresponding physics index of index.
In one embodiment, the first physics index search module 806 is additionally operable to obtain default corresponding table, and corresponding table includes The mapping relations of application identities corresponding logic index and physics index, wherein when application identities difference, identical logic rope Draw corresponding different physics index;Logic index pair corresponding with application identities is searched from corresponding table according to key inquiry request The physics index answered.
In one embodiment, writing module 808 is additionally operable to judge whether using corresponding key be to retain key;When answering When with corresponding key being non-reserved key, then physics that application corresponding key write-in is found is indexed into corresponding system peace The whole district.
As shown in figure 9, providing a kind of device that key uses 900, which includes:
Key uses request receiving module 902, uses request for receiving key, wherein key is carried using request Application identities and corresponding logic index.
Second key resource lock acquisition module 904, for using acquisition request key resource lock according to reception key, so that Key resource lock locks key resource.
Second physics index search module 906, for searching logic rope from default corresponding table using request according to key Draw corresponding physics index, when application identities difference, the identical corresponding different physics index of logic index.
Key uses module 908, for when searching successfully, indexing corresponding key to physics and using, release is close Key resource lock.
Figure 10 is the internal structure schematic diagram of one embodiment Computer equipment.The computer equipment can be terminal. As described in Figure 10, which includes processor, memory, network interface, display screen and the input unit connected by bus.Its In, which supports the operation of entire terminal for providing calculating and control ability.Memory includes that non-volatile memories are situated between Matter and built-in storage, the non-volatile memory medium of the terminal are stored with operating system and a kind of device for realizing key write-in When the computer program of computer program, the device of key write-in is executed by processor, for realizing a kind of write-in of key Method.Built-in storage in the terminal provides environment for the operation of the device of the key write-in in non-volatile memory medium, The network interface of the terminal by network for being communicated, for example, receiving key inquiry request and applying corresponding key.It should Input unit can be the touch layer covered on display screen, can also be external keyboard, Trackpad or mouse etc., the display screen For showing application interface etc., which can be liquid crystal display or electric ink display screen, touch layer and display screen structure At touch screen.It will be understood by those skilled in the art that structure shown in Figure 10, only with the relevant part of application scheme The block diagram of structure, does not constitute the restriction for the terminal being applied thereon to application scheme, and specific terminal may include ratio More or fewer components as shown in the figure either combine certain components or are arranged with different components.
In one embodiment, a kind of computer readable storage medium is additionally provided, computer program is stored thereon with, it should Following steps are realized when program is executed by processor:It receives key inquiry request and applies corresponding key, wherein key is inquired Request carries application identities and corresponding logic index;Key resource lock is obtained according to key inquiry request, so that key Resource lock locks key resource;Logic is searched from default corresponding table index corresponding physics index according to key inquiry request, When application identities difference, the identical corresponding different physics index of logic index;When searching successfully, will apply corresponding close The physics that key write-in is found indexes corresponding system safety zone, discharges key resource lock.
In one embodiment, logic is searched from default corresponding table according to key inquiry request and indexes corresponding physics rope After drawing, further include:When searching failure, vacant physics index is searched from default corresponding table according to key inquiry request; Application identities and corresponding logic index are established into correspondence with the physics index found, update default corresponding table.
In one embodiment, it when searching failure, is searched from default corresponding table according to key inquiry request vacant After physics index, further include:When not finding vacant physics index in default corresponding table, then checks and hold key Using whether being unloaded;If the application for holding key is unloaded, deletes from default corresponding table and indexed using counterlogic Corresponding physics index.
In one embodiment, logic is searched from default corresponding table according to key inquiry request and indexes corresponding physics rope Draw, when application identities difference, the identical corresponding different physics index of logic index, including:Default corresponding table is obtained, it is corresponding Table includes the mapping relations of application identities corresponding logic index and physics index, wherein identical when application identities difference The corresponding different physics index of logic index;According to key inquiry request logic corresponding with application identities is searched from corresponding table Index corresponding physics index.
In one embodiment, the physics that application corresponding key write-in is found is indexed into corresponding system safety zone, Including:Judge whether using corresponding key be to retain key;When the corresponding key of application is non-reserved key, then will apply The physics that corresponding key write-in is found indexes corresponding system safety zone.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, it is non-volatile computer-readable that the program can be stored in one It takes in storage medium, in the embodiment of the present invention, which can be stored in the non-volatile memory medium of computer system, and It is executed by least one of computer system processor, includes the flow such as the embodiment of above-mentioned each method with realization.Its In, the storage medium can be magnetic disc, CD, read-only memory (Read-Only Memory, ROM) or random storage Memory body (Random Access Memory, RAM) etc..
Each technical characteristic of embodiment described above can be combined arbitrarily, to keep description succinct, not to above-mentioned reality It applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not deposited In contradiction, it is all considered to be the range of this specification record.
Several embodiments of the invention above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously Cannot the limitation to the scope of the claims of the present invention therefore be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to the guarantor of the present invention Protect range.Therefore, the protection domain of patent of the present invention should be determined by the appended claims.

Claims (10)

1. a kind of method of key write-in, which is characterized in that the method includes:
Receive key inquiry request and apply corresponding key, wherein the key inquiry request carry application identities and Corresponding logic index;
Key resource lock is obtained according to the key inquiry request, so that the key resource lock locks key resource;
The logic is searched from default corresponding table according to the key inquiry request and index corresponding physics index, when application is marked When knowing different, the identical corresponding different physics index of logic index;
When searching successfully, the physics found using the write-in of corresponding key is indexed into corresponding system safety Area discharges the key resource lock.
2. according to the method described in claim 1, it is characterized in that, it is described according to the key inquiry request from default corresponding table After the middle lookup logic indexes corresponding physics index, further include:
When searching failure, vacant physics index is searched from default corresponding table according to the key inquiry request;
Application identities and corresponding logic index are established into correspondence with the physics index found, update default correspond to Table.
3. according to the method described in claim 2, it is characterized in that, the method further includes:
When not finding vacant physics index in the default corresponding table, then check whether the application for holding key is unloaded It carries;
If the application for holding key is unloaded, the application counterlogic is deleted from default corresponding table and indexes corresponding object Reason index.
4. according to the method described in claim 1, it is characterized in that, it is described according to the key inquiry request from default corresponding table It is middle to search the corresponding physics index of the logic index, when application identities difference, the identical corresponding different object of logic index Reason index, including:
Default corresponding table is obtained, the corresponding table includes the mapping relations of application identities corresponding logic index and physics index, Wherein, when application identities difference, the identical corresponding different physics index of logic index;
Logic corresponding with application identities is searched from the corresponding table index corresponding physics according to the key inquiry request Index.
5. according to the method described in claim 1, it is characterized in that, described find described using the write-in of corresponding key The physics indexes corresponding system safety zone, including:
Judge whether the corresponding key of the application is to retain key;
When the corresponding key of the application is non-reserved key, be then written described using corresponding key described in finding Physics indexes corresponding system safety zone.
6. a kind of method that key uses, which is characterized in that the method includes:
It receives key and uses request, wherein the key carries application identities using request and corresponding logic indexes;
Acquisition request key resource lock is used according to key is received, so that the key resource lock locks key resource;
The logic is searched from default corresponding table using request according to the key and indexes corresponding physics index, when application is marked When knowing different, the identical corresponding different physics index of logic index;
When searching successfully, corresponding key is indexed to the physics and is used, key resource lock is discharged.
7. a kind of device of key write-in, which is characterized in that described device includes:
Key inquiry request receiving module, for receiving key inquiry request and applying corresponding key, wherein the key is looked into It askes request and carries application identities and corresponding logic index;
First key resource lock acquisition module, for obtaining key resource lock according to the key inquiry request, so that described close Key resource lock locks key resource;
First physics index search module, for searching the logic rope from default corresponding table according to the key inquiry request Draw corresponding physics index, when application identities difference, the identical corresponding different physics index of logic index;
Writing module is used for when searching successfully, by the physics index pair found using the write-in of corresponding key The system safety zone answered discharges the key resource lock.
8. a kind of device that key uses, which is characterized in that described device includes:
Key uses request receiving module, uses request for receiving key, wherein the key carries application using request Mark and corresponding logic index;
Second key resource lock acquisition module, for using acquisition request key resource lock according to reception key, so that described close Key resource lock locks key resource;
Second physics index search module, for searching the logic rope from default corresponding table using request according to the key Draw corresponding physics index, when application identities difference, the identical corresponding different physics index of logic index;
Key uses module, for when searching successfully, indexing corresponding key to the physics and using, release key money It locks in source.
9. a kind of computer equipment, including memory, processor and storage are on a memory and the meter that can run on a processor Calculation machine program, which is characterized in that the processor realizes claim 1-6 any one the methods when executing described program Step.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that described program is handled The step of claim 1-6 any one the methods are realized when device executes.
CN201711320451.3A 2017-12-12 2017-12-12 Method for writing key and method for using key Active CN108628925B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711320451.3A CN108628925B (en) 2017-12-12 2017-12-12 Method for writing key and method for using key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711320451.3A CN108628925B (en) 2017-12-12 2017-12-12 Method for writing key and method for using key

Publications (2)

Publication Number Publication Date
CN108628925A true CN108628925A (en) 2018-10-09
CN108628925B CN108628925B (en) 2021-05-28

Family

ID=63705911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711320451.3A Active CN108628925B (en) 2017-12-12 2017-12-12 Method for writing key and method for using key

Country Status (1)

Country Link
CN (1) CN108628925B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988140A (en) * 2020-08-20 2020-11-24 四川爱联科技股份有限公司 Key management method, system and terminal for Internet of things module

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1311927A2 (en) * 2000-07-11 2003-05-21 Brian Yen System and method for on-demand data distribution in a p2p system
CN102314576A (en) * 2010-07-08 2012-01-11 英赛瑟库尔公司 In NFC equipment, carry out the method for Secure Application
CN103281194A (en) * 2013-06-15 2013-09-04 杨涛 Safe and lightweight class RFID ownership transferring method based on bilinear pairings
CN103490878A (en) * 2013-10-15 2014-01-01 上海杉德金卡信息系统科技有限公司 Methods for dynamic secret key storing and stored secret key reading and deleting

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1311927A2 (en) * 2000-07-11 2003-05-21 Brian Yen System and method for on-demand data distribution in a p2p system
CN102314576A (en) * 2010-07-08 2012-01-11 英赛瑟库尔公司 In NFC equipment, carry out the method for Secure Application
CN103281194A (en) * 2013-06-15 2013-09-04 杨涛 Safe and lightweight class RFID ownership transferring method based on bilinear pairings
CN103490878A (en) * 2013-10-15 2014-01-01 上海杉德金卡信息系统科技有限公司 Methods for dynamic secret key storing and stored secret key reading and deleting

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988140A (en) * 2020-08-20 2020-11-24 四川爱联科技股份有限公司 Key management method, system and terminal for Internet of things module

Also Published As

Publication number Publication date
CN108628925B (en) 2021-05-28

Similar Documents

Publication Publication Date Title
US8095557B2 (en) Type system for access control lists
US9591030B1 (en) Lock-free updates to a domain name blacklist
CN108897628A (en) A kind of implementation method of distributed lock, device and electronic equipment
CN108614976A (en) Authority configuring method, device and storage medium
CN107402821A (en) Access control method, device and the equipment of shared resource
US9264399B1 (en) Lock-free updates to a domain name blacklist
CN108416199A (en) A kind of user authority control method of application, device and server
CN109086597A (en) Cipher key access method, key management method, storage medium and computer equipment
CN108628925A (en) The method that the method for key write-in, key use
US20080295145A1 (en) Identifying non-orthogonal roles in a role based access control system
CN109241727B (en) Permission setting method and device
CN115687359A (en) Data table partitioning method and device, storage medium and computer equipment
CN105426221B (en) The method and system of caching is realized by JVM safe contexts
US20130268503A1 (en) Database navigation of changes at commit time
CN114090969A (en) Multilevel multi-tenant cross authorization management method
CN115905206A (en) Multi-tenant data isolation method, device, equipment and storage medium
CN109299613B (en) Database partition authority setting method and terminal equipment
CN114647663A (en) Resource processing method, device and system, electronic equipment and storage medium
CN105511813A (en) Method, device and system for accessing server disk
CN109583907A (en) A kind of checking method of electronic invoice, device, medium and electronic equipment
US6874059B1 (en) System and method for using anonymous tokens for efficient memory management
CN105518663A (en) Automatic blocking of bad actors
CN115098227B (en) Method and device for updating dynamic information of security equipment
CN113836051B (en) Metadata space recovery method, device, equipment and storage medium
CN111131205B (en) Authority management method and device based on Restful interface

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