CN116956072A - Ciphertext data matching method based on csv file - Google Patents

Ciphertext data matching method based on csv file Download PDF

Info

Publication number
CN116956072A
CN116956072A CN202311009687.0A CN202311009687A CN116956072A CN 116956072 A CN116956072 A CN 116956072A CN 202311009687 A CN202311009687 A CN 202311009687A CN 116956072 A CN116956072 A CN 116956072A
Authority
CN
China
Prior art keywords
data
user information
ciphertext
file
party data
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
CN202311009687.0A
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.)
Shanghai Tonglian Financial Services Co Ltd
Original Assignee
Shanghai Tonglian Financial Services Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Tonglian Financial Services Co Ltd filed Critical Shanghai Tonglian Financial Services Co Ltd
Priority to CN202311009687.0A priority Critical patent/CN116956072A/en
Publication of CN116956072A publication Critical patent/CN116956072A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Evolutionary Biology (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The application discloses a ciphertext data matching method based on a CSV file. Firstly, reading a plaintext file of user information, encrypting a name, an identity card number and a mobile phone number, and obtaining encrypted ciphertext user information and contents of a three-party data file. Then, the encrypted ciphertext user information and the content of the three-party data file are analyzed and processed and respectively stored in two maps. Then, the data of the two maps are spliced to generate SQL which can be inserted into the table, and a user information table and a three-party data table are newly built. And respectively inserting the data of the two files into corresponding tables according to the generated SQL. Finally, an association query is established. Meanwhile, the user three elements and the three-party data in the plaintext are exported to form a CSV file by means of the DbVisualzer database, and the three-party data are processed. The method has the advantages that the influence of system performance can be reduced, and the processing of the whole flow also generates good adaptation effect on different data matching in the future.

Description

Ciphertext data matching method based on csv file
Technical Field
The application belongs to the technical field of data processing, and particularly relates to a ciphertext data matching method based on a csv file.
Background
After the production environment finds that the three-party account is replaced, the three-party data of the user is problematic, and the three-party data of the user needs to be reprocessed. Because the original user data name, the identity card number and the mobile phone number are encrypted by SHA256 and have no method for decryption, the plaintext user information and the encrypted user information need to be mapped, and the three-party data of each user are obtained and processed. The file formats are csv formats. The problems to be solved are as follows:
1. current file: a plaintext user information file, ciphertext user information, and a three-party data file;
target file: plaintext user information and three-party data files;
2. encrypting the plaintext user information file to obtain an encrypted user information file;
3. matching the encrypted user information file with the original encrypted user information and the three-party data file to obtain a mapping relation;
4. and processing to obtain the plaintext user information and the three-party data file according to the mapping relation.
Disclosure of Invention
The embodiment of the application provides a ciphertext data matching method based on a csv file, which aims to reduce the influence of system performance, and the processing of the whole flow also generates a good adaptation effect on different data matching later.
In a first aspect, an embodiment of the present application provides a method for matching ciphertext data based on a csv file, which specifically includes the following steps:
step one: reading a plaintext file of the user information, encrypting the name, the identification card number and the mobile phone number by a sha256 method in encryptionUtil, and storing the original plaintext user information and the encrypted ciphertext user information in a Map;
step two: analyzing the content of the ciphertext user information and the content of the three-party data file, and placing the ciphertext user information and the content of the three-party data file in another Map;
step three: processing the data of the two maps in the steps 1 and 2 respectively, and splicing to generate sql which can be inserted into a table;
step four: a user information table and a three-party data table are newly established by means of a database,
the user information table is used for storing the bright Wen San element and the encrypted three elements of the user;
the three-party data table is used for storing encrypted three elements and three-party data;
step five: according to the generated sql, the data of the two files are respectively inserted into the corresponding tables in a one-to-one mapping manner;
step six: establishing association inquiry, associating two tables by taking the encrypted user name, the encrypted identification card number and the encrypted mobile phone number as association fields to obtain a mapping relation, generating a temporary table,
step seven: and exporting the three elements of the user and the three-party data in the plaintext into a csv file by means of a DbVisualizer database management tool, and processing the three-party data according to a contracted mode to obtain a final result.
Preferably, the method for matching ciphertext data based on the csv file of claim 1 comprises the following specific steps: in step three, plaintext plus ciphertext user information is used as one table, the header is TM_ID_NAME_CELL, the ciphertext user information and the three-party data are used as another table, and the header is TM_TD_VALUE.
Preferably, the header of the user information table is tm_id_name_cell; the three-way data table has a header of TM_TD_VALUE.
Preferably, the data in the temporary table is three-element data of the ciphertext user, three-element data of the plaintext user and three-party data corresponding to the user.
In a second aspect, the present application also provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the method of the first aspect.
Compared with the prior art, the embodiment of the application has the beneficial effects that:
the processing of the whole flow is based on java development language, the database is DB2, and large amount of data is processed mainly through the high performance of database association inquiry, compared with the traditional matching through java codes, the influence of system performance is reduced, and the processing of the whole flow also generates good adaptation effect on different data matching later.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the term "and-
Or "refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. Terminology
"including," "comprising," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
With the continuous development of information technology, network security is becoming an important field of enterprise concern. The existing network attack means are increasingly rampant, and the problems of encryption, decryption, data leakage and the like are increasingly prominent. Therefore, securing the information assets of an enterprise is an urgent task.
The application aims to improve the security and reliability of enterprise network data. The application adopts a cryptographic data matching method based on CSV files, and the security of enterprise network data is ensured by encrypting and decrypting original data, comparing matched data, extracting sensitive information and encrypting the sensitive information.
The project adopts a cryptographic data matching method based on CSV files,
encrypting and decrypting the original data to obtain encrypted data;
* Comparing and matching the encrypted data, and extracting sensitive information in a matching result;
* Encrypting the sensitive information to obtain encrypted sensitive information;
* And comparing and matching the encrypted sensitive information to obtain a more accurate matching result.
The data matching scheme based on the cryptography technology is adopted, so that the safety and reliability of the data can be improved; the method can process large-scale data sets, can meet the requirement of enterprise-level network data security, has expandability, can adapt to data sets of different scales, and can perform performance optimization.
The technical scheme of the project can be applied to the field of enterprise network data security, for example:
encrypting and decrypting the network data, and guaranteeing the safety of the data;
sensitive data are extracted, encrypted and decrypted, and the reliability of the data is improved;
and encrypting and decrypting the matching result to ensure the safety of the sensitive data.
The public key and the private key technology in cryptography are utilized, so that the comparison and the matching of the encrypted data are realized, the sensitive information in the matching result is extracted, and the sensitive information is encrypted, thereby improving the safety and the reliability of the data.
In one possible implementation: in step one and step two, specific example processes are given:
the embodiment environment is a Java program used for encrypting the content in the file. The program first defines a HashMap object named paramHap for storing the encrypted data. A variable named count is then defined for recording the number of lines that have been processed.
Next, the program creates a bufferedReader object for reading the contents of the file using the try. In the cycle, each time a line of data is read, the line of data is converted into a character string array, then required data (namely ID number, name and cell value) is extracted, the data is encrypted, and finally the encrypted data is added into the ParamHap object.
The encryption process uses the SHA256 algorithm, first using the replacement as a replacement, and then encrypting using the shr 256. And finally, writing the encrypted data into the csw file.
The program also uses the mritei.write () method to generate a CSV file (i.e., constructional Sword) that is used to record the encrypted path and operation.
The next code defines a FileWriter object named mritei for writing to the CSW file. Finally, the program prints out some log information using the system.out.printin () method for debugging and observing the running state of the program. For encrypting the content in the file and writing it to the CSW file. The program encrypts the file content by using the SHA256 algorithm and performs file read-write operation by using HashMap and BufferedReader/Writer objects.
The input string "input" is encrypted using a Java function using the SHA-256 algorithm and the result is stored in a variable named "encodstrj".
Specifically, this function receives two parameters, one is the string "input" to be encrypted and the other is the string of the encryption type ". The encryption type "may be any string, but in this example" SHA-256 "is used as a default.
Within the function, a class named "MessageDigest" is first called and its instance is used to create an object named "MessageDigest". Then, a method "update" of the "messageDigest" object is used to update the hash value of the input string "input". In this process, a parameter named "charsetName" is used, which specifies which character set is used to encode the input string. In this example, UTF-8 encoding is used.
Finally, the hash value of the "messageDigest" object is converted to a 16-ary string using a method named "byte2Hex" and stored in the "encoddestrs" variable. If any anomaly occurs, two different anomalies are captured and a corresponding error message is output.
Finally, the function returns the value of the "encoddstr" variable to return the encryption result to the caller.
A given ResponseResult object result is processed and the processing result is stored in the database table tm_td_value.
Specifically, the function of this piece of code is as follows:
creating a new responseResult object result;
extracting columns required to be stored in a database table from a list object, and converting the columns into a character string array columnsArray;
creating a new RiskItem object riskItems and storing the value of each element extracted from the list object in riskItems;
creating a new resultDesc object resultDesc, and setting the riskItems object as the riskItems attribute of the resultDesc object;
setting a result object as successful, and setting a processing result as a result Desc object;
defining a NameValvepair object, nameValvepair1, and setting it as the value of name column;
defining a NameValvepair object NameVatvePair2 and setting it as the value of the idNo column;
defining a NameValvepair object NameValvepair3, and setting the NameValvepair object NameValvepair3 as a cell column value;
calling a gensqLInsert method to store NameValvePair objects, namely NameValvePair1, nameValvePair2 and NameValvePair3, into a TM_TD_VALUE database table, and storing the results as Result objects Result;
and outputting a processing result.
The specific implementation in the third step is Java code for generating an INSERT INTO statement. The realization function is as follows:
1. a static method named gensqLnsert is defined that accepts two parameters, one is the table name (String type) to be inserted and the other is the dictionary (Map < String, object > type) containing the records to be inserted.
2. If the dictionary to be inserted is empty, null is returned.
3. A StringBuilder object named sbField is defined for storing the value of the record to be inserted.
4. A StringBuilder object named sbValue is defined for storing the value of the record to be inserted.
5. Traversing the dataMap's entrySet method requires, for each map. Specifically, a string variable named mapKey is first defined, which stores the name of the field into which the record is to be inserted; a string variable named mapValve is then defined, which stores the value to be inserted into the record.
6. For each map. Entry, mapKey needs to be converted to uppercase and spliced into the value of sbField.
7. Finally, the sbField and sbValue are converted into strings, which are spliced together and the excess "," and' "" is removed, and the result is finally returned.
In brief, the data in the incoming map is inserted into the specified table, and for each record, the corresponding value is inserted into the record value field.
In the fourth to seventh steps, the same descriptions as the summary of the application are omitted.
The order of execution of the processes should be determined by their function and inherent logic and should not be construed as limiting the practice of embodiments of the application in any way.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps for implementing the various method embodiments described above.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with 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 solution. 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.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (6)

1. The ciphertext data matching method based on the csv file is characterized by comprising the following steps of:
step one: reading a plaintext file of the user information, encrypting the name, the identification card number and the mobile phone number by a sha256 method in encryptionUtil, and storing the original plaintext user information and the encrypted ciphertext user information in a Map;
step two: analyzing the content of the ciphertext user information and the content of the three-party data file, and placing the ciphertext user information and the content of the three-party data file in another Map;
step three: processing the data of the two maps in the steps 1 and 2 respectively, and splicing to generate sql which can be inserted into a table;
step four: a user information table and a three-party data table are newly established by means of a database,
the user information table is used for storing the bright Wen San element and the encrypted three elements of the user;
the three-party data table is used for storing encrypted three elements and three-party data;
step five: according to the generated sql, the data of the two files are respectively inserted into the corresponding tables in a one-to-one mapping manner;
step six: establishing association inquiry, associating two tables by taking the encrypted user name, the encrypted identification card number and the encrypted mobile phone number as association fields to obtain a mapping relation, generating a temporary table,
step seven: and exporting the three elements of the user and the three-party data in the plaintext into a csv file by means of a DbVisualizer database management tool, and processing the three-party data according to a contracted mode to obtain a final result.
2. The method for matching ciphertext data based on a csv file as claimed in claim 1, comprising the steps of: the whole traversal process uses name, ID card number and mobile phone number as key fields.
3. The method for matching ciphertext data based on a csv file as claimed in claim 1, comprising the steps of: in step three, plaintext plus ciphertext user information is used as one table, the header is TM_ID_NAME_CELL, the ciphertext user information and the three-party data are used as another table, and the header is TM_TD_VALUE.
4. The method for matching ciphertext data based on a csv file as claimed in claim 1, comprising the steps of: the header of the user information table is TM_ID_NAME_CELL; the three-way data table has a header of TM_TD_VALUE.
5. The method for matching ciphertext data based on a csv file of claim 1, comprising the specific steps of: the data in the temporary table are three-element data of the ciphertext user, three-element data of the plaintext user and three-party data corresponding to the user.
6. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 5.
CN202311009687.0A 2023-08-10 2023-08-10 Ciphertext data matching method based on csv file Pending CN116956072A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311009687.0A CN116956072A (en) 2023-08-10 2023-08-10 Ciphertext data matching method based on csv file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311009687.0A CN116956072A (en) 2023-08-10 2023-08-10 Ciphertext data matching method based on csv file

Publications (1)

Publication Number Publication Date
CN116956072A true CN116956072A (en) 2023-10-27

Family

ID=88454668

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311009687.0A Pending CN116956072A (en) 2023-08-10 2023-08-10 Ciphertext data matching method based on csv file

Country Status (1)

Country Link
CN (1) CN116956072A (en)

Similar Documents

Publication Publication Date Title
US10089487B2 (en) Masking query data access pattern in encrypted data
CN101587479B (en) Database management system kernel oriented data encryption/decryption system and method thereof
US9852306B2 (en) Conjunctive search in encrypted data
CN109815719A (en) A kind of database security encryption system that can search for
CN112800088A (en) Database ciphertext retrieval system and method based on bidirectional security index
Wang et al. Fast query over encrypted character data in database
US20100262836A1 (en) Privacy and confidentiality preserving mapping repository for mapping reuse
EP4020265A1 (en) Method and device for storing encrypted data
CN112583809B (en) Data encryption and decryption method of non-immersion multiple encryption algorithms
Song et al. Privacy-preserving threshold-based image retrieval in cloud-assisted internet of things
CN103647636A (en) Method and device for safe access to data
CN102542143A (en) Method and device for acquiring and storing process data, and system for processing process data
CN111680477A (en) Method and device for exporting spreadsheet file, computer equipment and storage medium
CN116186108A (en) Method for supporting fuzzy query by encrypting sensitive field
CN114218582A (en) Database data encryption method and terminal
CN116894273B (en) File encryption method, decryption method, equipment and medium based on exclusive or sum remainder
Bhagat et al. Reverse encryption algorithm: a technique for encryption & decryption
CN115174201B (en) Security rule management method and device based on screening tag
CN116956072A (en) Ciphertext data matching method based on csv file
CN116049783A (en) Enterprise bill management method and system based on secure hardware carrier
Sun et al. Research of data security model in cloud computing platform for SMEs
Liu et al. Mathematical Modeling of Static Data Attribute Encryption Based on Big Data Technology
CN116701493B (en) Database operation method supporting fuzzy query and user side
WO2023178792A1 (en) Ciphertext data storage method and apparatus, and device and storage medium
US20230325524A1 (en) Systems and methods for end-to end-encryption with encrypted multi-maps

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