# Trapdoor function

This article needs additional citations for verification. (July 2013) (Learn how and when to remove this template message) |

A **trapdoor function** is a function that is easy to compute in one direction, yet difficult to compute in the opposite direction (finding its inverse) without special information, called the "trapdoor". Trapdoor functions are widely used in cryptography.

In mathematical terms, if *f* is a trapdoor function, then there exists some secret information *y*, such that given *f*(*x*) and *y*, it is easy to compute *x*. Consider a padlock and its key. It is trivial to change the padlock from open to closed without using the key, by pushing the shackle into the lock mechanism. Opening the padlock easily, however, requires the key to be used. Here the key is the trapdoor and the padlock is the trapdoor function.

An example of a simple mathematical trapdoor is "6895601 is the product of two prime numbers. What are those numbers?" A typical solution would be to try dividing 6895601 by several prime numbers until finding the answer. However, if one is told that 1931 is one of the numbers, one can find the answer by entering "6895601 ÷ 1931" into any calculator. This example is not a sturdy trapdoor function – modern computers can guess all of the possible answers within a second – but this sample problem could be improved by using the product of two much larger primes.

Trapdoor functions came to prominence in cryptography in the mid-1970s with the publication of asymmetric (or public-key) encryption techniques by Diffie, Hellman, and Merkle. Indeed, Diffie & Hellman (1976) coined the term. Several function classes have been proposed, and it soon became obvious that trapdoor functions are harder to find than was initially thought. For example, an early suggestion was to use schemes based on the subset sum problem. This turned out – rather quickly – to be unsuitable.

As of 2004^{[update]}, the best known trapdoor function (family) candidates are the RSA and Rabin families of functions. Both are written as exponentiation modulo a composite number, and both are related to the problem of prime factorization.

Functions related to the hardness of the discrete logarithm problem (either modulo a prime or in a group defined over an elliptic curve) are *not* known to be trapdoor functions, because there is no known "trapdoor" information about the group that enables the efficient computation of discrete logarithms.

A trapdoor in cryptography has the very specific aforementioned meaning and is not to be confused with a backdoor (these are frequently used interchangeably, which is incorrect). A backdoor is a deliberate mechanism that is added to a cryptographic algorithm (e.g., a key pair generation algorithm, digital signing algorithm, etc.) or operating system, for example, that permits one or more unauthorized parties to bypass or subvert the security of the system in some fashion.

## Contents

## Definition[edit]

A **trapdoor function** is a collection of one-way functions { *f*_{k} : *D*_{k} → *R*_{k} } (*k* ∈ *K*), in which all of *K*, *D*_{k}, *R*_{k} are subsets of binary strings {0, 1}^{*}, satisfying the following conditions:

- There exists a probabilistic polynomial time (PPT)
*sampling*algorithm Gen s.t. Gen(1^{n}) = (*k*,*t*_{k}) with*k*∈*K*∩ {0, 1}^{n}and*t*_{k}∈ {0, 1}^{*}satisfies |*t*_{k}| <*p*(*n*), in which*p*is some polynomial. Each*t*_{k}is called the*trapdoor*corresponding to*k*. Each trapdoor can be efficiently sampled. - Given input
*k*, there also exists a PPT algorithm that outputs*x*∈*D*_{k}. That is, each*D*_{k}can be efficiently sampled. - For any
*k*∈*K*, there exists a PPT algorithm that correctly computes*f*_{k}. - For any
*k*∈*K*, there exists a PPT algorithm*A*s.t. for any*x*∈*D*_{k}, let*y*=*A*(*k*,*f*_{k}(*x*),*t*_{k}), and then we have*f*_{k}(*y*) =*f*_{k}(*x*). That is, given trapdoor, it is easy to invert. - For any
*k*∈*K*, without trapdoor*t*_{k}, for any PPT algorithm, the probability to correctly invert*f*_{k}(i.e., given*f*_{k}(*x*), find a pre-image*x'*such that*f*_{k}(*x'*) =*f*_{k}(*x*)) is negligible.^{[2]}^{[3]}^{[4]}

If each function in the collection above is a one-way permutation, then the collection is also called a **trapdoor permutation**.^{[5]}

## Examples[edit]

In the following two examples, we always assume it is difficult to factorize a large composite number (see Integer factorization).

### RSA Assumption[edit]

In this example, having the inverse of *e* modulo φ(*n*), the Euler's totient function of *n*, is the trapdoor:

If the factorization is known, φ(*n*) can be computed, so then the inverse *d* of *e* can be computed *d* = *e*^{−1} mod φ(*n*), and then given *y* = *f*(*x*) we can find *x* = *y*^{d} mod *n* = *x*^{ed} mod *n* = *x* mod *n*. Its hardness follows from RSA assumption.^{[6]}

### Rabin's Quadratic Residue Assumption[edit]

Let *n* be a large composite number such that *n* = *pq*, where *p* and *q* are large primes such that *p* ≡ 3 mod 4, *q* ≡ 3 mod 4, and kept confidential to adversarial. The problem is to compute *z* given *a* such that *a* ≡ *z*^{2} mod *n*. The trapdoor is the factorization of *n*. With trapdoor, the solutions of *z* can be given as *cx* + *dy*, *cx* - *dy*, - *cx* + *dy*, - *cx* - *dy*, where *a* ≡ *x*^{2} mod *p*, *a* ≡ *y*^{2} mod *q*, *c* ≡ 1 mod *p*, *c* ≡ 0 mod *q*, *d* ≡ 0 mod *p*, *d* ≡ 1 mod *q*. See Chinese remainder theorem for more details. Note that given primes *p* and *q*, we can find *x* ≡ *a*^{(p+1)/4} mod *p* and *y* ≡ *a*^{(q+1)/4} mod *q*. Here the conditions *p* ≡ 3 mod 4 and *q* ≡ 3 mod 4 guarantee that the solutions *x* and *y* can be well defined.^{[7]}

## See also[edit]

## Notes[edit]

## References[edit]

- Diffie, W.; Hellman, M. (1976), "New directions in cryptography" (PDF),
*IEEE Transactions on Information Theory*,**22**(6): 644–654, doi:10.1109/TIT.1976.1055638 - Pass, Rafael,
*A Course in Cryptography*(PDF), retrieved 27 November 2015 - Goldwasser, Shafi,
*Lecture Notes on Cryptography*(PDF), retrieved 25 November 2015 - Ostrovsky, Rafail,
*Foundations of Cryptography*(PDF), retrieved 27 November 2015 - Dodis, Yevgeniy,
*Introduction to Cryptography Lecture Notes (Fall 2008)*, retrieved 17 December 2015 - Lindell, Yehuda,
*Foundations of Cryptography*(PDF), retrieved 17 December 2015