WO2018094764A1 - 一种基于云服务的模式串匹配验证方法及装置 - Google Patents

一种基于云服务的模式串匹配验证方法及装置 Download PDF

Info

Publication number
WO2018094764A1
WO2018094764A1 PCT/CN2016/108364 CN2016108364W WO2018094764A1 WO 2018094764 A1 WO2018094764 A1 WO 2018094764A1 CN 2016108364 W CN2016108364 W CN 2016108364W WO 2018094764 A1 WO2018094764 A1 WO 2018094764A1
Authority
WO
WIPO (PCT)
Prior art keywords
string
matching
suffix
accumulated value
evidence
Prior art date
Application number
PCT/CN2016/108364
Other languages
English (en)
French (fr)
Inventor
陈飞
王东宏
熊馨雨
陈剑勇
Original Assignee
深圳大学
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 深圳大学 filed Critical 深圳大学
Publication of WO2018094764A1 publication Critical patent/WO2018094764A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • G06F16/325Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Definitions

  • the invention belongs to the field of computer technology, and in particular relates to a cloud service based mode string matching verification method and device.
  • Pattern string matching refers to the process of finding all substrings with a given shorter string in a long string. It has been widely used in the fields of spam filtering, intrusion detection, firewall filtering, and information retrieval. With the development of cloud technology, more and more enterprises and individuals outsource the pattern string matching query to cloud computing for the convenience of management and cost saving, but this also causes users to lose control of data and data query. It raises the question of how to verify that the query results returned by the cloud are correct and reliable, that is, the data query can verify the problem.
  • the solution to the problem in the prior art is that the cloud service generates verification evidence while obtaining the matching result, and sends the matching result together with the verification evidence to the user, and the user passes the pattern string, the matching result, and the verification evidence for matching the query. To verify that the match is correct.
  • the specific implementation schemes are the general solution of verifiable data structure proposed by Martel et al. in 2004 and the practical verifiable mode string matching Suffix Tree scheme proposed by Papadopoulos et al. in 2015, but the first The verification evidence of one scheme is large, which leads to the low efficiency of the user's verification.
  • the verification evidence returned by the cloud service to the user in the second scheme is more complicated and less concise, which also leads to the complicated verification steps of the user.
  • An object of the present invention is to provide a cloud service based mode string matching verification method and device, Due to the inability to provide a simple and effective pattern string matching verification method due to the prior art, the amount of data that is outsourced to the cloud service is too large, the verification evidence content returned by the cloud service to the user is too numerous, and the user is verifying the matching returned by the cloud service. The result is a less efficient verification.
  • the present invention provides a cloud service based pattern string matching verification method, the method comprising the following steps:
  • the preset cloud server obtains a pattern string to be matched in the pattern matching query request when receiving the pattern string matching query request of the data access end;
  • the cloud server matches the to-be-matched pattern string with a pre-stored text string
  • the cloud server obtains the verification evidence that the matching is successful according to the query data structure and the verifiable data structure associated with the text string, and the matching is successful. And the verification result that the matching is successful is sent to the data access end, where the verifiable data structure is preprocessed by the data owner to preprocess the text string by using a preset hash function;
  • the present invention provides a cloud service based mode string matching verification device, the device comprising:
  • a mode string obtaining module configured to: when the cloud server receives the pattern string matching query request of the data access end, obtain the to-be-matched pattern string in the pattern string matching query request;
  • a pattern string matching module configured to match, by the cloud server, the to-be-matched pattern string with a pre-stored text string
  • the evidence obtaining module is configured to: when the matching of the to-be-matched pattern string in the text string is successful, the cloud server obtains verification evidence that the matching is successful according to the query data structure and the verifiable data structure associated with the text string. And sending the result of the matching success and the verification evidence of the matching success to the data access end, where the verifiable data structure is preprocessed by the data owner through a preset hash function to obtain the text string. ;as well as
  • a verification module configured to determine, by the data access end, whether the result of the successful matching is correct according to the verification evidence, the verification evidence of the matching success, and the verification parameter associated with the text string.
  • the present invention includes three execution entities: a cloud server, a data access end, and a data owner.
  • the cloud server receives the pattern string matching string query request of the data access end, the cloud server obtains the pattern string to be matched in the pattern string matching query request, and the The matching pattern string is matched with the pre-stored text string.
  • the cloud server obtains the verification evidence corresponding to the successful matching result according to the query data structure and the verifiable data result associated with the text string. And sending the result of the matching success and the verification evidence to the data access end, and the data access end determines whether the result of the matching success is correct according to the pattern string to be matched, the verification evidence of the matching success, and the verification parameter associated with the text string.
  • the verifiable data structure is obtained by preprocessing the text string by the data possession through a preset hash function, thereby effectively pre-processing the text string by using a preset hash function on the data possession end, thereby effectively simplifying Verifiable data structure, which in turn not only greatly reduces data storage for cloud services And calculating the amount of data, and the data access client also stores the authentication parameter only fixed size, effectively improving the efficiency of pattern matching verification.
  • FIG. 2 is a flowchart of implementing a preprocessing of a text string by a data owner in a cloud service-based mode string matching verification method according to Embodiment 1 of the present invention
  • FIG. 4 is a diagram showing an example of a longest common prefix array in a query data structure in a cloud service-based pattern string matching verification method according to Embodiment 1 of the present invention
  • FIG. 5 is a flowchart of implementing verification of obtaining matching verification success in a cloud service-based pattern string matching verification method according to Embodiment 1 of the present invention
  • FIG. 6 is a schematic structural diagram of a cloud service-based mode string matching verification apparatus according to Embodiment 2 of the present invention.
  • FIG. 7 is a schematic diagram of a preferred structure of a cloud service-based mode string matching verification apparatus according to Embodiment 2 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • the data access end may send a pattern string matching query request to the cloud server to query the matching result of the pattern string to be matched on the cloud server and verify the matching result. Whether it is correct, wherein the pattern to be matched is the content to be matched input by the user.
  • the to-be-matched mode string may be the content in an email.
  • the to-be-matched mode string may be a string of IP addresses.
  • the data owner performs preprocessing on the text string, and the obtained query data structure and the verifiable data structure can be implemented by the following steps:
  • step S201 the data owner generates a query data structure according to the text string, and the query data structure includes an suffix array of the text string and a longest common prefix array.
  • step S202 the data owner generates a verifiable data structure according to the hash function, and the verifiable data structure includes a first accumulated value set, a second accumulated value set, a first hash tree, and a second hash tree.
  • the data owner calculates the accumulated value of each suffix string in the text string through a hash function, and stores the accumulated value of all the suffix strings in the first accumulated value set.
  • the hash function is performed on each suffix string of the text string by using a preset hash function to obtain an accumulated value of each suffix string.
  • the formula of the hash iteration operation may be:
  • Ha i h(pt i
  • n is the character length of the text string
  • pt i (i
  • is the default character concatenation operator
  • - is The default connection character
  • the data owner generates a plurality of suffix tuples according to the suffix array and the first accumulated value set, and constructs a first hash tree according to the suffix array and obtains an accumulated value of the first hash tree root node.
  • the suffix array and the accumulated value in the first accumulated value set are in one-to-one correspondence, and a plurality of suffix tuples are combined, and then the suffix tuple is constructed in the order of the suffix array, and the first hash tree is constructed from bottom to top, and The accumulated value of the first hash tree root node can be obtained.
  • the data owner generates a plurality of matching tuples according to the suffix array and the longest common prefix array, calculates the accumulated value of each matching tuple in the matching tuple set through the hash function, and accumulates all matching tuples. The value is stored in the second accumulated value set.
  • H i h(tl i
  • h(tl n )))))))), 1 ⁇ i ⁇ n, where H i matching tuple tl i corresponding to the accumulated value. Therefore, the second accumulated value set can be expressed as HL(LCP) ⁇ H i
  • the second hash tree is constructed from the bottom to the top in a certain order, and the accumulated value of the first hash tree root node can be obtained.
  • the accumulated value of the second hash tree leaf node is the accumulated value of the corresponding matching tuple.
  • step S203 the data owner sends the query data structure and the verifiable data structure to the cloud server, and issues the hash function to the data access terminal, accumulating the root node of the first hash tree and the root node of the second hash tree.
  • the value is set to the authentication parameter sent to the data access side.
  • the step of obtaining, by the cloud server, the verification evidence matching the success according to the query data structure and the verifiable data structure associated with the text string in step S103 may include:
  • step S302 searching for the accumulated value of the relevant suffix string in the first accumulated value set according to the current matching position and the to-be-matched mode string, and obtaining, according to the first hash tree, whether to verify whether the to-be-matched mode string exists.
  • the current matching position may be represented by an array element SA[i] in the suffix array, and the start character of the relevant suffix string may be determined in the text string according to the sum of the current matching position and the length of the pattern string to be matched.
  • the position, so the accumulated value of the associated suffix string can be expressed as ha SA[i]+m , where m is the length of the pattern string to be matched.
  • step S303 the accumulated value of the matching tuple at the preset position in the preset number of matching tuples is searched in the second accumulated value set, and the preset number of matching elements are obtained according to the second hash tree.
  • step S304 the matching is successfully generated according to the current matching position, the preset number of matching tuples, the accumulated value of the related suffix string, the first sub-evidence, the accumulated value of the matching tuple at the preset position, and the second sub-evidence. Verify the evidence.
  • the expression formula of the verification evidence for matching success may be:
  • the cloud server obtains the verification evidence that the matching is successful according to the query data structure and the verifiable data structure associated with the text string, and can effectively improve the acquisition efficiency of the matching verification evidence.
  • step S104 the data access end determines whether the result of the successful matching is correct according to the to-be-matched pattern string, the verification evidence of the matching success, and the verification parameter associated with the text string.
  • the data access end completes the verification process of verifying the successful result according to the verification evidence sent by the cloud service, the pattern to be matched, the verification parameter pre-sent by the data terminal, and the public hash function, and the specific verification is performed.
  • the steps include:
  • the current matching position corresponds to the suffix string in the text string, indicating that the start character of the suffix string is the current matching position in the text string
  • pt' j (SA[i]+j-1
  • p is the pattern string to be matched. Then, the accumulated value ha' SA[i] of the suffix string is combined with the current matching position SA[i] to form a suffix tuple, and the first sub-evidence and the accumulated value of the first hash tree root node are verified. Whether the suffix tuple is correct. When the suffix tuple is correct, it can be determined that the current matching position is correct.
  • the cloud server may also obtain the verification evidence of the matching failure, and send the result of the matching failure and the verification evidence of the matching failure to the data access end, and the data The access end verifies that the result of the matching failure is correct according to the verification evidence of the matching failure.
  • the step of the cloud server obtaining the matching failure verification evidence includes:
  • the first suffix string and the second suffix string are respectively obtained in the text string.
  • the first suffix string and the second suffix string are adjacent to each other in the suffix array position.
  • the position of the first suffix string start character in the text string may be the position where the current match fails, and the different suffix strings correspond to different array elements in the suffix array, so the suffix array may be according to the first suffix string.
  • the suffix string corresponding to the next position array element is set as the second suffix string.
  • the longest common prefix length l 1 between the first suffix string and the to-be-matched pattern string is obtained, and the l 1 +1 characters in the first suffix string are searched in the text string.
  • the character is the character at the first relevant position, and the first related position can be expressed as SA[i]+l 1 .
  • the accumulated value of the suffix string corresponding to the next position of the first relevant position may be expressed as Finding a leaf node corresponding to the accumulated value in the first hash tree, and setting a path of the leaf node to the root node of the first hash tree as a third sub-evidence, specifically, the third sub-evidence includes a knot on the path The brother nodes of points and nodes.
  • obtaining a second suffix string to be the longest common prefix length l 2 between the pattern string matching to find the second suffix of string in text string l 2 +1 character, which is the character at the second relevant position, and the second related position can be expressed as SA[i]+l 2 .
  • the accumulated value of the suffix string corresponding to the next position of the second relevant position can be expressed as Finding a leaf node corresponding to the accumulated value in the first hash tree, and setting a path of the leaf node to the root node of the first hash tree as a fourth sub-evidence, specifically, the fourth sub-evidence includes a knot on the path The brother nodes of points and nodes.
  • the character at the first relevant position the accumulated value of the suffix string corresponding to the next position of the first relevant position, the third sub-evidence, the character at the second relevant position, and the second
  • the accumulated value of the suffix string corresponding to the next position of the relevant position and the fourth sub-evidence generate verification evidence that the matching fails.
  • the expression formula of the verification evidence of the matching failure may be:
  • proof' i is the third sub-evidence
  • proof' i+1 is the fourth sub-evidence
  • the cloud server sends the result of the matching failure and the verification evidence of the matching failure to the data access end.
  • the verification evidence of the matching failure is successfully obtained, which not only effectively improves the rate of verification evidence acquisition, but also effectively improves the verification evidence. Simplicity.
  • the data access end verifies that the result of the matching failure may include the following steps:
  • the data access end determines whether the positions of the first suffix string and the second suffix string in the suffix array are adjacent according to the verification evidence of the matching failure.
  • the expression formula of the first preset position may be p[l 1 +1], and the expression formula of the second preset position may be p[l 2 +1], where p is a pattern string to be matched. .
  • the data structure is constructed according to the text string at the data possession end, and the query data structure is adopted.
  • the hash function preprocesses the text string to obtain a verifiable data structure.
  • the query data structure and the verifiable data structure not only the data storage amount and the data operation amount of the cloud service are reduced, but also the cloud server obtains the matching result and the verification.
  • the efficiency of the evidence at the same time, the data owner sends a fixed-size verification parameter to the data access end, which effectively simplifies the verification process of the data access end verification matching result, and greatly improves the verification efficiency of the pattern string matching.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • FIG. 6 is a diagram showing a structure of a cloud service-based mode string matching verification apparatus according to Embodiment 2 of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown, including:
  • the mode string obtaining module 61 is configured to: when the cloud server receives the mode string matching query request of the data access end, acquire the pattern string to be matched in the mode string matching query request;
  • the pattern string matching module 62 is configured to: the cloud server matches the to-be-matched pattern string with the pre-stored text string;
  • the evidence obtaining module 63 is configured to: when the matching pattern string is successfully matched in the text string, the cloud server obtains the verification evidence of the matching success according to the query data structure and the verifiable data structure associated with the text string, and the matching result is successful.
  • the verification evidence of successful matching is sent to the data access end, and the data structure can be verified by the data owner to preprocess the text string through a preset hash function;
  • the verification module 64 is configured to determine, by the data access end, whether the result of the successful matching is correct according to the to-be-matched mode string, the verification evidence of the matching success, and the verification parameter associated with the text string.
  • the mode string matching verification apparatus may further include:
  • the query data obtaining module 71 is configured to generate, by the data possession end, a query data structure according to the text string, where the query data structure includes a suffix array of the text string and a longest common prefix array;
  • the verifiable data obtaining module 72 is configured to generate, by the data possessing end, a verifiable data structure according to the hash function, where the verifiable data structure includes a first accumulated value set, a second accumulated value set, a first hash tree, and Second hash tree;
  • the data owner sending module 73 is configured to send the query data structure and the verifiable data structure to the cloud server, and issue the hash function to the data access end, and the first hash tree root node and the second hash The accumulated value of the root node of the tree is set to the authentication parameter sent to the data access end.
  • the verifiable data acquisition module 72 comprises:
  • the first hash calculation module 721 is configured to calculate, according to the hash function, an accumulated value of each suffix string in the text string, and store the accumulated value of all the suffix strings in the first accumulated value set;
  • the first hash tree building module 722 is configured to generate, by the data owner, a plurality of suffix tuples according to the suffix array and the first accumulated value set, and construct a first hash tree according to the suffix array and obtain the first hash tree root.
  • the second hash calculation module 723 is configured to generate, by the data possession end, a plurality of matching tuples according to the suffix array and the longest common prefix array, and calculate an accumulated value of each matching tuple in the matched tuple set according to the hash function. And storing the accumulated values of all matching tuples in the second accumulated value set;
  • the second hash tree establishing module 724 is configured to: the data possessing end constructs the second hash tree according to the second accumulated value set and acquires the accumulated value of the second hash function root node.
  • the data structure is constructed according to the text string at the data possession end, and the text string is preprocessed by using a hash function to obtain a verifiable data structure, and the query data structure and the verifiable data structure are not reduced.
  • the amount of data storage and data computation of the cloud service improves the efficiency of the cloud server to obtain matching results and verify evidence.
  • the data owner sends a fixed-size verification parameter to the data access end, which effectively simplifies the data access end. Verifying the verification process of matching results greatly improves the verification efficiency of pattern string matching.
  • each unit of the cloud service-based mode string matching verification apparatus may be implemented by a corresponding hardware or software unit, and each unit may be an independent software and hardware unit, or may be integrated into one soft and hardware unit. This is not intended to limit the invention.
  • each unit reference may be made to the description of each step in the foregoing Embodiment 1, and details are not described herein again.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明适用计算机技术领域,提供了一种基于云服务的模式串匹配验证方法和装置,该方法包括:云服务器接收到数据访问端的模式串匹配查询请求时,获取待匹配模式串,并将待匹配模式串与预先存储的文本串匹配,当匹配成功时,云服务器根据文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,将匹配成功的结果和匹配成功的验证证据发送给数据访问端,可验证数据结构由数据拥有端通过预设的哈希函数对文本串进行预处理得到,数据访问端根据待匹配模式串、匹配成功的验证证据以及与文本串关联的验证参数,确定匹配成功的结果是否正确,从而减少云服务的数据存储量、简化数据访问端的验证过程,进而有效地提高模式串匹配的验证效率。

Description

一种基于云服务的模式串匹配验证方法及装置 技术领域
本发明属于计算机技术领域,尤其涉及一种基于云服务的模式串匹配验证方法及装置。
背景技术
模式串匹配是指在较长字符串中找到与给定较短字符串的所有子串的过程,已被广泛地用于垃圾邮箱过滤、入侵检测、防火墙过滤以及信息检索等领域,目前随着云技术的发展,越来越多的企业、个人出于方便管理和节约成本的考虑,将模式串匹配查询外包给云计算处理,但是这也导致用户失去了对数据和数据查询的控制权,引发了如何验证云端返回的查询结果是否正确、是否可靠的问题,即数据查询可验证问题。
现有技术中该问题的解决方案为云服务在得到匹配结果的同时生成验证证据,将匹配结果和验证证据一起发送给用户,用户再通过用于匹配查询的模式串、匹配结果和验证证据,来验证匹配结果是否正确。具体的实现方案主要有Martel et al.在2004年提出的可验证数据结构的通用解决方案和Papadopoulos et al.在2015年提出的实用的可验证模式串匹配Suffix Tree(后缀树)方案,但是第一种方案的验证证据较大,导致用户的验证效率较低,第二种方案云服务返回给用户的验证证据内容较为繁多、简洁度不够,同样导致用户的验证步骤较为繁杂。
发明内容
本发明的目的在于提供一种基于云服务的模式串匹配验证方法及装置,旨 在解决由于现有技术无法提供一种简洁有效的模式串匹配验证方法,导致外包给云服务的数据量过多、云服务返回给用户的验证证据内容过于繁多以及用户在验证云服务返回的匹配结果时验证效率较低的问题。
一方面,本发明提供了一种基于云服务的模式串匹配验证方法,所述方法包括下述步骤:
预设云服务器接收到数据访问端的模式串匹配查询请求时,获取所述模式匹配查询请求中的待匹配模式串;
所述云服务器将所述待匹配模式串与预先存储的文本串进行匹配;
当所述待匹配模式串在所述文本串中匹配成功时,所述云服务器根据所述文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将所述匹配成功的结果和所述匹配成功的验证证据发送给所述数据访问端,所述可验证数据结构由数据拥有端通过预设的哈希函数对所述文本串进行预处理得到;
所述数据访问端根据所述待匹配模式串、所述匹配成功的验证证据以及与所述文本串关联的验证参数,确定所述匹配成功的结果是否正确。
另一方面,本发明提供了一种基于云服务的模式串匹配验证装置,所述装置包括:
模式串获取模块,用于预设云服务器接收到数据访问端的模式串匹配查询请求时,获取所述模式串匹配查询请求中的待匹配模式串;
模式串匹配模块,用于所述云服务器将所述待匹配模式串与预先存储的文本串进行匹配;
证据获取模块,用于当所述待匹配模式串在所述文本串中匹配成功时,所述云服务器根据所述文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将所述匹配成功的结果和所述匹配成功的验证证据发送给所述数据访问端,所述可验证数据结构由数据拥有端通过预设的哈希函数对所述文本串进行预处理得到;以及
验证模块,用于所述数据访问端根据所述验证证据、所述匹配成功的验证证据以及与所述文本串关联的验证参数,确定所述匹配成功的结果是否正确。
本发明包括云服务器、数据访问端和数据拥有端三个执行主体,云服务器接收到数据访问端的模式串匹配串查询请求时,获取模式串匹配查询请求中的待匹配模式串,并将该待匹配模式串与预先存储的文本串进行匹配,当待匹配模式串与文本串匹配成功时,云服务器根据文本串关联的查询数据结构和可验证数据结果,获取匹配成功的结果所对应的验证证据,并将匹配成功的结果和验证证据发送给数据访问端,数据访问端再根据待匹配模式串、匹配成功的验证证据以及与文本串关联的验证参数,确定该匹配成功的结果是否正确,其中,可验证数据结构是由数据拥有端通过预设的哈希函数对文本串进行预处理得到的,从而通过在数据拥有端采用预设的哈希函数对文本串进行预处理,有效地简化了可验证数据结构,进而不仅大大减少可云服务的数据存储量和数据运算量,而且数据访问端也只需存储固定大小的验证参数,有效地提高了模式串匹配的验证效率。
附图说明
图1是本发明实施例一提供的基于云服务的模式串匹配验证方法实现流程图;
图2是本发明实施例一提供的基于云服务的模式串匹配验证方法中数据拥有端对文本串进行预处理的实现流程图;
图3是本发明实施例一提供的基于云服务的模式串匹配验证方法中查询数据结构中后缀数组的示例图;
图4是本发明实施例一提供的基于云服务的模式串匹配验证方法中查询数据结构中最长公共前缀数组的示例图;
图5是本发明实施例一提供的基于云服务的模式串匹配验证方法中获取匹配成功的验证证据的实现流程图;
图6是本发明实施例二提供的基于云服务的模式串匹配验证装置的结构示意图;以及
图7是本发明实施例二提供的基于云服务的模式串匹配验证装置的优选结构示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
以下结合具体实施例对本发明的具体实现进行详细描述:
实施例一:
图1示出了本发明实施例一提供的一种基于云服务的模式串匹配验证方法实现流程,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:
在步骤S101中,预设云服务器接收到数据访问端的模式串匹配查询请求时,获取模式匹配查询请求中的待匹配模式串。
在本发明实施例中,当用户需要进行模式串匹配查询时,可通过数据访问端向云服务器发送模式串匹配查询请求,以查询待匹配模式串在云服务器上的匹配结果并验证该匹配结果是否正确,其中,待匹配模式串为用户输入的待匹配内容。作为示例地,当通过模式串匹配进行垃圾邮箱过滤时,待匹配模式串可为一封邮件中的内容,当通过模式串匹配进行入侵检测时,待匹配模式串可为一串IP地址。
在步骤S102中,云服务器将待匹配模式串与预先存储的文本串进行匹配。
在本发明实施例中,将待匹配模式串与云服务器中预先存储的文本串在云服务器中进行匹配,该文本串为数据拥有端预先发送给云服务器的文本数据。作为示例地,当通过模式串匹配进行垃圾邮箱过滤时,文本串可为用于垃圾邮箱过滤的所有关键字组合而成的文本数据,当通过模式串匹配进行入侵检测时, 文本串可为经统计所有可能为入侵地址的IP地址组合而成的文本数据。
在步骤S103中,当待匹配模式串在文本串中匹配成功时,云服务器根据文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将匹配成功的结果和匹配成功的验证证据发送给数据访问端,可验证数据结构由数据拥有端通过预设的哈希函数对文本串进行预处理得到。
在本发明实施例中,当待匹配模式串在文本串中查找到一个匹配位置时,可认为待匹配模式串在文本串中匹配成功,此时,云服务器可根据与该文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据。
具体地,如图2所示,数据拥有端对文本串进行预处理,得到查询数据结构和可验证数据结构可通过以下步骤实现:
在步骤S201中,数据拥有端根据文本串,生成查询数据结构,查询数据结构包括文本串的后缀数组和最长公共前缀数组。
文本串被预先存储在数据拥有端,后缀数组中存储文本串中所有后缀字符串的开始字符在该文本串对应的位置,最长公共前缀数组用来存储后缀数组中当前位置的后缀字符串与上一位置的后缀字符串之间的最长公共前缀长度,因此在后缀数组和最长公共前缀数组中存储的数据都为整数数据,后缀数组和最长公共前缀数组作为查询数据结构可有效提高后续待匹配模式串与文本串的匹配过程。
作为示例地,可先获取文本串的所有后缀字符串,再将所有后缀字符串按照一定顺序(如按照字典顺序)进行排序,获取这些后缀字符串中开始字符在文本串中的位置,并将这些位置按照后缀字符串排序的顺序存储在后缀数组中,再根据后缀数组,构建最长公共前缀数组。图3示出了文本串为”suffix”时后缀数组的构建过程,图4示出了文本串为”suffix”时最长公共前缀数组的构建过程。如图3所示,S[i]为文本串,SFi为开始字符为文本串第i个字符的后缀字符串,SA[i]为后缀数组中第i个元素对应后缀字符串的开始字符在文本串中的位置,如图4所示,LCP[i]为后缀数组中第i个元素对应后缀字符串与第i-1个元素对 应后缀字符串的最长公共前缀长度。
在步骤S202中,数据拥有端根据哈希函数,生成可验证数据结构,可验证数据结构包括第一累加值集合、第二累加值集合、第一哈希树和第二哈希树。
在本发明实施例中,数据拥有端生成可验证数据结构的步骤可包括:
(1)数据拥有端通过哈希函数计算文本串中每个后缀字符串的累加值,并将所有后缀字符串的累加值存储在第一累加值集合中。
具体地,通过预设的哈希函数对文本串的每个后缀字符串进行哈希迭代运算,以获取每个后缀字符串的累加值,哈希迭代运算的公式可为:
hai=h(pti||h(pti+1||h(...h(ptn-1||h(ptn))))),1≤i≤n,其中,i为相应后缀字符串的开始字符在文本串中的位置,hai为第i个后缀字符串的累加值,h为哈希函数,pti为位置i与位置i在文本串对应的字符构成的连接字符串,n为文本串的字符长度,pti的计算公式为pti=(i||-||τ[i]),“||”为预设的字符连接运算符,“-”为预设的连接字符,τ表示文本串。因此,第一累加值集合可表示为HA(τ)={hai|1≤i≤n}。
(2)数据拥有端根据后缀数组和第一累加值集合,生成多个后缀元组,根据后缀数组,构建第一哈希树并获取第一哈希树根节点的累加值。
具体地,将后缀数组和第一累加值集合中的累加值一一对应,组合得到多个后缀元组,再将后缀元组按照后缀数组的顺序,从下至上构建第一哈希树,并可获得该第一哈希树根节点的累加值。其中,后缀数组中第i个元素对应的后缀元组可表示为ti=<i,haSA[i],SA[i]>,haSA[i]为文本串中开始字符位置为SA[i]的后缀字符串的累加值,第一哈希树的叶子节点的累加值为对应后缀元组的累加值。
(3)数据拥有端根据后缀数组和最长公共前缀数组,生成多个匹配元组,通过哈希函数计算匹配元组集合中每个匹配元组的累加值,并将所有匹配元组的累加值存储在第二累加值集合中。
具体地,后缀数组和最长公共前缀数组一一对应进行组合,可得到多个匹 配元组,该多个匹配元组包含了文本串与不同待匹配模板串进行匹配时所有可能出现的匹配位置。接着,采用哈希函数对每个匹配元组进行哈希迭代运算,以得到所有匹配元组对应的累加值。其中,匹配元组可表示为tli=<i,SA[i],LCP[i]>,1≤i≤n,哈希迭代运算的公式可为:
Hi=h(tli||h(tli+1||h(...h(tln-1||h(tln))))),1≤i≤n,其中,Hi为匹配元组tli对应的累加值。因此,第二累加值集合可表示为HL(LCP)={Hi|1≤i≤n}。
(4)数据拥有端根据第二累加值集合,构建第二哈希树并获取第二哈希树根节点的累加值。
具体地,将第二累加值集合按照一定顺序从下至上地构建第二哈希树,可获得该第一哈希树根节点的累加值。其中,第二哈希树叶子节点的累加值为对应匹配元组的累加值。
在步骤S203中,数据拥有端将查询数据结构和可验证数据结构给云服务器,并将哈希函数向数据访问端发布,将第一哈希树根节点和第二哈希树根节点的累加值设置为验证参数发送给数据访问端。
在本发明实施例中,数据拥有端通过上述方式对文本串进行预处理,得到查询数据结构和可验证数据结构,可有效减少云服务器的数据存储量并提高验证证据的获取效率,此外数据拥有端在对文本串预处理后得到的验证参数发送给数据访问端,使得数据访问段通过该固定大小的参数,即可完成匹配结果的验证过程,有效地提高了模式串匹配验证的效率。
如图3所示,步骤S103中云服务器根据文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据的步骤可包括:
在步骤S301中,获取待匹配模式串在文本串中的当前匹配位置,根据查询数据结构,获取预设数量个匹配元组,预设数量个匹配元组中包含待匹配模式串在文本串中所有匹配成功的匹配位置。
在本发明实施例中,可根据当前匹配位置和查询数据结构,查找出文本串中所有可以与待匹配模式串匹配成功的匹配位置,并通过匹配元组表示出来, 这里的匹配位置是指与待匹配模式串进行匹配的后缀字符串中开始字符在文本串中的位置,预设数量为匹配次数进行加一操作后得到的数值。
在具体实施过程中,可先确定当前匹配位置在最长公共前缀数组中对应的下标,从该下标开始往前后两端搜索该最长公共前缀数组,将最长公共前缀数组中的最长公共前缀长度与待匹配模式串长度进行比较,当最长公共前缀长度不小于待匹配模式串长度时,获取该最长公共前缀长度在后缀数组中对应的数组元素,进而可得到预设数量个对应的匹配元组,匹配元组的表达公式可为tlj=<j,SA[j],LCP[j]>,start≤j≤end,其中start和end分别表示匹配元组下标的开始位置和结束位置。
在步骤S302中,根据当前匹配位置和待匹配模式串,在第一累加值集合中查找相关后缀字符串的累加值,并根据第一哈希树,获取用于验证待匹配模式串是否存在于文本串中的证据,并将证据设置为第一子证据。
在本发明实施例中,当前匹配位置可通过后缀数组中数组元素SA[i]进行表示,根据当前匹配位置和待匹配模式串的长度之和可确定相关后缀字符串的开始字符在文本串中的位置,因此相关后缀字符串的累加值可表示为haSA[i]+m,m为待匹配模式串的长度。在获取第一子证据时,可先在第一累加值集合中查找当前匹配位置所对应后缀字符串的累加值,以获取对应的后缀元组ti=<i,haSA[i],SA[i]>,接着,在第一哈希树中查找该后缀元组哈希累加值所对应的叶子节点,将该叶子节点到根节点的路径设置为第一验证证据,具体地,第一验证证据中包含该叶子节点到根节点路径上的结点以及这些结点的兄弟结点。
在步骤S303中,在第二累加值集合中查找预设数量个匹配元组中预设位置处匹配元组的累加值,并根据第二哈希树,获取用于验证预设数量个匹配元组中开始位置处匹配元组是否真实的证据,并将证据设置为第二子证据。
在本发明实施例中,预设位置为预设数量个匹配元组中结束位置的下一位置,所以预设位置处匹配元组的累加值可表示为Hend+1,在获取第二子证据的过程中,可先在第二累加值集合中查找开始位置处匹配元组的累加值,接着,在 第二哈希树中查找该开始位置处匹配元组的累加值对应的叶子节点,将该叶子节点到第二哈希树根节点的路径设置为第二子证据,具体地,第二子证据可包括该路径上的结点和节点的兄弟结点。
在步骤S304中,根据当前匹配位置、预设数量个匹配元组、相关后缀字符串的累加值、第一子证据、预设位置处匹配元组的累加值以及第二子证据生成匹配成功的验证证据。
具体地,匹配成功的验证证据的表达公式可为:
pro(p)={i,SA[i],{tlj=<j,SA[j],LCP[j]>,start≤j≤end},haSA[i]+m,Hend+1,proofi,prooftl},其中,proofi为第一子证据,prooftl为第二字证据。
在本发明实施例中,云服务器根据文本串关联的查询数据结构和可验证数据结构,通过上述步骤获取匹配成功的验证证据,可有效地提高匹配成功的验证证据的获取效率。
在步骤S104中,数据访问端根据待匹配模式串、匹配成功的验证证据以及与文本串关联的验证参数,确定匹配成功的结果是否正确。
在本发明实施例中,数据访问端根据云服务发送过来的验证证据、待匹配模式串、数据终端预先发送的验证参数以及公开的哈希函数,完成验证匹配成功结果的验证过程,具体的验证步骤包括:
(1)根据待匹配模式串、哈希函数以及相关后缀字符串的累加值,计算当前匹配位置在文本串中所对应后缀字符串的累加值,并根据累加值、后缀数组、第一子证据以及第一哈希树根节点的累加值,确定当前匹配位置是否正确。
在本发明实施例中,当前匹配位置在文本串中与后缀字符串对应,表明该后缀字符串的开始字符在文本串的位置为当前匹配位置,计算该后缀字符串累加值的具体公式可为:ha'SA[i]=h(pt'1||h(pt'2||h(...h(pt'm||haSA[i])...))),
其中,pt'j的计算公式为pt'j=(SA[i]+j-1||-||p[j]),1≤j≤m,p为待匹配模式串。接着,将该后缀字符串的累加值ha'SA[i]与当前匹配位置SA[i]组合构成一个后缀元组,根据第一子证据和第一哈希树根节点的累加值,验证该后缀元组是否 正确,当该后缀元组正确时,可确定当前匹配位置正确。
(2)根据待匹配模式串、哈希函数以及预设位置处匹配元组的累加值,计算预设数量个匹配元组中开始位置处匹配元组的累加值,并根据累加值、第二子证据以及第二哈希树根节点的累加值,确定预设数量个匹配元组包含的所有匹配位置中剩余匹配位置是否正确。
在本发明实施例中,预设数量个匹配元组中开始位置处匹配元组tlstart的累加值计算公式为:H'start=h(tlstart||h(tlstart+1||h(...h(tlend||Hend+1)...))),其中Hend+1为预设位置处匹配元组的累加值。接着,根据开始位置处匹配元组tlstart、第二子证据以及第二哈希树根节点的累加值,确定预设数量个匹配元组包含的所有匹配位置中剩余匹配位置是否正确。
(3)当确定当前匹配位置和剩余匹配位置正确时,确定匹配成功的结果正确。
优选地,当待匹配模式串与文本串在云服务器中匹配失败时,云服务器同样可获取到匹配失败的验证证据,并将匹配失败的结果和匹配失败的验证证据发送给数据访问端,数据访问端根据该匹配失败的验证证据,可验证该匹配失败的结果是否正确。
在本发明实施例中,云服务器获取匹配失败验证证据的步骤包括:
(1)当待匹配模式串与文本串匹配失败时,根据待匹配模式串在文本串中当前匹配失败的位置和后缀数组,分别获取第一后缀字符串和第二后缀字符串在文本串所对应的位置,第一后缀字符串和第二后缀字符串在后缀数组中位置前后相邻。
具体地,第一后缀字符串开始字符在文本串中的位置可为当前匹配失败的位置,根据不同后缀字符串在后缀数组中对应不同的数组元素,因此可根据第一后缀字符串在后缀数组中对应数组元素的位置,将下一位置数组元素对应的后缀字符串设置为第二后缀字符串。
(2)根据第一后缀字符串和待匹配模式串,获取文本串中第一相关位置处 的字符,在第一累加值集合中查找第一相关位置的下一位置所对应后缀字符串的累加值,并根据第一哈希树,获取用于验证第一后缀字符串存在于文本串中的第三子证据。
在本发明实施例中,获取第一后缀字符串与待匹配模式串之间的最长公共前缀长度l1,在文本串中查找该第一后缀字符串中的第l1+1个字符,该字符即为第一相关位置处的字符,第一相关位置可表示为SA[i]+l1。第一相关位置的下一位置所对应后缀字符串的累加值可表示为
Figure PCTCN2016108364-appb-000001
在第一哈希树中查找该累加值对应的叶子节点,将该叶子节点到第一哈希树根节点的路径设置为第三子证据,具体地,第三子证据包括该路径上的结点和结点的兄弟结点。
(3)根据第二后缀字符串和待匹配模式串,获取文本串中第二相关位置处的字符,在第一累加值集合中查找第二相关位置的下一位置所对应后缀字符串的累加值,并根据第一哈希树,获取用于验证第二后缀字符串存在于文本串中的第四子证据。
在本发明实施例中,同上述步骤一样,获取第二后缀字符串与待匹配模式串之间的最长公共前缀长度l2,在文本串中查找该第二后缀字符串中的第l2+1个字符,该字符即为第二相关位置处的字符,第二相关位置可表示为SA[i]+l2。第二相关位置的下一位置所对应后缀字符串的累加值可表示为
Figure PCTCN2016108364-appb-000002
在第一哈希树中查找该累加值对应的叶子节点,将该叶子节点到第一哈希树根节点的路径设置为第四子证据,具体地,第四子证据包括该路径上的结点和结点的兄弟结点。
(5)根据当前匹配失败的位置、第一相关位置处的字符、第一相关位置的下一位置所对应后缀字符串的累加值、第三子证据、第二相关位置处的字符、第二相关位置的下一位置所对应后缀字符串的累加值和第四子证据,生成匹配失败的验证证据。
具体地,匹配失败的验证证据的表达公式可为:
Figure PCTCN2016108364-appb-000003
其中,proof'i为第三子证据,proof'i+1为第四子证据。
(5)云服务器将匹配失败的结果和匹配失败的验证证据发送给数据访问端。在本发明实施例中,根据后缀数组、第一累加值集合以及第一哈希树,成功获取到匹配失败的验证证据,不仅有效地提高了验证证据获取的速率,而且有效地提高了验证证据的简洁度。
在本发明实施例中,数据访问端验证匹配失败的结果可包括下述步骤:
(1)数据访问端根据匹配失败的验证证据,确定第一后缀字符串和第二后缀字符串在后缀数组中的位置是否相邻。
(2)当第一后缀字符串与第二后缀字符串位置相邻时,将第一相关位置处的字符与待匹配模式串中第一预设位置处的字符进行比较,以确定第一后缀字符串是否小于待匹配模式串,将第二相关位置处的字符与待匹配字符串中第二预设位置处的字符进行比较,以确定第二后缀字符串是否大于待匹配模式串。
在本发明实施例中,第一预设位置的表达公式可为p[l1+1],第二预设位置的表达公式可为p[l2+1],其中p为待匹配模式串。
(3)当确定第一后缀字符串小于待匹配模式串、且第二后缀字符串大于待匹配模式串时,根据哈希函数、第一相关位置的下一位置所对应后缀字符串的累加值以及第二相关位置的下一位置所对应后缀字符串的累加值,分别计算第一后缀字符串、第二后缀字符串的累加值。
(4)根据第三子证据和第一哈希树根节点的累加值,确定第一后缀字符串是否存在于文本串中,根据第四子证据和第一哈希树根节点的累加值,确定第二后缀字符串是否存在于在文本串中。
(5)当确定第一后缀字符串和第二后缀字符串都存在于文本串中时,确定待匹配模式串与文本串匹配失败。
在本发明实施例中,在数据拥有端根据文本串构建查询数据结构,并采用 哈希函数对文本串进行预处理得到可验证数据结构,通过该查询数据结构和可验证数据结构,不仅减少了云服务的数据存储量和数据运算量,而且提高了云服务器获取匹配结果和验证证据的效率,与此同时,数据拥有端发送给数据访问端固定大小的验证参数,有效地简化了数据访问端验证匹配结果的验证过程,大大地提高了模式串匹配的验证效率。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可读取存储介质中,所述的存储介质,如ROM/RAM、磁盘、光盘等。
实施例二:
图6示出了本发明实施例二提供的一种基于云服务的模式串匹配验证装置的结构,为了便于说明,仅示出了与本发明实施例相关的部分,其中包括:
模式串获取模块61,用于预设云服务器接收到数据访问端的模式串匹配查询请求时,获取模式串匹配查询请求中的待匹配模式串;
模式串匹配模块62,用于云服务器将待匹配模式串与预先存储的文本串进行匹配;
证据获取模块63,用于当待匹配模式串在文本串中匹配成功时,云服务器根据文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将匹配成功的结果和匹配成功的验证证据发送给数据访问端,可验证数据结构由数据拥有端通过预设的哈希函数对文本串进行预处理得到;以及
验证模块64,用于数据访问端根据待匹配模式串、匹配成功的验证证据以及与文本串关联的验证参数,确定匹配成功的结果是否正确。
在本发明实施例中,如图7所示,该模式串匹配验证装置还可以包括:
查询数据获取模块71,用于数据拥有端根据文本串,生成查询数据结构,查询数据结构包括文本串的后缀数组和最长公共前缀数组;
可验证数据获取模块72,用于数据拥有端根据哈希函数,生成可验证数据结构,可验证数据结构包括第一累加值集合、第二累加值集合、第一哈希树和 第二哈希树;以及
数据拥有端发送模块73,用于数据拥有端将查询数据结构和可验证数据结构发送给云服务器,并将哈希函数向数据访问端发布,将第一哈希树根节点和第二哈希树根节点的累加值设置为验证参数发送给数据访问端。
优选地,可验证数据获取模块72包括:
第一哈希计算模块721,用于数据拥有端根据哈希函数,计算文本串中每个后缀字符串的累加值,并将所有后缀字符串的累加值存储在第一累加值集合中;
第一哈希树构建模块722,用于数据拥有端根据后缀数组和第一累加值集合,生成多个后缀元组,并根据后缀数组,构建第一哈希树并获取第一哈希树根节点的累加值;
第二哈希计算模块723,用于数据拥有端根据后缀数组和最长公共前缀数组,生成多个匹配元组,根据哈希函数,计算匹配元组集合中每个匹配元组的累加值,并将所有匹配元组的累加值存储在第二累加值集合中;以及
第二哈希树建立模块724,用于数据拥有端根据第二累加值集合,构建第二哈希树并获取第二哈希函数根节点的累加值。
在本发明实施例中,在数据拥有端根据文本串构建查询数据结构,并采用哈希函数对文本串进行预处理得到可验证数据结构,通过该查询数据结构和可验证数据结构,不仅减少了云服务的数据存储量和数据运算量,而且提高了云服务器获取匹配结果和验证证据的效率,与此同时,数据拥有端发送给数据访问端固定大小的验证参数,有效地简化了数据访问端验证匹配结果的验证过程,大大地提高了模式串匹配的验证效率。
在本发明实施例中,基于云服务的模式串匹配验证装置的各单元可由相应的硬件或软件单元实现,各单元可以为独立的软、硬件单元,也可以集成为一个软、硬件单元,在此不用以限制本发明。各单元的具体实施方式可参考前述实施例一中各步骤的描述,在此不再赘述。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (10)

  1. 一种基于云服务的模式串匹配验证方法,其特征在于,所述方法包括:
    预设云服务器接收到数据访问端的模式串匹配查询请求时,获取所述模式匹配查询请求中的待匹配模式串;
    所述云服务器将所述待匹配模式串与预先存储的文本串进行匹配;
    当所述待匹配模式串在所述文本串中匹配成功时,所述云服务器根据所述文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将所述匹配成功的结果和所述匹配成功的验证证据发送给所述数据访问端,所述可验证数据结构由数据拥有端通过预设的哈希函数对所述文本串进行预处理得到;
    所述数据访问端根据所述待匹配模式串、所述匹配成功的验证证据以及与所述文本串关联的验证参数,确定所述匹配成功的结果是否正确。
  2. 如权利要求1所述的方法,其特征在于,数据访问端接收到模式串匹配查询请求之前,所述方法还包括:
    所述数据拥有端根据所述文本串,生成所述查询数据结构,所述查询数据结构包括所述文本串的后缀数组和最长公共前缀数组;
    所述数据拥有端根据所述哈希函数,生成所述可验证数据结构,所述可验证数据结构包括第一累加值集合、第二累加值集合、第一哈希树和第二哈希树;
    所述数据拥有端将所述查询数据结构和所述可验证数据结构发送给所述云服务器,并将所述哈希函数向所述数据访问端发布,将所述第一哈希树和所述第二哈希树根节点的累加值设置为所述验证参数并发送给所述数据访问端。
  3. 如权利要求2所述的方法,其特征在于,所述数据拥有端根据所述哈希函数,生成所述可验证数据结构的步骤,包括:
    所述数据拥有端通过所述哈希函数计算所述文本串中每个后缀字符串的累加值,并将所述所有后缀字符串的累加值存储在所述第一累加值集合中;
    所述数据拥有端根据所述后缀数组和所述第一累加值集合,生成多个后缀 元组,根据所述后缀数组,构建所述第一哈希树并获取所述第一哈希树根节点的累加值;
    所述数据拥有端根据所述后缀数组和所述最长公共前缀数组,生成多个匹配元组,通过所述哈希函数计算所述匹配元组集合中每个匹配元组的累加值,并将所述所有匹配元组的累加值存储在所述第二累加值集合中;
    所述数据拥有端根据所述第二累加值集合,构建所述第二哈希树并获取所述第二哈希树根节点的累加值。
  4. 如权利要求3所述的方法,其特征在于,当所述待匹配模式串在所述文本串中匹配成功时,所述云服务器根据所述文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据的步骤,包括:
    获取所述待匹配模式串在所述文本串中的当前匹配位置,根据所述查询数据结构,获取预设数量个匹配元组,所述预设数量个匹配元组中包含所述待匹配模式串在所述文本串中所有匹配成功的匹配位置;
    根据所述当前匹配位置和所述待匹配模式串,在所述第一累加值集合中查找相关后缀字符串的累加值,并根据所述第一哈希树,获取用于验证所述待匹配模式串是否存在于所述文本串中的证据,将所述证据设置为第一子证据;
    在所述第二累加值集合中查找所述预设数量个匹配元组中预设位置处匹配元组的累加值,并根据所述第二哈希树,获取用于验证所述预设数量个匹配元组中开始位置处匹配元组是否真实的证据,并将所述证据设置为第二子证据;
    根据所述当前匹配位置、预设数量个匹配元组、相关后缀字符串的累加值、第一子证据、预设位置处匹配元组的累加值以及所述第二子证据,生成所述匹配成功的验证证据。
  5. 如权利要求4所述的方法,其特征在于,所述数据访问端根据所述待匹配模式串、所述匹配成功的验证证据以及与所述文本串关联的验证参数,确定所述匹配成功的结果是否正确的步骤,包括:
    根据所述待匹配模式串、所述哈希函数以及所述相关后缀字符串的累加值, 计算所述当前匹配位置在所述文本串中所对应后缀字符串的累加值,通过所述累加值、后缀数组、所述第一子证据以及所述第一哈希树根节点的累加值,确定所述当前匹配位置是否正确;
    根据所述待匹配模式串、所述哈希函数以及所述预设位置处匹配元组的累加值,计算所述预设数量个匹配元组中开始位置处匹配元组的累加值,并根据所述累加值、所述第二子证据以及所述第二哈希树根节点的累加值,确定所述预设数量个匹配元组包含的所有匹配位置中剩余匹配位置是否正确;
    当确定所述当前匹配位置和所述剩余匹配位置正确时,确定所述匹配成功的结果正确。
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:
    当所述待匹配模式串与所述文本串匹配失败时,获取所述待匹配模式串在所述文本串中当前匹配失败的位置;
    根据所述当前匹配失败的位置和所述后缀数组,分别获取第一后缀字符串和第二后缀字符串在所述文本串所对应的位置,所述第一后缀字符串和所述第二后缀字符串在所述后缀数组中位置前后相邻;
    根据所述第一后缀字符串和所述待匹配模式串,获取所述文本串中第一相关位置处的字符,在所述第一累加值集合中查找所述第一相关位置的下一位置所对应后缀字符串的累加值,并根据所述第一哈希树,获取用于验证所述第一后缀字符串存在于所述文本串中的第三子证据;
    根据所述第二后缀字符串和所述待匹配模式串,获取所述文本串中第二相关位置处的字符,在所述第一累加值集合中查找所述第二相关位置的下一位置所对应后缀字符串的累加值,并根据所述第一哈希树,获取用于验证所述第二后缀字符串存在于所述文本串中的第四子证据;
    根据所述当前匹配失败的位置、所述第一相关位置处的字符、所述第一相关位置的下一位置所对应后缀字符串的累加值、所述第三证据、所述第二相关位置处的字符、所述第二相关位置的下一位置所对应后缀字符串的累加值和所 述第四证据,生成匹配失败的验证证据;
    所述云服务器将所述匹配失败的结果和所述匹配失败的验证证据发送给所述数据访问端。
  7. 如权利要求6所述的方法,其特征在于,所述方法还包括:
    所述数据访问端根据所述匹配失败的验证证据,确定所述第一后缀字符串和所述第二后缀字符串在所述后缀数组中的位置是否相邻;
    当所述第一后缀字符串与所述第二后缀字符串位置相邻时,将所述第一相关位置处的字符与所述待匹配模式串中第一预设位置处的字符进行比较,以确定所述第一后缀字符串是否小于所述待匹配模式串,将所述第二相关位置处的字符与所述待匹配字符串中第二预设位置处的字符进行比较,以确定所述第二后缀字符串是否大于所述待匹配模式串;
    当确定所述第一后缀字符串小于所述待匹配模式串、且所述第二后缀字符串大于所述待匹配模式串时,根据所述哈希函数、所述第一相关位置的下一位置所对应后缀字符串的累加值以及所述第二相关位置的下一位置所对应后缀字符串的累加值,分别计算所述第一后缀字符串、所述第二后缀字符串的累加值;
    根据所述第三子证据和所述第一哈希树根节点的累加值,确定所述第一后缀字符串是否存在于所述文本串中,根据所述第四子证据和所述第以哈希树根节点的累加值,确定所述第二后缀字符串是否存在于在所述文本串中;
    当确定所述第一后缀字符串和所述第二后缀字符串都存在于所述文本串中时,确定所述待匹配模式串与所述文本串匹配失败。
  8. 一种基于云服务的模式串匹配验证装置,其特征在于,所述装置包括:
    模式串获取模块,用于预设云服务器接收到数据访问端的模式串匹配查询请求时,获取所述模式串匹配查询请求中的待匹配模式串;
    模式串匹配模块,用于所述云服务器将所述待匹配模式串与预先存储的文本串进行匹配;
    证据获取模块,用于当所述待匹配模式串在所述文本串中匹配成功时,所 述云服务器根据所述文本串关联的查询数据结构和可验证数据结构,获取匹配成功的验证证据,并将所述匹配成功的结果和所述匹配成功的验证证据发送给所述数据访问端,所述可验证数据结构由数据拥有端通过预设的哈希函数对所述文本串进行预处理得到;以及
    验证模块,用于所述数据访问端根据所述待匹配模式串、所述匹配成功的验证证据以及与文本串关联的验证参数,确定所述匹配成功的结果是否正确。
  9. 如权利要求8所述的装置,其特征在于,所述装置还包括:
    查询数据获取模块,用于所述数据拥有端根据所述文本串,生成所述查询数据结构,所述查询数据结构包括所述文本串的后缀数组和最长公共前缀数组;
    可验证数据获取模块,用于所述数据拥有端根据所述哈希函数,生成所述可验证数据结构,所述可验证数据结构包括第一累加值集合、第二累加值集合、第一哈希树和第二哈希树;以及
    数据拥有端发送模块,用于所述数据拥有端将所述查询数据结构和所述可验证数据结构发送给所述云服务器,并将所述哈希函数向所述数据访问端发布,将所述第一哈希树根节点和所述第二哈希树根节点的累加值设置为所述验证参数并发送给所述数据访问端。
  10. 如权利要求9所述的装置,其特征在于,所述可验证数据获取模块包括:
    第一哈希计算模块,用于所述数据拥有端通过所述哈希函数计算所述文本串中每个后缀字符串的累加值,并将所述所有后缀字符串的累加值存储在所述第一累加值集合中;
    第一哈希树构建模块,用于所述数据拥有端根据所述后缀数组和所述第一累加值集合,生成多个后缀元组,根据所述后缀数组,构建所述第一哈希树并获取所述第一哈希树根节点的累加值;
    第二哈希计算模块,用于所述数据拥有端根据所述后缀数组和所述最长公共前缀数组,生成多个匹配元组,通过所述哈希函数计算所述匹配元组集合中 每个匹配元组的累加值,并将所述所有匹配元组的累加值存储在所述第二累加值集合中;以及
    第二哈希树建立模块,用于所述数据拥有端根据所述第二累加值集合,构建所述第二哈希树并获取所述第二哈希函数根节点的累加值。
PCT/CN2016/108364 2016-11-23 2016-12-02 一种基于云服务的模式串匹配验证方法及装置 WO2018094764A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611046778.1A CN106776791B (zh) 2016-11-23 2016-11-23 一种基于云服务的模式串匹配验证方法及装置
CN201611046778.1 2016-11-23

Publications (1)

Publication Number Publication Date
WO2018094764A1 true WO2018094764A1 (zh) 2018-05-31

Family

ID=58975534

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/108364 WO2018094764A1 (zh) 2016-11-23 2016-12-02 一种基于云服务的模式串匹配验证方法及装置

Country Status (2)

Country Link
CN (1) CN106776791B (zh)
WO (1) WO2018094764A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815723A (zh) * 2019-02-28 2019-05-28 东北大学 一种基于后缀树的可搜索加密系统及方法
CN111125313A (zh) * 2019-12-24 2020-05-08 武汉轻工大学 文本相同内容查询方法、装置、设备及存储介质
CN111159362A (zh) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 文本匹配处理方法及装置
CN112100616A (zh) * 2020-09-14 2020-12-18 北京天空卫士网络安全技术有限公司 一种监控方法和装置
CN115859380A (zh) * 2023-02-28 2023-03-28 深圳市大恒数据安全科技有限责任公司 一种电子数据固证关联方法
CN116070281A (zh) * 2023-04-06 2023-05-05 睿至科技集团有限公司 一种云管平台的数据存储方法及其系统
CN117113436A (zh) * 2023-10-16 2023-11-24 中电科大数据研究院有限公司 一种基于区块链的数据可信确权方法和装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018232554A1 (zh) * 2017-06-19 2018-12-27 深圳大学 模式串匹配验证方法、装置、设备及存储介质
CN109460495B (zh) * 2018-11-07 2022-05-10 南京烽火星空通信发展有限公司 一种基于改进bm算法与后缀数组的冗余字段过滤方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102938767A (zh) * 2012-11-13 2013-02-20 西安电子科技大学 基于云数据外包系统的高效可验证的模糊关键词搜索方法
CN104052740A (zh) * 2014-05-22 2014-09-17 西安理工大学 云存储中可验证的基于词典的可搜索加密方法
CN104102714A (zh) * 2014-07-16 2014-10-15 上海交通大学 基于累加器和布隆过滤器的外包数据查询验证方法及系统
CN104394155A (zh) * 2014-11-27 2015-03-04 暨南大学 可验证完整性和完备性的多用户云加密关键字搜索方法
CN104536984A (zh) * 2014-12-08 2015-04-22 北京邮电大学 一种外包数据库中的空间文本Top-k查询的验证方法及系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8170352B2 (en) * 2008-03-24 2012-05-01 Sophos Plc String searching facility
US8429421B2 (en) * 2010-12-17 2013-04-23 Microsoft Corporation Server-side encrypted pattern matching
CN103984728B (zh) * 2014-05-16 2017-02-01 西安交通大学 用于外包空间数据库的范围查询完整性验证方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102938767A (zh) * 2012-11-13 2013-02-20 西安电子科技大学 基于云数据外包系统的高效可验证的模糊关键词搜索方法
CN104052740A (zh) * 2014-05-22 2014-09-17 西安理工大学 云存储中可验证的基于词典的可搜索加密方法
CN104102714A (zh) * 2014-07-16 2014-10-15 上海交通大学 基于累加器和布隆过滤器的外包数据查询验证方法及系统
CN104394155A (zh) * 2014-11-27 2015-03-04 暨南大学 可验证完整性和完备性的多用户云加密关键字搜索方法
CN104536984A (zh) * 2014-12-08 2015-04-22 北京邮电大学 一种外包数据库中的空间文本Top-k查询的验证方法及系统

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JIANG, SHUNRONG ET AL.: "Publicly Verifiable Boolean Query Over Outsourced Encrypted Data", GLOBAL COMMUNICATIONS CONFERENCE (GLOBECOM, 2015, XP032872961, [retrieved on 20160225], DOI: doi:10.1109/GLOCOM.2014.7417807 *
ZHANG, LIXIANG: "The String Pattern Searching Algorithms Based on Suffix Arrays", CHINA MASTER'S THESES FULL-TEXT DATABASE, 31 December 2011 (2011-12-31) *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815723A (zh) * 2019-02-28 2019-05-28 东北大学 一种基于后缀树的可搜索加密系统及方法
CN111125313A (zh) * 2019-12-24 2020-05-08 武汉轻工大学 文本相同内容查询方法、装置、设备及存储介质
CN111125313B (zh) * 2019-12-24 2023-12-01 武汉轻工大学 文本相同内容查询方法、装置、设备及存储介质
CN111159362A (zh) * 2019-12-31 2020-05-15 奇安信科技集团股份有限公司 文本匹配处理方法及装置
CN111159362B (zh) * 2019-12-31 2024-04-26 奇安信科技集团股份有限公司 文本匹配处理方法及装置
CN112100616A (zh) * 2020-09-14 2020-12-18 北京天空卫士网络安全技术有限公司 一种监控方法和装置
CN112100616B (zh) * 2020-09-14 2024-05-28 北京天空卫士网络安全技术有限公司 一种监控方法和装置
CN115859380A (zh) * 2023-02-28 2023-03-28 深圳市大恒数据安全科技有限责任公司 一种电子数据固证关联方法
CN116070281A (zh) * 2023-04-06 2023-05-05 睿至科技集团有限公司 一种云管平台的数据存储方法及其系统
CN116070281B (zh) * 2023-04-06 2023-08-01 睿至科技集团有限公司 一种云管平台的数据存储方法及其系统
CN117113436A (zh) * 2023-10-16 2023-11-24 中电科大数据研究院有限公司 一种基于区块链的数据可信确权方法和装置
CN117113436B (zh) * 2023-10-16 2024-01-26 中电科大数据研究院有限公司 一种基于区块链的数据可信确权方法和装置

Also Published As

Publication number Publication date
CN106776791A (zh) 2017-05-31
CN106776791B (zh) 2019-12-10

Similar Documents

Publication Publication Date Title
WO2018094764A1 (zh) 一种基于云服务的模式串匹配验证方法及装置
US10073916B2 (en) Method and system for facilitating terminal identifiers
KR102238681B1 (ko) 데이터 인증을 위한 서명 정보 생성 및 검증 방법과 이를 위한 시스템
US11507569B2 (en) Methods for extending a proof-of-space-time blockchain
KR20210003234A (ko) 분할된 블록체인 네트워크에서 블록체인의 블록을 유지하는 것
CN111209591B (zh) 一种按时间排序的存储结构与快速查询的方法
WO2014108004A1 (zh) 一种微博用户身份识别方法及系统
WO2020151319A1 (zh) 密码校验方法、装置、计算机设备及存储介质
WO2022217926A1 (zh) 一种图像查找方法、区块链、云服务器及图像查找装置
US8316417B2 (en) Method for dynamic secure management of an authenticated relational table in a database
WO2021108258A1 (en) Optimizations for verification of interactions system and method using probability density functions
CN106991148B (zh) 一种支持全更新操作的数据库验证系统及方法
CN103324886B (zh) 一种网络攻击检测中指纹库的提取方法和系统
KR20220010534A (ko) 작업 증명 블록체인 네트워크 상의 비병렬식 채굴용 시스템 및 방법
Xu et al. Efficient and lightweight data streaming authentication in industrial control and automation systems
Miao et al. Verifiable data streaming protocol supporting update history queries
CN104125254B (zh) 获取平台用户资料的方法和系统
CN117194418A (zh) 可验证的多模态时空数据索引结构和时空范围查询验证方法
KR101593674B1 (ko) 검증 가능한 데이터 관리 방법 및 시스템
CN113535803B (zh) 一种基于关键字索引的区块链高效检索及可靠性验证方法
JP2024505105A (ja) データベースクエリ結果を検証するための方法及びそのデバイス
CN115310137A (zh) 一种智能结算系统的保密方法及相关装置
CN109800235B (zh) 一种基于认证树的外包数据库全操作查询验证系统及方法
US11750392B1 (en) Authenticated index data structure with back-pointers
CN115048432A (zh) 基于布隆过滤器的模糊关键词公共审计方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16922102

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16922102

Country of ref document: EP

Kind code of ref document: A1