Computationally Secure Pattern Matching in the Presence of Malicious Adversaries

  • Carmit Hazay
  • Tomas Toft
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6477)


We propose a dedicated protocol for the highly motivated problem of secure two-party pattern matching: Alice holds a text t ∈ {0,1}*. of length n, while Bob has a pattern p ∈ {0,1}*. of length m. The goal is for Bob to learn where his pattern occurs in Alice’s text. Our construction guarantees full simulation in the presence of malicious, polynomial-time adversaries (assuming that ElGamal encryption is semantically secure) and exhibits computation and communication costs of O(n + m) in a constant round complexity.

In addition to the above, we propose a collection of protocols for variations of the secure pattern matching problem: The pattern may contain wildcards (O(nm) communication in O(1) rounds). The matches may be approximated, i.e., Hamming distance less than some threshold ((O(nm) communication in O(1) rounds). The length, m, of Bob’s pattern is secret (O(nm) communication in O(1) rounds). The length, n, of Alice’s text is secret (O(n + m) communication in O(1) rounds).


Pattern matching secure two-party computation full simulation malicious adversary 


  1. [ACF02]
    Abe, M., Cramer, R., Fehr, S.: Non-interactive distributed-verifier proofs and proving relations among commitments. In: Zheng, Y. (ed.) ASIACRYPT 2002. LNCS, vol. 2501, pp. 206–223. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. [ACR99]
    Allauzen, C., Crochemore, M., Raffinot, M.: Factor oracle: A new structure for pattern matching. In: Bartosek, M., Tel, G., Pavelka, J. (eds.) SOFSEM 1999. LNCS, vol. 1725, pp. 295–310. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  3. [ALP00]
    Amir, A., Lewenstein, M., Porat, E.: Faster algorithms for string matching with mismatches. In: SODA, San Francisco, California, USA, pp. 794–803 (2000)Google Scholar
  4. [AMP04]
    Aggarwal, G., Mishra, N., Pinkas, B.: Secure computation of the k’th-ranked element. In: Cachin, C., Camenisch, J.L. (eds.) EUROCRYPT 2004. LNCS, vol. 3027, pp. 40–55. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  5. [Bea92]
    Beaver, D.: Foundations of secure interactive computing. In: Feigenbaum, J. (ed.) CRYPTO 1991. LNCS, vol. 576, pp. 377–391. Springer, Heidelberg (1992)Google Scholar
  6. [Blo70]
    Bloom, B.H.: Space/time trade-offs in hash coding with allowable errors. Commun. ACM 13(7), 422–426 (1970)MATHCrossRefGoogle Scholar
  7. [BM77]
    Boyer, R.S., Strother Moore, J.: A fast string searching algorithm. Commun. ACM 20(10), 762–772 (1977)CrossRefGoogle Scholar
  8. [Bra05]
    Brandt, F.: Efficient cryptographic protocol design based on distributed el gamal encryption. In: Won, D.H., Kim, S. (eds.) ICISC 2005. LNCS, vol. 3935, pp. 32–47. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  9. [Can00]
    Canetti, R.: Security and composition of multi-party cryptographic protocols. Journal of Cryptology 13, 143–202 (2000)MATHCrossRefMathSciNetGoogle Scholar
  10. [CGS97]
    Cramer, R., Gennaro, R., Schoenmakers, B.: A secure and optimally efficient multi-authority election scheme. In: Fumy, W. (ed.) EUROCRYPT 1997. LNCS, vol. 1233, pp. 103–118. Springer, Heidelberg (1997)Google Scholar
  11. [CP93]
    Chaum, D., Pedersen, T.P.: Wallet databases with observers. In: Brickell, E.F. (ed.) CRYPTO 1992. LNCS, vol. 740, pp. 89–105. Springer, Heidelberg (1993)Google Scholar
  12. [DH76]
    Diffie, W., Hellman, M.E.: New directions in cryptography. IEEE Transactions on Information Theory 22(6), 644–654 (1976)MATHCrossRefMathSciNetGoogle Scholar
  13. [ElG85]
    ElGamal, T.: A public key cryptosystem and a signature scheme based on discrete logarithms. IEEE Transactions on Information Theory 31(4), 469–472 (1985)MATHCrossRefMathSciNetGoogle Scholar
  14. [FNP04]
    Freedman, M.J., Nissim, K., Pinkas, B.: Efficient private matching and set-intersection. In: Cachin, C., Camenisch, J.L. (eds.) EUROCRYPT 2004. LNCS, vol. 3027, pp. 1–19. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  15. [GHS10]
    Gennaro, R., Hazay, C., Sorensen, J.S.: Automata evaluation and text search protocols with simulation based security. In: Nguyen, P.Q., Pointcheval, D. (eds.) PKC 2010. LNCS, vol. 6056, pp. 145–160. Springer, Heidelberg (2010)Google Scholar
  16. [GL91]
    Goldwasser, S., Levin, L.A.: Fair computation of general functions in presence of immoral majority. In: Menezes, A., Vanstone, S.A. (eds.) CRYPTO 1990. LNCS, vol. 537, pp. 77–93. Springer, Heidelberg (1991)Google Scholar
  17. [GMW87]
    Goldreich, O., Micali, S., Wigderson, A.: How to play any mental game. In: Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing, STOC 1987, pp. 218–229. ACM, New York (1987)CrossRefGoogle Scholar
  18. [Gol04]
    Goldreich, O.: Foundations of Cryptography: Basic Applications, vol. 2. Cambridge University Press, New York (2004)MATHGoogle Scholar
  19. [Gro03]
    Groth, J.: A verifiable secret shuffle of homomorphic encryptions. In: Desmedt, Y.G. (ed.) PKC 2003. LNCS, vol. 2567, pp. 145–160. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  20. [HL08]
    Hazay, C., Lindell, Y.: Efficient protocols for set intersection and pattern matching with security against malicious and covert adversaries. In: Canetti, R. (ed.) TCC 2008. LNCS, vol. 4948, pp. 155–175. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  21. [IR07]
    Iliopoulos, C.S., Sohel Rahman, M.: Pattern matching algorithms with don’t cares. In: van Leeuwen, J., Italiano, G.F., van der Hoek, W., Meinel, C., Sack, H., Plášil, F. (eds.) SOFSEM 2007. LNCS, vol. 4362, pp. 116–126. Springer, Heidelberg (2007)Google Scholar
  22. [JP09]
    Jarrous, A., Pinkas, B.: Secure hamming distance based computation and its applications. In: Abdalla, M., Pointcheval, D., Fouque, P.-A., Vergnaud, D. (eds.) ACNS 2009. LNCS, vol. 5536, pp. 107–124. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  23. [KM10]
    Katz, J., Malka, L.: Secure text processing with applications to private dna matching. In: To appear CCS (2010)Google Scholar
  24. [KMP77]
    Knuth, D.E., Morris Jr., J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)MATHCrossRefMathSciNetGoogle Scholar
  25. [KS05]
    Kissner, L., Song, D.X.: Privacy-preserving set operations. In: Shoup, V. (ed.) CRYPTO 2005. LNCS, vol. 3621, pp. 241–257. Springer, Heidelberg (2005)Google Scholar
  26. [LP02]
    Lindell, Y., Pinkas, B.: Privacy preserving data mining. Journal of Cryptology 15(3), 177–206 (2002)MATHCrossRefMathSciNetGoogle Scholar
  27. [LP07]
    Lindell, Y., Pinkas, B.: An efficient protocol for secure two-party computation in the presence of malicious adversaries. In: Naor, M. (ed.) EUROCRYPT 2007. LNCS, vol. 4515, pp. 52–78. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  28. [MR91]
    Micali, S., Rogaway, P.: Secure computation (abstract) (This is preliminary version of unpublished 1992 manuscript). In: Feigenbaum, J. (ed.) CRYPTO 1991. LNCS, vol. 576, pp. 392–404. Springer, Heidelberg (1992); This is preliminary version of unpublished (1992) (manuscript)Google Scholar
  29. [NM07]
    Navarro, G., Mäkinen, V.: Compressed full-text indexes. ACM Comput. Surv. 39(1), 2 (2007)CrossRefGoogle Scholar
  30. [Ped91]
    Pedersen, T.P.: Non-interactive and information-theoretic secure verifiable secret sharing. In: Feigenbaum, J. (ed.) CRYPTO 1991. LNCS, vol. 576, pp. 129–140. Springer, Heidelberg (1992)Google Scholar
  31. [Sch89]
    Schnorr, C.P.: Efficient identification and signatures for smart cards. In: Quisquater, J.-J., Vandewalle, J. (eds.) CRYPTO 1989. LNCS, vol. 434, pp. 239–252. Springer, Heidelberg (1990)Google Scholar
  32. [TPKC07]
    Troncoso-Pastoriza, J.R., Katzenbeisser, S., Celik, M.: Privacy preserving error resilient dna searching through oblivious automata. In: Proceedings of the 14th ACM conference on Computer and communications security, CCS 2007, pp. 519–528. ACM, New York (2007)CrossRefGoogle Scholar
  33. [Yao86]
    Yao, A.C.-C.: How to generate and exchange secrets. In: Proceedings of the 27th Annual Symposium on Foundations of Computer Science, SFCS 1986, Washington, DC, USA, pp. 162–167. IEEE Computer Society, Los Alamitos (1986)CrossRefGoogle Scholar

Copyright information

© International Association for Cryptologic Research 2010

Authors and Affiliations

  • Carmit Hazay
    • 1
  • Tomas Toft
    • 1
  1. 1.Aarhus UniversityDenmark

Personalised recommendations