Payment two-dimensional code dynamic identification method and device, electronic equipment and storage medium
By extracting multimodal features and performing two-level fusion through the client-side recognition method, combined with weighted fusion of security clue features, the problems of high latency, poor availability and insufficient security of payment QR code recognition solutions in different wallets or channels are solved, and efficient and secure payment QR code recognition is achieved.
Patent Information
- Application Number
- CN202511334980.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-18
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-09-18
AI Technical Summary
Existing payment QR code recognition solutions have problems such as high latency, poor availability, and insufficient security when facing dynamic codes from different wallets or channels. In particular, the recognition capability is fragile when the network signal is weak or offline, and they fail to effectively utilize security consistency information such as signatures or timestamps for judgment.
The client-side recognition method is adopted to extract the multimodal features of the payment QR code, use the pre-configured feature identification library and pre-trained lightweight model to perform two-level fusion recognition, and combine the security clue features for weighted fusion to determine the target channel.
It improves the accuracy, robustness and security of payment QR code recognition, reduces latency, and enhances recognition capabilities in weak network or offline environments.
Smart Images

Figure CN120833154A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronic payment, and in particular to a payment two-dimensional code dynamic identification method and device, an electronic device and a storage medium. BACKGROUND
[0002] In the existing code scanning payment scene, the two-dimensional code text payloads from different wallets or channels differ significantly in terms of protocol header, domain name, path, parameter key name, dynamic signature and timestamp; the dynamic code of the same channel also introduces random segments and field disturbances. Common payment two-dimensional code identification schemes either rely on fixed prefixes or domain name white lists, or entrust identification to cloud models or rely on large rule libraries maintained by humans, and have the disadvantages of vulnerability, time delay, poor availability and security gaps. SUMMARY
[0003] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a payment two-dimensional code dynamic identification method and device, an electronic device and a storage medium, which can reduce time delay and improve the accuracy, robustness and security of payment two-dimensional code identification.
[0004] In a first aspect, an embodiment of the present application provides a payment two-dimensional code dynamic identification method applied to a client, comprising: obtaining and parsing a payment two-dimensional code to obtain a text payload; extracting multi-modal features from the text payload, the multi-modal features including syntax and structure features, statistical features and security clue features; matching the syntax and structure features based on a pre-configured feature identification library to obtain a candidate channel set and a prior confidence vector; scoring each channel in the candidate channel set based on a pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector; weighting and fusing the prior confidence vector, the posterior confidence vector and a security score vector determined based on the security clue features, and determining the channel with the highest fusion score as the target channel.
[0005] According to some embodiments of the present application, the syntax and structure features include domain name features, path features, key name features, encoding form indication features and length distribution features, and the matching of the syntax and structure features based on the pre-configured feature identification library to obtain a candidate channel set and a prior confidence vector comprises: matching the domain name features, the path features and the key name features and performing consistency detection on the encoding form indication features and the length distribution features based on the pre-configured feature identification library to obtain an intermediate channel set and a score vector set; performing weighted summation and normalization on each score vector in the score vector set to obtain an intermediate confidence vector; determining a prior confidence vector according to the intermediate confidence vector and a preset confidence threshold, and determining a candidate channel set from the intermediate channel set.
[0006] According to some embodiments of the present application, the matching of the syntax and structure features based on the preconfigured feature identification library comprises: The matching of the syntax and structure features and the verification of the security clue features based on the preconfigured feature identification library comprise obtaining a candidate channel set and a prior confidence vector.
[0007] According to some embodiments of the present application, the statistical features comprise an n-gram frequency vector, a character class proportion, and a character type entropy, and the scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features comprises obtaining a posterior confidence vector, which comprises: The scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the n-gram frequency vector, the character class proportion, and the character type entropy comprises obtaining a posterior confidence vector.
[0008] According to some embodiments of the present application, the scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features comprises obtaining a posterior confidence vector, which comprises: The scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features, length distribution features, and encoding form indication features comprises obtaining a posterior confidence vector.
[0009] According to some embodiments of the present application, the security clue features comprise a signature field, a timestamp freshness, and a key name set normativity, and the security score vector determined based on the security clue features comprises: The security score vector is obtained by performing weighted summation according to the signature field, the timestamp freshness, and the key name set normativity.
[0010] According to some embodiments of the present application, the weighted fusion of the prior confidence vector, the posterior confidence vector, and the security score vector determined based on the security clue features comprises: The weighted fusion is performed based on a preset fusion score relationship, wherein the fusion score relationship is: score = a p rule + (1-a) p_ml + b sec, wherein score represents a fusion score, a and b represent preset weight values, p_rule represents a priori confidence vector, p_ml represents a posteriori confidence vector, and sec represents a security score vector.
[0011] In a second aspect, an embodiment of the present application provides a payment two-dimensional code dynamic identification device applied to a client, comprising: An acquisition and analysis module is configured to acquire and analyze a payment two-dimensional code to obtain a text payload. A feature extraction module is configured to extract multi-modal features from the text payload, wherein the multi-modal features include syntax and structure features, statistical features, and security clue features. A priori discrimination module is configured to match the syntax and structure features based on a pre-configured feature identification library to obtain a candidate channel set and a priori confidence vector. A posteriori discrimination module is configured to score each channel in the candidate channel set based on a pre-trained end-side lightweight model and the statistical features to obtain a posteriori confidence vector. A fusion discrimination module is configured to perform weighted fusion on the priori confidence vector, the posteriori confidence vector, and a security score vector determined based on the security clue features, and determine a channel with the highest fusion score as a target channel.
[0012] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program, and the processor is configured to implement the payment two-dimensional code dynamic identification method described above when the computer program is run.
[0013] In a fourth aspect, an embodiment of the present application provides a storage medium storing a computer program, wherein the computer program is configured to implement the payment two-dimensional code dynamic identification method described above when the computer program is run.
[0014] The embodiments of the present application have at least the following beneficial effects: The embodiments of the present application are applied to a client, have low latency and high offline tolerance, extract multi-modal features from a text payload of a payment two-dimensional code, identify the multi-modal features based on a pre-configured feature identification library and a pre-trained end-side lightweight model to obtain a candidate channel set and corresponding priori confidence vector and posteriori confidence vector, effectively improve the accuracy and robustness of channel identification through two-level fusion, and introduce a security score determined based on security clue features into a fusion score, which is conducive to improving security.
[0015] Additional aspects and advantages of the present application will be apparent from the following description of the application, taken in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0016] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings. Figure 1 A payment two-dimensional code dynamic identification method according to an embodiment of the present application; Figure 2 A principle block diagram of a payment two-dimensional code dynamic identification device according to an embodiment of the present application; Figure 3 A principle block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0017] Embodiments of the present application are described in detail below with reference to the accompanying drawings. The same or similar components are denoted by the same or similar reference numerals throughout the drawings, and a description thereof will not be repeated. The embodiments described below are exemplary and are intended to explain the present application, and should not be understood as limiting the present application.
[0018] In the description of the present application, the meaning of "several" is one or more, the meaning of "multiple" is two or more, greater than, less than, more than, etc. are understood as not including the number, "above", "below", "within", etc. are understood as including the number. If there is a description of "first", "second", etc. is only used to distinguish technical features for the purpose, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the order of indicated technical features.
[0019] In the code scanning payment scenario, the user presents a payment two-dimensional code, and the merchant scans the payment two-dimensional code provided by the user through an electronic device (such as a mobile phone, a tablet computer, a code scanning box, or a cash register, etc.). Among them, different users may provide payment two-dimensional codes from different electronic wallets (such as WeChat payment or Alipay, etc.) or channels, and the electronic device of the merchant needs to identify the payment two-dimensional code from which electronic wallet or channel after scanning the payment two-dimensional code, in order to determine the corresponding issuer, and then map the issuer and the Gateway / Route according to the merchant's configuration One-to-one and initiate a transaction.
[0020] However, the text load of the payment two-dimensional code from different electronic wallets or channels is significantly different in terms of protocol header, domain name, path, parameter key name, dynamic signature and timestamp, and even the same electronic wallet or channel, the dynamic code also introduces random segments and field disturbances. The conventional recognition method relies on a fixed prefix or domain name whitelist, entrusts the recognition task to a cloud model or relies on a large rule base maintained by manual maintenance. The conventional recognition method is vulnerable to field disturbance or path fine-tuning interference and triggers false judgments, and the recognition ability is relatively weak; in the case of weak network signal or offline, the cloud recognition is not available, the time delay is high, and the availability is poor; in the recognition stage, the security consistency information such as signature or timestamp is not included in the discrimination, which is easy to cause confusion of pseudo code.
[0021] Therefore, the embodiment of the present application provides a payment two-dimensional code dynamic recognition method, which can reduce the time delay and improve the accuracy, robustness and security of payment two-dimensional code recognition.
[0022] Please refer to Figure 1 The embodiment discloses a payment two-dimensional code dynamic recognition method, applied to a client, comprising steps S100-S500. It should be noted that the step numbers in the embodiment are only for the convenience of understanding, and do not limit the execution order of the steps. The contents of each step are described in detail as follows: S100, obtaining and analyzing the payment two-dimensional code to obtain the text load; For example, the client obtains the payment two-dimensional code by scanning the code, and analyzes the payment two-dimensional code to convert the image information of the payment two-dimensional code into text information to obtain the text load. Table 1 shows a plurality of text load examples, and different text loads correspond to different protocol types: Table 1 S200, extracting multi-mode features from the text load, the multi-mode features including syntax and structure features, statistical features and security clue features; For example, the text payload of the first item in Table 1 is used as an example of the text payload of the payment QR code. The components of the text payload of the payment QR code include a protocol (such as "https"), a domain name (such as "pay.a-example.com"), a path (such as " / qr / scan"), and a query parameter, wherein the key names of the query parameter include a route identifier (such as "mch"), transaction information (such as "ord", "amt", "currency"), security metadata (such as "ts", "nonce", "signType"), and security credentials (such as "sign"), wherein ts represents a timestamp, nonce represents a random number, signType represents a signature algorithm, and sign = MEQCI... represents Base64 encoding (encoding form indication feature). As can be seen from the text payload examples shown in the first to fourth items in Table 1, the differences between different text payloads are large, and as can be seen from the first item and the fifth item in Table 1, the same type of text payload can also have structural differences. It is difficult to identify multiple types of text payloads by relying solely on fixed prefixes or domain name white lists. Therefore, the present embodiment extracts multi-modal features from the text payload, and analyzes different dimensions of features to improve the accuracy of the analysis.
[0023] The syntax and structure features are features extracted from the syntax and structure characteristics of the text payload, such as protocols, domain names, paths, key name sets, length distribution characteristics, or encoding form indication features. The statistical features are features extracted from the character combination characteristics of the text payload, such as n-gram distribution characteristics of characters and character type entropy. The length distribution characteristics can be understood as statistical features containing structure feature information, but in order to facilitate the description, the length distribution characteristics are divided into syntax and structure features in the present embodiment. The security clue features are features extracted from the security verification rule characteristics of the text payload. Multi-modal features are extracted from the text payload to facilitate the use as a basis for judging target channel identification.
[0024] S300, based on the preconfigured feature identifier library, matching the syntax and structure features to obtain a candidate channel set and a priori confidence vector; Exemplarily, the feature identifier library (also referred to as a "wallet identifier library") stores feature templates of different electronic wallets or channels, for example, the feature identifier library stores a domain name whitelist, a path template set, a parameter key name set, a length interval, and priority information, wherein the length interval is expressed as a length range expected for a text payload or a field value, and the length interval is used for rule priori scoring and anomaly detection, for example, an expected range of the overall length of the text payload, an expected number interval of query parameters, and an expected interval of single field length (such as a random number none∈[8, 32], sign[Base64]∈[60, 120]). The priority information is used for decision-making order and weight setting when multiple templates are hit, for example, dimension priority: domain name>path>key name set>length interval>encoding form indication feature; template priority: new templates of the same issuer are prior to old templates, and accurate templates are prior to generalized templates. A rule engine is constructed based on the feature identifier library, the rule engine is implemented in a deterministic finite automaton (DFA), Hopcroft minimization algorithm is adopted, the number of states is controlled within 2×10 4 When it is necessary to incrementally update the templates of the feature identifier library, tail merging of shared suffixes of a directed acyclic graph (DAWG) can be used to reduce the number of states, which is beneficial to improving the convenience of updating and enhancing scalability. Based on the matching templates of the feature identifier library, syntax and structural features are matched, one or more candidate channels that match can be preliminarily identified, and the priori confidence of each candidate channel is determined. All candidate channels form a candidate channel set, and the priori confidence of all candidate channels forms a priori confidence set, as shown in Table 2. Table 2 S400, based on a pre-trained end-side lightweight model and statistical features, scoring each channel in the candidate channel set to obtain a posteriori confidence vector; Compared with the conventional cloud model, the end-side lightweight model of the embodiment is deployed on the client side, can realize end-side data processing, does not need to send data to the cloud, can perform data processing in a weak network or offline environment, and has high practicability. The end-side lightweight model can adopt a character-level convolutional neural network, a gradient boosting tree, or a quantized Transformer model, and after pre-training and model distillation, the parameter quantity is not greater than 0.8 MB, the end-side delay of INT8 quantization inference for a 1024-byte text payload is not greater than 7 milliseconds, and the data processing efficiency can be improved. Based on the end-side lightweight model and the statistical features, each channel in the candidate channel set is scored, and the inference capability of the model can be used for posterior calibration of each channel. It is worth mentioning that the end-side lightweight model does not directly output the final result, but outputs a posterior confidence vector for the next step of fusion decision, and the posterior confidence vector includes the posterior confidence of each candidate channel.
[0025] S500, the prior confidence vector, the posterior confidence vector, and the security score vector determined based on the security clue feature are weighted and fused, and the channel with the highest fusion score is determined as the target channel.
[0026] Exemplarily, in the recognition stage of the payment two-dimensional code, the prior art does not consider the security consistency information, which is easy to cause confusion of pseudo codes. In the embodiment, the security score vector of the candidate channel set is determined based on the security clue feature, and the security score vector includes the security score of each candidate channel. The prior confidence vector, the posterior confidence vector, and the security score vector are weighted and fused, the prior confidence vector and the posterior confidence vector are used for fusion decision, which is beneficial to improve the accuracy and robustness of recognition, the security clue feature is introduced in the fusion decision process to improve the security of recognition, and the candidate channel with the highest fusion score in the candidate channel set is determined as the target channel.
[0027] The above scheme is applied to the client side, has low latency and high offline tolerance, extracts multi-modal features from the text payload of the payment two-dimensional code, and recognizes the multi-modal features based on the preconfigured feature identifier library and the pre-trained end-side lightweight model to obtain the candidate channel set and the corresponding prior confidence vector and posterior confidence vector. Through two-level fusion, the accuracy and robustness of channel recognition are effectively improved, and the security score determined based on the security clue feature is introduced into the re-fusion score, which is beneficial to improve the security.
[0028] In some application examples, the syntax and structure features include domain name features, path features, key name features, encoding form indication features, and length distribution features. In step S300, the syntax and structure features are matched based on the preconfigured feature identifier library to obtain the candidate channel set and the prior confidence vector, including: S301, based on the pre-configured feature identifier library, the domain name feature, the path feature and the key name feature are matched, and the consistency of the encoding form indication feature and the length distribution feature is detected, to obtain an intermediate channel set and a score vector set; S302, weighted sum and normalization processing are performed on each score vector in the score vector set to obtain an intermediate confidence vector; S303, determining a priori confidence vector according to the intermediate confidence vector and a preset confidence threshold, and determining a candidate channel set from the intermediate channel set.
[0029] For example, as described above, the components of the text payload of the payment two-dimensional code include protocols, domain names, paths and query parameters, etc., and the query parameters include different key names, so the domain name feature, the path feature and the key name feature can be extracted from the text payload, in addition, the encoding form indication feature can be parsed from the security credentials of the query parameters, such as Base32, Base64, URL, TLV or DER header, etc. The feature identifier library stores the feature templates of different electronic wallets or channels, by matching the domain name feature, the path feature and the key name feature, one or more intermediate channels can be preliminarily determined, thereby forming an intermediate channel set, by consistency detection of the encoding form indication feature and the length distribution feature, the priori confusion caused by shared domain names or gray coexistence can be inhibited to assist in identifying the intermediate channel.
[0030] When calculating the score of the intermediate channel, the features can be scored according to the priority information of the feature identifier library, for example, when scoring according to the dimension priority, the base scores of each feature are the same, such as 0.1 (the specific value can be adjusted according to the actual application), and the dimensions are ordered according to the priority as follows: domain name, path, key name set, length distribution feature, encoding form indication feature, and the weight scores of the features of each dimension decrease according to the priority order, such as domain name + 0.05, path + 0.04, key name set + 0.03, length distribution feature + 0.02, and encoding form indication feature + 0.01. That is, when the domain name feature matches successfully, the total score of this dimension is 0.1+0.05=0.15, and by analogy, when the consistency detection of the encoding form indication feature passes, the total score of this dimension is 0.1+0.01=0.11. In order to improve the granularity of the score, on the basis of the dimension priority, the template priority can be increased, for example, the precise template is prior to the generalized template, and a specific example is that for the path feature, the precise template is “ / qr / scan” and the generalized template is “ / qr / *”, when the precise template matches successfully, the weight score is +0.1, that is, when the precise template matches successfully, the total score of the path feature dimension is 0.1+0.04+0.1=0.24; when the generalized template matches successfully, the total score of this dimension is 0.1+0.04=0.14.
[0031] In the identification process of the intermediate channel, the intermediate channel is scored from multiple feature dimensions, each intermediate channel obtains a corresponding score vector, the score vector contains score values of multiple feature dimensions, each feature dimension is pre-assigned a corresponding weight value, the score values of multiple feature dimensions in the score vector are weighted and summed and normalized to obtain a corresponding intermediate confidence, and the intermediate confidences of multiple intermediate channels form an intermediate confidence vector. It is worth mentioning that when the feature identification library is scored according to the priority information, the weight values of each feature dimension in the score vector can be 1.
[0032] After obtaining the intermediate confidence vector, each intermediate confidence in the intermediate confidence vector is subjected to threshold judgment, when a certain intermediate confidence is greater than or equal to a preset confidence threshold, the intermediate confidence is determined as a priori confidence, and the intermediate channel corresponding to the intermediate confidence is determined as a candidate channel. One or more priori confidences form a priori confidence set, and one or more candidate channels form a candidate channel set.
[0033] In some application examples, step S300, based on the preconfigured feature identification library, the syntax and structure features are matched to obtain the candidate channel set and the priori confidence vector, including: S304, based on the preconfigured feature identification library, the syntax and structure features are matched and the security clue features are checked to obtain the candidate channel set and the priori confidence vector.
[0034] For example, the feature identification library is also configured with a verification rule, the verification rule is a preconfigured rule, for example, Base64 legality verification, DER structure header inspection, timestamp freshness detection (timestamp freshness At = |tn-ts|≤threshold, tn represents the current time, ts represents the timestamp), key name set specification verification, check bit or detection algorithm verification (such as Luhn / CRC), encoding consistency verification or numerical range verification (such as amount, currency, merchant number length and character class constraints), etc. Among them, the timestamp freshness and the key name set specification belong to the security clue feature, by checking the security clue feature, the corresponding score can be given according to the verification result, and the score and the scores of other feature dimensions are weighted and summed and normalized to increase the security consistency verification in the calculation of the priori confidence and improve the security of the identification. Among them, the specific method of matching the syntax and structure features based on the feature identification library can refer to the above steps S301~S303, which will not be repeated here. The key name set specification verification can be calculated by the following method: Jaccard (key name set, specification set), wherein Jaccard(A, B)=|A∩B| / |A∪B|, A is the actual parsed key name set, and B is the specification key name set of the channel.
[0035] In some application examples, the statistical features include n-gram frequency vector, character class proportion, and character class entropy, and step S400 includes scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector, including: In some application examples, the statistical features include n-gram frequency vector, character class proportion, and character class entropy, and step S400 includes scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector, including:
[0036] For example, the statistical features are features obtained by counting the text load, where the n-gram frequency is the frequency of adjacent n units (such as words, Chinese characters, or characters) appearing in the entire text, and the commonly used n values are 1, 2, and 3. The character class proportion refers to the proportion of different characters in a specific text or data. The character class entropy is used to quantify the randomness of the text load and can be used as a basis for judging whether the text load is encrypted, encoded, or forged. In the QR code recognition scenario, the entropy value can effectively distinguish between natural structured data (such as standard JSON parameters) and highly randomized data (such as encrypted signatures, Base64 encoded blocks, or maliciously constructed obfuscated strings). The statistical features are used to pre-train the end-side lightweight model to correct the model parameters. In the application, the statistical features of each candidate channel, such as the n-gram frequency vector, the character class proportion, and the character class entropy, are input into the pre-trained end-side lightweight model, which can use the inference ability of the model to distinguish and score each candidate channel to obtain the posterior confidence of each candidate channel. The posterior confidence of all candidate channels forms a posterior confidence vector.
[0037] In some application examples, the statistical features include n-gram frequency vector, character class proportion, and character class entropy, and step S400 includes scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector, including: In some application examples, the statistical features include n-gram frequency vector, character class proportion, and character class entropy, and step S400 includes scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector, including:
[0038] Exemplarily, the length distribution feature is a feature obtained by counting a plurality of preset dimensions of the text payload, for example, the overall length of the text payload, the number of query parameters, and the length of a single field, and the length values of the plurality of dimensions form the length distribution feature. The length distribution features of the text payloads of the payment QR codes published by different issuers are stable and different, for example, the length of "payload=Base64(JSON)" is usually longer and is a multiple of 4 compared with "flat query". Examples of the encoding form indication feature include: whether the Base64 character set is included, whether the remainder between the length and 4 is equal to 0 (i.e. len%4 ==0), whether the DER header (such as 00x30) appears, whether it is a URL pure query, whether the tag / len rule of TLV is present, and the like.
[0039] When step S300 determines a plurality of candidate channels because of the shared domain name or the coexistence of gray degrees, the end-side lightweight model of step S400 performs logical reasoning based on the statistical feature, the length distribution feature, and the encoding form indication feature, and outputs a posterior confidence vector to assist in distinguishing the candidate channels, so that the fusion decision of step S500 determines the target channel of the unique issuer. For example, the candidate channel set C={A, B} includes candidate channel A and candidate channel B, and the two candidate channels share the domain name: pay.gw.com / scan; candidate channel A uses payload=Base64(JSON), and candidate channel B uses only flat parameters. Assuming that the prior confidence of candidate channel A and candidate channel B is about 0.5, the prior confidence of the two is not much different. The end-side lightweight model reasons and outputs the posterior confidence of the two as p_ml(A)=0.85 and p_ml(B)=0.15 according to the encoding form indication feature=Base64 and the length distribution feature "long and stable", and the fusion decision of the prior confidence vector and the posterior confidence vector can determine that candidate channel A is the target channel.
[0040] The security clue feature includes the signature field, the timestamp freshness, and the key name set normativity. In step S500, the security score vector determined based on the security clue feature includes: The security score vector is obtained by weighted summation according to the signature field, the timestamp freshness, and the key name set normativity.
[0041] Exemplarily, the security score can be calculated according to the following relationship: The security score sec = w1x1[signature field exists] + w2x1[timestamp freshness ≤ threshold] + w3xJacard (key name set, specification set), wherein w1, w2, and w3 are weight coefficients, the weight coefficients can be fine-tuned in the range of 0.1-0.5, for example, w1=0.4, w2=0.3, and w3=0.3; 1[•] is an indicator function, taking 1 when the condition is met, and 0 otherwise. Each candidate channel can determine a security score, and the security scores of all candidate channels form a score vector.
[0042] Step S500, the prior confidence vector, the posterior confidence vector, and the security score vector determined based on the security clue feature are weighted and fused, including: The weighted fusion is performed based on a preset fusion score relationship, wherein the fusion score relationship is: score = a-p_rule + (1-a)-p_ml + b-sec, wherein score represents the fusion score, a and b represent preset weight values, p_rule represents the prior confidence vector, p_ml represents the posterior confidence vector, and sec represents the security score vector.
[0043] For example, the weight value of the prior confidence vector and the weight value of the posterior confidence vector are complementary, a can be configured according to actual application conditions to balance the rule prior and the model posterior, the security score vector is introduced in the relationship, and an independent weight b is configured, the weight b can be adjusted according to the security level requirement of actual application, which is beneficial to improve the security of identification. The candidate channel with the highest fusion score is taken as the target channel, wherein the fusion score of the target channel should be greater than or equal to a preset score threshold (threshold T), if the maximum value of the fusion score is less than the preset score threshold, the text payload is sent to the cloud for identification or back to the whitelist matching.
[0044] It is worth mentioning that at least one of the encoding form indication feature, the length distribution feature, or the statistical feature can be introduced as an auxiliary criterion in the calculation process of the security score (sec), for example, when the encoding form indication feature is inconsistent with the specification preset by the issuer, or the length distribution feature or the character type entropy significantly deviates from the historical distribution of the issuer, the security score is reduced or marked as low confidence, thereby improving the security of identification.
[0045] In addition, step S500 further includes: S600, generating a message according to a protocol template of the target channel, transmitting by using bidirectional authentication (mTLS) and certificate fixing (Pinning), and supporting retry by using an idempotency key; wherein information of the message includes merchant or terminal identification, an amount, a currency, a timestamp, a random number, and a signature digest.
[0046] S700, recording the recognition result and a gateway receipt in a closed loop, and supporting threshold and prior probability self-adaption, wherein the threshold and prior probability self-adaption refers to that a score threshold (threshold T) is updated according to the 95th percentile of a fusion score sample of not less than 10,000 pieces of closed loop receipts in the recent period, and is smoothed by using an exponential moving average (coefficient 0.1), and the update period is not less than 1 hour; a "rule slice / model slice" is issued by a configuration center, and the terminal hot loads after verifying the signature by using a manufacturer public key, supports rollback, does not need firmware upgrade, is conducive to improving scalability and maintainability.
[0047] Please refer to Figure 2 The embodiment also provides a payment two-dimensional code dynamic identification device, applied to a client, and including: An acquisition and analysis module 110, configured to acquire and analyze a payment two-dimensional code to obtain text load; A feature extraction module 120, configured to extract multi-modal features from the text load, wherein the multi-modal features include syntax and structure features, statistical features, and security clue features; A prior discriminant module 130, configured to match the syntax and structure features based on a preconfigured feature identifier library to obtain a candidate channel set and a prior confidence vector; A posterior discriminant module 140, configured to score each channel in the candidate channel set based on a pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector; A fusion discriminant module 150, configured to perform weighted fusion on the prior confidence vector, the posterior confidence vector, and a security score vector determined based on the security clue features, and determine a channel with the highest fusion score as a target channel.
[0048] The inventive concept of the payment two-dimensional code dynamic identification device embodiment is the same as that of the payment two-dimensional code dynamic identification method embodiment described above. Contents not involved in the payment two-dimensional code dynamic identification device embodiment can refer to the payment two-dimensional code dynamic identification method embodiment described above, which will not be repeated here. The payment two-dimensional code dynamic identification device is applied to a client, has low latency and high offline tolerance, extracts multi-modal features from the text load of the payment two-dimensional code, and identifies the multi-modal features based on a pre-configured feature identification library and a pre-trained end-side lightweight model to obtain a candidate channel set and corresponding prior confidence base vectors and posterior confidence vectors. Two-level fusion effectively improves the accuracy and robustness of channel identification. The security score determined based on the security clue feature is introduced into the re-fusion score, which is conducive to improving security.
[0049] Please refer to Figure 3 The embodiment also provides an electronic device including a processor 210 and a memory 220. The memory 220 stores a computer program. When the processor 210 runs the computer program, the payment two-dimensional code dynamic identification method described above is implemented. The specific content of the payment two-dimensional code dynamic identification method can refer to the above, which will not be repeated here. The payment two-dimensional code dynamic identification method is applied to a client, has low latency and high offline tolerance, extracts multi-modal features from the text load of the payment two-dimensional code, and identifies the multi-modal features based on a pre-configured feature identification library and a pre-trained end-side lightweight model to obtain a candidate channel set and corresponding prior confidence base vectors and posterior confidence vectors. Two-level fusion effectively improves the accuracy and robustness of channel identification. The security score determined based on the security clue feature is introduced into the re-fusion score, which is conducive to improving security.
[0050] The embodiment also provides a storage medium storing a computer program. When the computer program is run, the payment two-dimensional code dynamic identification method described above is implemented. The specific content of the payment two-dimensional code dynamic identification method can refer to the above, which will not be repeated here. The payment two-dimensional code dynamic identification method is applied to a client, has low latency and high offline tolerance, extracts multi-modal features from the text load of the payment two-dimensional code, and identifies the multi-modal features based on a pre-configured feature identification library and a pre-trained end-side lightweight model to obtain a candidate channel set and corresponding prior confidence base vectors and posterior confidence vectors. Two-level fusion effectively improves the accuracy and robustness of channel identification. The security score determined based on the security clue feature is introduced into the re-fusion score, which is conducive to improving security.
[0051] The embodiments of the application are described in detail above with reference to the accompanying drawings, but the application is not limited to the above-described embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the purpose of the application.
Claims
1. A dynamic identification method of a payment QR code, applied to a client, and characterized in that, The method comprises the following steps: acquiring and parsing a payment two-dimensional code to obtain a text payload; extracting multi-modal features from the text payload, the multi-modal features including syntax and structure features, statistical features, and security clue features; matching the syntax and structure features based on a pre-configured feature identification library to obtain a candidate channel set and a prior confidence vector; scoring each channel in the candidate channel set based on a pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector; performing weighted fusion on the prior confidence vector, the posterior confidence vector, and a security score vector determined based on the security clue features, and determining a channel with the highest fusion score as a target channel.
2. The payment QR code dynamic identification method of claim 1, wherein, The syntax and structure features include domain name features, path features, key name features, encoding form indication features, and length distribution features, and the matching of the syntax and structure features based on the pre-configured feature identification library to obtain the candidate channel set and the prior confidence vector comprises the following steps: matching the domain name features, the path features, and the key name features and performing consistency detection on the encoding form indication features and the length distribution features based on the pre-configured feature identification library to obtain an intermediate channel set and a score vector set; performing weighted summation on each score vector in the score vector set and performing normalization processing to obtain an intermediate confidence vector; determining a prior confidence vector according to the intermediate confidence vector and a preset confidence threshold, and determining a candidate channel set from the intermediate channel set.
3. The dynamic identification method of the payment QR code according to claim 1 or 2, characterized in that, The matching of the syntax and structure features based on the pre-configured feature identification library to obtain the candidate channel set and the prior confidence vector comprises the following steps: matching the syntax and structure features based on the pre-configured feature identification library and performing verification on the security clue features to obtain the candidate channel set and the prior confidence vector.
4. The payment QR code dynamic identification method of claim 1, wherein, The statistical features include an n-gram frequency vector, a character class proportion, and a character category entropy, and the scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain the posterior confidence vector comprises the following steps: scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the n-gram frequency vector, the character class proportion, and the character category entropy to obtain the posterior confidence vector.
5. The dynamic identification method of the payment QR code according to claim 1 or 4, characterized in that, The scoring of each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features to obtain the posterior confidence vector comprises the following steps: scoring each channel in the candidate channel set based on the pre-trained end-side lightweight model and the statistical features, length distribution features, and encoding form indication features to obtain the posterior confidence vector.
6. The payment QR code dynamic identification method according to claim 1, characterized in that, The security clue features include a signature field, a timestamp freshness, and a key name set normativity, and the security score vector determined based on the security clue features comprises the following steps: performing weighted summation on the signature field, the timestamp freshness, and the key name set normativity to obtain the security score vector.
7. The dynamic identification method of the payment QR code according to claim 1 or 6, characterized in that, The weighting fusion on the prior confidence vector, the posterior confidence vector, and a security score vector determined based on the security clue feature comprises: The weighting fusion is based on a preset fusion score relationship formula, wherein the fusion score relationship formula is: score = a p rule + (1-a) p_ml + b sec, wherein score represents a fusion score, a and b represent preset weight values, p_rule represents the prior confidence vector, p_ml represents the posterior confidence vector, and sec represents the security score vector. 8.A dynamic identification device for a payment QR code, applied to a client, and having the characteristics that, Comprise: An acquisition and analysis module is configured to acquire and analyze a payment two-dimensional code to obtain text load; A feature extraction module is configured to extract multi-modal features from the text load, wherein the multi-modal features comprise syntax and structure features, statistical features, and security clue features; A prior discrimination module is configured to match the syntax and structure features based on a preconfigured feature identifier library to obtain a candidate channel set and a prior confidence vector; A posterior discrimination module is configured to score each channel in the candidate channel set based on a pre-trained end-side lightweight model and the statistical features to obtain a posterior confidence vector; A fusion discrimination module is configured to perform weighting fusion on the prior confidence vector, the posterior confidence vector, and a security score vector determined based on the security clue feature, and determine a channel with the highest fusion score as a target channel.
9. An electronic device comprising a processor and a memory, said memory having stored therein a computer program, characterized in that, The processor, when running the computer program, is configured to implement the payment two-dimensional code dynamic identification method according to any one of claims 1 to 7.
10. A storage medium having stored therein a computer program, characterized in that The computer program, when being run, is configured to implement the payment two-dimensional code dynamic identification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Decision-making method and device for payment channel and electronic equipment
CN110689336A
Data processing method and system based on dynamic routing
CN119539795A