CN115657976A - Card writing method and device, electronic equipment and storage medium - Google Patents

Card writing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115657976A
CN115657976A CN202211379227.2A CN202211379227A CN115657976A CN 115657976 A CN115657976 A CN 115657976A CN 202211379227 A CN202211379227 A CN 202211379227A CN 115657976 A CN115657976 A CN 115657976A
Authority
CN
China
Prior art keywords
data
writing
bit
card
verification
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
Application number
CN202211379227.2A
Other languages
Chinese (zh)
Inventor
袁绪姣
张文杰
梁宏亮
贾冲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202211379227.2A priority Critical patent/CN115657976A/en
Publication of CN115657976A publication Critical patent/CN115657976A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The embodiment of the application provides a card writing method and device, electronic equipment and a storage medium. The card writing method comprises the following steps: acquiring first data to be written into the smart card; writing the first data into a preset check bit in the smart card; verifying second data in the preset check bits, wherein the second data refers to first data written in the preset check bits; and after the verification is successful, writing the second data into the target data bit in the intelligent card. In the embodiment of the application, the preset check bit is added, the first data is written into the preset check bit, and the check is performed after the first data is written into the preset check bit, so that whether the written data is accurate or not is determined, whether formal card writing operation needs to be performed or not is determined according to the check result, and the data in the preset check bit is written back to the target data bit in the smart card after the check is successful.

Description

Card writing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a card writing method and apparatus, an electronic device, and a storage medium.
Background
Smart cards are the generic term for plastic cards with a microchip embedded therein. The data in the smart card is composed of an external reading part and an internal processing part, the size of the smart card is generally similar to that of a credit card, the smart card is a card based on a computer and a communication technology, and the smart card is generally used for the aspects of access control, shopping, entertainment, internet of things and the like in daily life.
At present, a lot of system applications related to related business operations in the smart card read-write operation process exist, in particular to operations such as smart card information reading, smart card information checking, and smart card information writing.
In the prior art, when a card writing operation is performed, data to be written is usually written directly into corresponding data bits in a smart card. However, there are many uncontrollable factors in the actual operation of the user, such as card looseness, poor chip identification, card pulling, etc., and these uncontrollable factors may cause data to be written in abnormally, thereby resulting in inaccurate card writing data.
Disclosure of Invention
In view of the foregoing problems, embodiments of the present application provide a card writing method, a card writing device, an electronic device, and a storage medium, so as to solve the problem that card writing data is inaccurate in the existing card writing method.
According to an aspect of an embodiment of the present application, there is provided a card writing method, including:
acquiring first data to be written into the smart card;
writing the first data into a preset check bit in the smart card;
verifying second data in the preset check bits, wherein the second data refers to first data written in the preset check bits;
and after the verification is successful, writing the second data into the target data bit in the intelligent card.
Optionally, the verifying the second data in the preset check bits includes: reading the second data from the preset check bits; comparing the second data with the first data; and in the case of consistent comparison, determining that the verification is successful.
Optionally, after the checking the second data in the preset check bits, the method further includes: after the verification is successful, marking the verification state of the preset verification bit as successful verification; and after the verification fails, marking the verification state of the preset verification bit as verification failure, and erasing the second data.
Optionally, after writing the second data into the target data bit in the smart card, the method further includes: monitoring whether the second data is successfully written or not; after the writing is successful, marking the writing state of the target data bit as successful writing; and after the writing fails, marking the writing state of the target data bit as the writing failure, and erasing third data in the target data bit, wherein the third data refers to second data written in the target data bit.
Optionally, after writing the second data into the target data bit in the smart card, the method further includes: acquiring the check state of the preset check bit and the write-in state of the target data bit; and determining to execute the next business operation under the condition that the verification state of the preset verification bit is verification success and the writing state of the target data bit is writing success.
Optionally, the method further comprises: and in the process of writing the first data into a preset check bit in the intelligent card, if the intelligent card is monitored to be abnormal, the first data is stopped being written into the preset check bit.
Optionally, the first data includes business data and a current date.
According to another aspect of embodiments of the present application, there is provided a card writing apparatus including:
the data acquisition module is used for acquiring first data to be written into the smart card;
the first writing module is used for writing the first data into a preset check bit in the smart card;
the checking module is used for checking second data in the preset check bits, wherein the second data refers to the first data written in the preset check bits;
and the second writing module is used for writing the second data into the target data bit in the intelligent card after the verification is successful.
Optionally, the verification module includes: a reading unit for reading the second data from the preset check bits; a comparison unit, configured to compare the second data with the first data; and the determining unit is used for determining that the verification is successful under the condition of consistency in comparison.
Optionally, the apparatus further comprises: the first marking module is used for marking the checking state of the preset checking bit as successful checking after the checking module successfully checks; and the second marking module is used for marking the checking state of the preset checking bit as the checking failure and erasing the second data after the checking of the checking module fails.
Optionally, the apparatus further comprises: the monitoring module is used for monitoring whether the second data is successfully written or not; the third marking module is used for marking the writing state of the target data bit as successful writing after the second writing module succeeds in writing; and the fourth marking module is used for marking the writing state of the target data bit as writing failure and erasing third data in the target data bit after the writing failure of the second writing module, wherein the third data refers to second data written in the target data bit.
Optionally, the apparatus further comprises: a state obtaining module, configured to obtain a check state of the preset check bit and a write state of the target data bit; and the operation determining module is used for determining to execute the next business operation under the condition that the verification state of the preset verification bit is verification success and the writing state of the target data bit is writing success.
Optionally, the apparatus further comprises: and the control module is used for stopping writing the first data into the preset check bit if the smart card is monitored to be abnormal in the process that the first writing module writes the first data into the preset check bit in the smart card.
Optionally, the first data includes business data and a current date.
According to another aspect of embodiments herein, there is provided an electronic device including: one or more processors; and one or more computer-readable storage media having instructions stored thereon; the instructions, when executed by the one or more processors, cause the processors to perform a card writing method as any one of above.
According to another aspect of embodiments herein, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, causes the processor to execute the card writing method as described in any one of the above.
In the embodiment of the application, in the card writing process, first data to be written into an intelligent card are obtained; writing the first data into a preset check bit in the smart card; verifying second data in the preset check bits, wherein the second data refers to the first data written in the preset check bits; and after the verification is successful, writing the second data into a target data bit in the smart card. Therefore, in the embodiment of the application, the first data to be written into the smart card is not directly written into the target data bit in the smart card, but the preset check bit is added, the first data is firstly written into the preset check bit, the first data is checked after the first data is written into the preset check bit so as to determine whether the written data is accurate or not, further, whether formal card writing operation is needed or not is judged according to the check result, and the data in the preset check bit is written back into the target data bit in the smart card after the check is successful, so that unexpected data loss and damage can be effectively prevented, the error rate of card writing is reduced, the accuracy of autonomous judgment of a system is improved, and the repeated operation of manual check is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are only some drawings of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart illustrating steps of a card writing method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a card writing process according to an embodiment of the present application.
FIG. 3 is a schematic diagram of another card writing process according to an embodiment of the application.
Fig. 4 is a block diagram of a card writing device according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application can be used for various system applications related to the related business operation in the read-write operation process of the intelligent card, in particular to the operations of information read-write of the intelligent card, information check write-back of the intelligent card and the like. In practical application, the card writing method of the embodiment of the application can be particularly applied to scenes of using card reading equipment to pay fees for smart cards and the like. Smart cards may include, but are not limited to: water cards, electricity cards, gas cards, bus cards, and the like.
In the prior art, the card writing process for the smart card is generally to write 16-ary data directly into the specified data bits of the smart card. However, in the actual operation of the user, there are many uncontrollable factors, for example, there are various misoperation such as card loosening, poor chip identification, card pulling, etc., which cause the data to be incorrectly read and written, and finally, situations may occur that the actual service operation is terminated but the data is successfully written, or the data is not successfully written but the next service operation is actually performed. Under the conditions, due to the fact that the data is inconsistent, the subsequent related business data cannot be identified and used, business processing failure and economic loss are caused, the data is difficult to find at the later stage in the process, the system needs to manually check and erase the data and the like for recovery, and the card data is damaged.
In order to solve the above problems, embodiments of the present application provide a special card writing method in a series of card reading and writing processes, which accurately monitors whether card reading abnormality, card writing failure, card pulling action, and the like exist in the card writing process, and timely performs operations such as data checking, write back, erasing, and warning, thereby avoiding that, when a card is written, card writing data has deviation due to various reasons such as misoperation, which causes related service data to be unrecognizable and usable, affects subsequent service operations, improves the accuracy of system autonomous judgment to a greater extent, and reduces the burden of system manual checking and the risk of card data damage.
The card writing method according to the embodiment of the present application will be described in detail below.
Referring to fig. 1, a flowchart illustrating steps of a card writing method according to an embodiment of the present application is shown. The card writing method shown in fig. 1 can be applied to a card reading device or the like.
As shown in fig. 1, the card writing method may include the steps of:
step 101, first data to be written into the smart card is obtained.
In the embodiment of the application, the first data to be written into the smart card can be obtained according to the initial data in the smart card and the user input data.
In an alternative embodiment, first, initial data in the smart card (the initial data may refer to current data in the smart card that needs to be adjusted) may be read, user input data is obtained, and adjustment data for the initial data is determined according to the user input data; then, according to the initial data in the smart card and the determined adjustment data, first data to be written into the smart card can be obtained through calculation. As an example, the sum of the initial data and the determined adjustment data in the smart card may be used as the first data to be written to the smart card.
For example, in a situation of paying by an electric card, first, initial electric quantity data (initial data) in the electric card is read, payment amount (user input data) input by a user is acquired, and adjustment electric quantity data (adjustment data) for the initial electric quantity data is calculated according to the payment amount input by the user; and then, taking the sum of the initial electric quantity data in the electric card and the calculated adjustment electric quantity data as first data to be written into the intelligent card.
For another example, for a scene of bus card payment, first, reading initial amount data (initial data) in the bus card, acquiring a payment amount (user input data) input by a user, and using the payment amount input by the user as adjustment amount data (adjustment data) for the initial amount data; and then, taking the sum of the initial amount data in the bus card and the calculated adjustment amount data as first data to be written into the intelligent card.
It can be understood that, in an actual application, the first data to be written into the smart card may also be obtained in other manners, and the processing may be performed specifically according to an actual application scenario, and this embodiment is not discussed in detail herein.
For example, the first data to be written into the smart card may include, but is not limited to, business data and the like, for example, the above-mentioned electric quantity data and money amount data are all business data.
Illustratively, the first data to be written to the smart card may include, but is not limited to, business data, current date, and the like. By carrying the current date in the first data to be written into the smart card, the time of the occurrence of the abnormality can be known through the current date after the abnormality occurs in the card writing process, so that the abnormal situation can be known in more detail.
And 102, writing the first data into a preset check bit in the smart card.
In the embodiment of the application, a preset check bit is preset in the smart card, and the preset check bit is similar to a preset vacancy.
The smart card includes a data storage unit therein, which is where the smart card stores data, and the data storage unit may include a plurality of data bits (also referred to as address bits) for storing data. In the embodiment of the present application, one or more data bits that are arbitrarily applicable may be selected from the data storage unit as the preset check bit.
In the embodiment of the application, after the first data to be written into the smart card is obtained, the first data is not directly written into the target data bit in the smart card, but the first data is written into the preset check bit in the smart card.
It should be noted that, before writing the first data into the preset check bit in the smart card, if data already exists in the preset check bit (the data may be data written in the last card writing operation), the data in the preset check bit may be erased first, and then the first data is written into the preset check bit in the smart card.
In an alternative embodiment, based on the data security consideration, the first data to be written into the smart card may be encrypted, and then the encrypted first data is written into the preset check bit in the smart card. In implementation, any suitable encryption manner may be used to perform an encryption operation on the first data to be written into the smart card, for example, performing an exclusive or operation, a symmetric encryption, an asymmetric encryption, and the like on the first data to be written into the smart card, which is not limited in this embodiment of the present application.
Step 103, verifying second data in the preset check bits, where the second data refers to the first data written in the preset check bits.
In the embodiment of the present application, after the first data is written into the preset check bit in the smart card, the first data written into the preset check bit is used as the second data.
In order to ensure the accuracy of the second data written into the preset check bits in the smart card and prevent that the second data cannot be identified or is incomplete due to an abnormality of the smart card before the second data is written into the target data bits in the smart card, thereby causing a write failure when the second data is written into the target data bits, in this embodiment of the application, after the first data is written into the preset check bits in the smart card, the second data in the preset check bits may be checked to determine whether the second data in the preset check bits needs to be formally written into the target data bits in the smart card.
In an optional implementation manner, the checking the second data in the preset check bits may include: reading the second data from the preset check bits; comparing the second data with the first data; under the condition of consistent comparison, the verification is determined to be successful; and determining that the verification fails when the comparison is inconsistent.
In a possible scenario, if an error occurs in the written first data during the process of writing the first data to be written into the smart card into the preset check bit in the smart card, the second data read from the preset check bit may be inconsistent with the first data to be written into the smart card, and thus the verification will fail in this case.
In another possible scenario, the card reading device may monitor whether the smart card is abnormal in real time, in practical application, when the smart card is abnormal, a corresponding abnormal signal may be triggered, and after the card reading device monitors the abnormal signal, it may be determined that the smart card is abnormal. If the smart card is abnormal in the process of reading the second data from the preset check bit, the second data read from the preset check bit may be incomplete or cannot be identified, and the second data read from the preset check bit is inconsistent with the first data to be written into the smart card, so that the verification fails in such a case.
Exemplary situations where the smart card is abnormal may include, but are not limited to: smart card pull out, smart card loose, smart card chip identification error, etc.
And 104, writing the second data into a target data bit in the smart card after the verification is successful.
In the embodiment of the present application, after the second data in the preset check bits is successfully checked, it may be stated that no error occurs in the written first data in the process of writing the first data to be written into the smart card into the preset check bits in the smart card, and the smart card is not abnormal in the process of reading the second data from the preset check bits, so that it may be determined that data needs to be formally written back to the target data bits in the smart card, and therefore, the second data in the preset check bits may be written into the target data bits in the smart card.
After the second data in the preset check bits fails to be checked, it can be shown that an error occurs in the written first data in the process of writing the first data to be written into the smart card into the preset check bits in the smart card, or an abnormality occurs in the smart card in the process of reading the second data from the preset check bits, so that it can be determined that data does not need to be formally written back to the target data bits in the smart card, and therefore, the second data in the preset check bits is not written into the target data bits in the smart card.
Illustratively, the target data bit in the smart card may refer to the data bit in which the initial data in the smart card mentioned in step 101 above is located.
In practical applications, during the process of writing the second data in the preset check bits into the target data bits in the smart card, the second data may be used to replace the initial data in the target data bits. Therefore, the initial data in the target data bits may be erased, the second data may be read from the preset check bits, and the second data may be written into the target data bits in the smart card.
In the embodiment of the application, the first data to be written into the smart card is not directly written into the target data bit in the smart card, but the first data is written into the preset check bit by adding the preset check bit, the first data is checked after the first data is written into the smart card, so that whether the written data is accurate or not is determined, whether formal card writing operation needs to be performed or not is further determined according to the check result, and the data in the preset check bit is written back into the target data bit in the smart card after the check is successful, so that accidental data loss and damage can be effectively prevented, the error rate of card writing is reduced, the accuracy of autonomous determination of a system is improved, and the repeated operation of manual check is reduced.
Referring to fig. 2, a schematic diagram of a card writing process according to an embodiment of the present application is shown. The card writing process shown in fig. 2 can be applied to a card reading device or the like.
As shown in fig. 2, the card writing process may include the following steps:
step 201, reading the card.
In the embodiment of the application, the initial data (i.e. the current data to be adjusted) in the smart card is read first, and then the first data to be written into the smart card is obtained according to the read initial data and the user input data. For a specific process of acquiring the first data to be written into the smart card, reference may be made to the related description of step 101, and the embodiments of the present application are not discussed in detail herein.
And step 202, writing the card.
Specifically, the card writing step may include the following steps 2021 to 2023.
Step 2021, write the preset check bits in the smart card.
In the embodiment of the application, after the first data to be written into the smart card is obtained, the first data to be written into the smart card is written into the preset check bit in the smart card.
Taking the example that the first data to be written into the smart card includes the service data and the current date, the service data and the current date may be subjected to an exclusive or operation, and then the result obtained by the exclusive or operation is written into the preset check bit in the smart card. For a specific process of writing the first data to be written into the smart card into the preset check bits in the smart card, reference may be made to the related description of step 102, and the embodiments of the present application will not be discussed in detail herein.
Step 2022, verify the operation.
In the embodiment of the present application, in the checking operation process, second data in the preset check bit is specifically checked, where the second data refers to first data written in the preset check bit. For the specific process of the verifying operation, reference may be made to the related description of the above-mentioned step 103 section, and the embodiments of the present application are not discussed in detail here.
Step 2023, after the verification is successful, writing the target data bit in the smart card.
In the embodiment of the application, after the verification operation is successful, the second data in the preset verification bit is written into the target data bit in the smart card. For a specific process of writing the second data in the preset check bits into the target data bits in the smart card, reference may be made to the related description of step 104, and the embodiments of the present application will not be discussed in detail herein.
After the verification operation fails, the second data in the preset verification bit is not written into the target data bit in the smart card, and the system can autonomously process subsequent services according to the verification failure condition.
And step 203, completing card writing, and executing subsequent service operation according to the successful card writing condition.
After the card writing is completed, the system can continue to perform subsequent business operations, such as business operations of the link on the smart card.
And step 204, the card writing is not finished, and the subsequent business operation is autonomously processed according to the card writing failure condition.
When the card writing is not finished, the system cannot continue to execute subsequent business operation, and alarm information can be triggered so as to remind related personnel of abnormity in the card writing process.
Referring to fig. 3, a schematic diagram of another card writing process of an embodiment of the present application is shown. The card writing process shown in fig. 3 can be applied to a card reading device or the like.
As shown in fig. 3, the card writing process may include the following steps:
step 301, reading a card, and acquiring first data to be written into the smart card.
Step 302, writing the first data into a preset check bit in the smart card.
And step 303, monitoring whether the smart card is abnormal or not. If yes, go to step 304; if not, go to step 305.
In the embodiment of the application, in the process of writing the first data into the preset check bit in the smart card, whether the smart card is abnormal or not can be monitored in real time. The specific process may refer to the related description of step 103, and the embodiments of the present application are not discussed in detail herein.
And step 304, stopping writing the first data into the preset check bit in the smart card.
In the process of writing the first data into the preset check bit in the smart card, if the smart card is monitored to be abnormal, the first data cannot be successfully written into the preset check bit in the smart card, and therefore, in this case, the first data is stopped being written into the preset check bit. And alarm information can be triggered so as to remind related personnel of abnormality in the process of writing the first data into the preset check bit in the intelligent card.
Step 305, comparing whether the second data is consistent with the first data. If not, go to step 306; if yes, go to step 307.
The second data refers to the first data written in the preset check bits.
And verifying the second data in the preset check bits by comparing whether the second data is consistent with the first data or not. If the comparison result is consistent, the verification is successful; and if the comparison result is inconsistent, indicating that the verification fails.
And step 306, marking the checking state of the preset checking bit as checking failure, and erasing the second data in the preset checking bit.
After the verification fails, the verification state of the preset verification bit is marked as verification failure, and the second data verification failure in the preset verification bit can be recorded for reference of related personnel during subsequent business operation; by erasing the second data in the preset check bit, abnormal data can be cleared in time, and the accuracy of the data in the preset check bit is ensured. And alarm information can be triggered so as to remind relevant personnel that the second data in the preset check bits fail to be checked.
And when the user reads the card again, whether the user has abnormal operation can be known by reading the check state of the preset check bit, and the time of the abnormal operation can be known by reading the date written in the intelligent card.
Step 307, marking the check state of the preset check bit as successful check.
After the verification is successful, the verification state of the preset verification bit is marked as verification success, and the success of the verification of the second data in the preset verification bit can be recorded for reference of related personnel in subsequent business operation.
Step 308, writing the second data into the target data bit in the smart card.
Step 309, it is monitored whether the second data is successfully written. If not, go to step 310; if yes, go to step 311.
In the embodiment of the application, in the process of writing the second data into the target data bit in the smart card, whether the second data is successfully written can be monitored in real time.
Illustratively, during the process of writing the second data into the target data bit in the smart card, whether the smart card is abnormal or not can be monitored in real time. If the smart card is monitored to be abnormal, the second data cannot be successfully written into the target data bit in the smart card, namely, the second data writing fails. If the smart card is monitored to be not abnormal, the second data can be successfully written into the target data bit in the smart card, namely the second data is successfully written.
Step 310, the writing status of the target data bit is marked as writing failure, and the third data in the target data bit is erased.
The third data refers to the second data that has been written in the target data bits.
After the second data writing fails, the writing state of the target data bit is marked as writing failure, and the writing failure of the target data bit can be recorded for reference of related personnel during subsequent business operation; and abnormal data can be cleared in time through the third data in the target data bit, so that the accuracy of the data in the target data bit is ensured. And may trigger an alarm message to alert the associated personnel that the target data bit write failed.
In step 311, the write status of the target data bit is marked as write success.
After the second data is successfully written, the writing state of the target data bit is marked as writing success, and the writing success of the target data bit can be recorded for reference of related personnel in subsequent business operation.
Step 312, determining whether to execute the next service operation according to the check state of the preset check bit and the write state of the target data bit.
Before the system executes the next service operation, the system may obtain the check state of the preset check bit and the write-in state of the target data bit, and determine whether to execute the next service operation according to the check state of the preset check bit and the write-in state of the target data bit. The accuracy of the processing can be further improved by judging the double states.
And under the condition that the verification state of the preset verification bit is verification success and the writing state of the target data bit is writing success, determining to execute the next business operation.
When the check state of the preset check bit is a check failure and/or the write state of the target data bit is a write failure, it may be determined that the next service operation is not to be performed temporarily.
In the embodiment of the application, on the one hand, in the process of writing data into the preset check bit, whether the smart card is abnormal or not is monitored, and if the card is pulled out, loosened and other abnormal conditions occur, the writing of data into the preset check bit is stopped, so that the card can be formally written after data incomplete or accidental full writing can be prevented. On the other hand, after data is written into the preset check bit, the preset check bit is newly added for monitoring to judge whether formal card writing operation is needed, the preset check bit is similar to the preset vacancy, the data is written into the preset vacancy, whether the service data is consistent with the preset check bit data or not is judged, the check bit state of the preset check bit is set to be failed or successful, and then data erasing or formal card writing operation is carried out, so that error data is effectively prevented from being left on the smart card, and the situations of direct card loading link, accidental data loss and damage are prevented. On the other hand, after the formal card writing is finished, whether the data exist is judged according to the checking state of the preset checking bit and the writing state of the target data bit, and the action can correctly judge whether the uplink data and the downlink data are consistent, so that more accurate reference is provided for the next business operation.
The embodiment of the application is simple to realize, changes little to the prior art, can reduce the uplink and downlink errors of card writing data, not only improves the accuracy of autonomous judgment of the system, reduces the burdensome operation of artificial checking, maintenance personnel and a service system, but also reduces the error rate of service processing caused by the system, reduces the card data damage rate, and can effectively reduce the time and economic loss of artificial checking caused by the system. In addition, the alarm processing efficiency is improved, the alarm processing time is shortened, and the actual incidence relation between alarms can be reflected more truly and accurately, so that the accuracy of the determined root alarm is improved.
Referring to fig. 4, a block diagram of a card writing device according to an embodiment of the present application is shown.
As shown in fig. 4, the card writing device may include the following modules:
a data obtaining module 401, configured to obtain first data to be written into a smart card;
a first writing module 402, configured to write the first data into a preset check bit in the smart card;
a checking module 403, configured to check second data in the preset check bits, where the second data refers to first data that has been written into the preset check bits;
and a second writing module 404, configured to write the second data into the target data bit in the smart card after the verification is successful.
Optionally, the verification module 403 includes: a reading unit for reading the second data from the preset check bits; a comparison unit, configured to compare the second data with the first data; and the determining unit is used for determining that the verification is successful under the condition of consistency comparison.
Optionally, the apparatus further comprises: a first marking module, configured to mark the check state of the preset check bit as a check success after the check module 403 succeeds in checking; and a second marking module, configured to mark the check state of the preset check bit as a check failure and erase the second data after the check module 403 fails to check.
Optionally, the apparatus further comprises: the monitoring module is used for monitoring whether the second data is successfully written or not; a third marking module, configured to mark the write status of the target data bit as write success after the second writing module 404 succeeds in writing; a fourth marking module, configured to mark the write status of the target data bit as write failure and erase third data in the target data bit after the write failure of the second writing module 404, where the third data is second data that has been written in the target data bit.
Optionally, the apparatus further comprises: a state obtaining module, configured to obtain a check state of the preset check bit and a write state of the target data bit; and the operation determining module is used for determining to execute the next business operation under the condition that the verification state of the preset verification bit is verification success and the writing state of the target data bit is writing success.
Optionally, the apparatus further comprises: a control module, configured to, in a process that the first writing module 402 writes the first data into a preset check bit in the smart card, stop writing the first data into the preset check bit if it is monitored that the smart card is abnormal.
Optionally, the first data includes business data and a current date.
In the embodiment of the application, the first data to be written into the smart card is not directly written into the target data bit in the smart card, but the first data is written into the preset check bit by adding the preset check bit, the first data is checked after the first data is written into the smart card, so that whether the written data is accurate or not is determined, whether formal card writing operation needs to be performed or not is further determined according to the check result, and the data in the preset check bit is written back into the target data bit in the smart card after the check is successful, so that accidental data loss and damage can be effectively prevented, the error rate of card writing is reduced, the accuracy of autonomous determination of a system is improved, and the repeated operation of manual check is reduced.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
In an embodiment of the application, an electronic device is also provided. The electronic device may include one or more processors, and one or more computer-readable storage media having instructions, such as an application program, stored thereon. The instructions, when executed by the one or more processors, cause the processors to perform the card writing method of any of the embodiments described above.
Referring to fig. 5, a schematic diagram of an electronic device structure according to an embodiment of the present application is shown. As shown in fig. 5, the electronic device includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504. The processor 501, the communication interface 502, and the memory 503 are configured to communicate with each other via a communication bus 504.
The memory 503 stores a computer program.
The processor 501 is configured to implement the card writing method according to any of the embodiments described above when executing the program stored in the memory 503.
The communication interface 502 is used for communication between the above-described electronic apparatus and other apparatuses.
The communication bus 504 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The aforementioned processors 501 may include, but are not limited to: a Central Processing Unit (CPU), a Network Processor (NP), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc.
The aforementioned memory 503 may include, but is not limited to: read Only Memory (ROM), random Access Memory (RAM), compact Disc Read Only Memory (CD-ROM), electrically Erasable Programmable Read Only Memory (EEPROM), hard disk, floppy disk, flash Memory, and the like.
In an embodiment of the present application, there is also provided a computer-readable storage medium, on which a computer program is stored, the program being executable by a processor of an electronic device, and when the computer program is executed by the processor, causing the processor to perform the card writing method according to any of the above embodiments.
The embodiments in the present specification are related to each other, and all the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrases "comprising one of \ 8230; \8230;" does not exclude the presence of additional like elements in a process, method, article, or terminal device that comprises the element.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM, RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed in the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. In view of the above, the description should not be taken as limiting the application.

Claims (10)

1. A card writing method, the method comprising:
acquiring first data to be written into the smart card;
writing the first data into a preset check bit in the smart card;
verifying second data in the preset check bits, wherein the second data refers to first data written in the preset check bits;
and after the verification is successful, writing the second data into the target data bit in the intelligent card.
2. The method of claim 1, wherein the verifying the second data in the preset parity bits comprises:
reading the second data from the preset check bits;
comparing the second data with the first data;
and in the case of consistent comparison, determining that the verification is successful.
3. The method of claim 1, wherein after the verifying the second data in the preset parity bits, the method further comprises:
after the verification is successful, marking the verification state of the preset verification bit as successful verification;
and after the verification fails, marking the verification state of the preset verification bit as verification failure, and erasing the second data.
4. The method of claim 1, wherein after writing the second data to the target data bit in the smart card, the method further comprises:
monitoring whether the second data is successfully written or not;
after the writing is successful, marking the writing state of the target data bit as successful writing;
and after the writing fails, marking the writing state of the target data bit as the writing failure, and erasing third data in the target data bit, wherein the third data refers to second data written in the target data bit.
5. The method of claim 1, wherein after writing the second data to the target data bit in the smart card, the method further comprises:
acquiring the check state of the preset check bit and the write-in state of the target data bit;
and determining to execute the next business operation under the condition that the verification state of the preset verification bit is verification success and the writing state of the target data bit is writing success.
6. The method of claim 1, further comprising:
and in the process of writing the first data into a preset check bit in the intelligent card, if the intelligent card is monitored to be abnormal, the first data is stopped being written into the preset check bit.
7. The method of claim 1, wherein the first data comprises business data and a current date.
8. A card writing apparatus, characterized in that the apparatus comprises:
the data acquisition module is used for acquiring first data to be written into the smart card;
the first writing module is used for writing the first data into a preset check bit in the smart card;
the verification module is used for verifying second data in the preset verification bits, wherein the second data refers to first data written in the preset verification bits;
and the second writing module is used for writing the second data into the target data bit in the intelligent card after the verification is successful.
9. An electronic device, comprising:
one or more processors; and
one or more computer-readable storage media having instructions stored thereon;
the instructions, when executed by the one or more processors, cause the processors to perform the card writing method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, causes the processor to carry out a card writing method according to any one of claims 1 to 7.
CN202211379227.2A 2022-11-04 2022-11-04 Card writing method and device, electronic equipment and storage medium Pending CN115657976A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211379227.2A CN115657976A (en) 2022-11-04 2022-11-04 Card writing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211379227.2A CN115657976A (en) 2022-11-04 2022-11-04 Card writing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115657976A true CN115657976A (en) 2023-01-31

Family

ID=85017216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211379227.2A Pending CN115657976A (en) 2022-11-04 2022-11-04 Card writing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115657976A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117391099A (en) * 2023-12-12 2024-01-12 星汉智能科技股份有限公司 Data downloading and checking method and system for smart card and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117391099A (en) * 2023-12-12 2024-01-12 星汉智能科技股份有限公司 Data downloading and checking method and system for smart card and storage medium
CN117391099B (en) * 2023-12-12 2024-05-17 星汉智能科技股份有限公司 Data downloading and checking method and system for smart card and storage medium

Similar Documents

Publication Publication Date Title
US8595826B2 (en) Portable electronic device and control method thereof
CN108646982B (en) Automatic data restoration method and device based on UBIFS
TWI557663B (en) A method of reading a non-contact IC card data failure, and a device for implementing the method
CN115657976A (en) Card writing method and device, electronic equipment and storage medium
CN112181459B (en) CPLD upgrade optimization method and system
CN110457907A (en) A kind of firmware program detecting method and device
US8112662B2 (en) Portable electronic apparatus, processing apparatus for portable electronic apparatus, and data processing method in portable electronic apparatus
CN107729196B (en) Smart card power-off test method
CN114170023A (en) Method and device for testing fund transaction operation platform system
CN114020432A (en) Task exception handling method and device and task exception handling system
CN114445079A (en) Document processing method, device, equipment and storage medium
US6722572B2 (en) Recording medium control method, data management apparatus, and recording medium
US11114179B1 (en) Systems and methods for detecting counterfeit memory
CN111382028A (en) Method and device for processing date switching errors of batch processing system and server
JP5259507B2 (en) Portable electronic device and data processing method in portable electronic device
CN113947465A (en) Cross-border electricity quotient declaration result checking and early warning method and device
JP2013206311A (en) Failure determination device of automatic transaction device
CN110780113A (en) Automatic reading verification method and system for intelligent electric meter, storage medium and equipment
CN106875269B (en) Resource replacement method and device
CN117172924B (en) Gas transaction method, device, computer equipment, chip and storage medium
US20230038078A1 (en) Indicating failed card reading to identify defective transaction card and/or defective transaction terminal
Zhou et al. A verification method for power-off protection mechanism of embedded chip non-volatile memory
CN115858247A (en) Data backup method and device, computer readable storage medium and computer equipment
JP5233521B2 (en) IC chip, data reading method, data reading program, recording medium, etc.
CN116385022A (en) Financial comprehensive budget internal control supervision method and system

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