Jump to content

Ring learning with errors key exchange

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Carvalho1988 (talk | contribs) at 23:14, 17 May 2015 (Move content from sandbox to articles for creation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

 Background

Since the 1980's the security of cryptographic key exchanges and digital signatures over the internet has been based on a small number of public key algorithms. The security of these algorithms is based on a small number of computationally hard problems in classical computing. These problems are the difficulty of factoring the product of two carefully chosen prime numbers, the difficulty to compute discrete logarithms in a carefully chosen finite field, and the difficulty of computing discrete logarithms in a carefully chosen elliptic curve group. These problems are very difficult to solve on a classical computer but are rather easily solved by a relatively small quantum computer. If a quantum computer of sufficient size were build, all of the public key algorithms based on these classically hard problems would become extremely insecure.

Cryptography that is not susceptible to attack by a quantum computer is referred to as Quantum Resistant, Quantum Safe, or Post-quantum cryptography. One class of quantum resistant cryptographic algorithms is based on a concept called "Learning with errors" introduced by Oded Regev in 2005[1]. A specialized form of Learning with errors operates within the Ring of Polynomials over a Finite Field. This specialized form is called Ring Learning with Errors or Ring-LWE.

Introduction

The Ring-LWE Key Exchange is designed to be a "quantum safe" replacement for the widely used Diffie-Hellman and Elliptic Curve Diffie-Hellman key exchanges that are used to secure the establishment of secret keys over untrusted communications channels.

The Ring-LWE key exchange works in the ring of polynomials of degree n-1 or less modulo a polynomial F(x) (i.e. the ring Zq[x]/F(x) for an integer q). The coefficients of the polynomials in this ring are the integers mod q. Multiplication and addition of polynomials will work in the usual fashion with results of a multiplication reduced mod F(x). This article will closely follow the work of Peikert as further explained by Singh[2][3]. For this presentation a typical polynomial is expressed as:

p(x) = pn-1xn-1 + pn-2xn-2 + pn-3xn-3 + ... + p2x2 + p1x + p0

This cryptographic algorithm uses polynomials which are considered "small" with respect to a measure called the "infinity norm." The infinity norm for a polynomial is simply the value of the largest coefficient of the polynomial when considered as integers in (Z vice Z/pZ). The algorithm will generate random polynomials which are small with respect to the infinity norm. We do this by randomly generating the coefficients of the polynomial (pn-1, ..., p0) which are guaranteed or very likely to be small. There are two common ways to do this:

  1. Using Uniform Sampling - The coefficients of the small polynomial are uniformly sampled from a set of small coefficients. Let b be an integer that is much less than q. If we randomly choose coefficients from the set: { -b, -b+1, -b+2. ... -2, -1, 0, 1, 2, ... , b-2, b-1, b} the polynomial will be small with respect to the bound (b).
  2. Using Discrete Gaussian Sampling - For an odd value for q, the coefficients are randomly chosen by sampling from the set { -(q-1)/2 to (q-1)/2 } according to a discrete gaussian distribution with mean 0 and distribution parameter σ. The references describe in full detail how this can be accomplished. It is more complicated than uniform sampling but it allows for a proof of security of the algorithm.

For the rest of this article, the random small polynomials will be sampled according do a distribution which is simply be specified as D. Further q will be an odd prime such that q is congruent to 1 mod 4. The maximum degree of the polynomials (n) will be a power of 2. This follows the work of Singh.[3] The other cases for q and n are thoroughly discussed in the referenced paper by Peikert.[2] A fixed public polynomial ( a(x) ) shared by all users of the network. It is deterministically generated from a cryptographically secure source.

The Key Exchange

The key exchange will take place between two devices. There will be an initiator for the key exchange designated as (I) and a responder designated as (R). Both I and R know, q, n, a(x), and have the ability to generate small polynomials according to the distribution D. The key exchange begins with the initiator (I) doing the following:

Initiator's First Steps:

  1. Generate two small polynomials sI(x) and eI(x) by sampling from the distribution D.
  2. Compute tI(x) = a(x)·sI(x) + eI(x).
  3. The initiator sends the polynomial tI(x) to the Responder.

Responser's Steps:

  1. Generate two small polynomials sR(x) and eR(x) by sampling from the distribution D.
  2. Compute v(x) = tI(x)·sR(x) + eR(x) Note that this equals: a(x)sI(x)sR(x) + eI(x)sR(x) + eR(x) and that eI(x)sR(x) will also be small relative to the infinity norm on q.
  3. The distribution of the coefficients of v(x) are smoothed by looping through the coefficients and randomly adjusting certain values. For j = 0 to n-1:
    1. If vj = 0, draw a random bit (b). If b = 0 then vj = 0 otherwise vj = q-1
    2. If vj = (q-1)/4, draw a random bit (b). If b = 0 then vj = (q-1)/4 otherwise vj = (q+3)/4
  4. Two n-long bit streams, uj, and cj, are formed from the coefficients of v(x), (vn-1, ... , v0 ), via "Modular Rounding" and "Cross Rounding" respectively. For j = 0 to n-1:
    1. Find mj and rj such that 2vj = mjq + rj
    2. Find sj and yj such that 4vj = sjq + yj
    3. If rj > (q-1)/2 (in Z) then set uj = mj + 1 (mod 2) otherwise uj = mj (mod 2)
    4. If yj > (q-1)/2 (in Z) then set cj = sj + 1 (mod 2) otherwise cj = sj (mod 2)
  5. Form the key (k) as the concatenation of un-1, ..., u0.
  6. Form an n-long "reconciliation" bit string (c) as the concatenation of cn-1, ..., c0.
  7. Compute tR(x) = a(x)·sR(x) + eR(x).
  8. The Responder sends tR(x) and c to the Initiator.

Initiators Final Steps:

  1. Receive tR(x) and c from the Responder
  2. Compute w(x) = tR(x)·sI(x) + eI(x) = a(x)sI(x)sR(x) + eR(x)sI(x) + eI(x) Note that this does not equal v(x) (above) but is "close."
  3. An n-long bit stream (uj) is formed by looping through the coefficients of w(x) and performing "Key Reconciliation." For j = 0 to n-1:
    1. If cj = 0 and -q/8 ≤ wj < 3q/8 then uj = 0 otherwise uj = 1
    2. If cj = 1 and q/8 ≤ wj < 5q/8 then uj = 0 otherwise uj = 1
  4. Form the key (k) as the concatenation of un-1, ..., u0

Depending on the specifics of the parameters chosen n, q, σ, or b, there is an extremely small probability that this key exchange will fail to produce the same key. Implementors of the scheme might want to introduce a key validation step before ciphertext is produced.

Parameter Choices

The Ring-LWE Key exchange presented above worked in the Ring of Polynomials of degree n-1 or less mod a polynomial F(x). The presentation assumed that n was a power of 2 and that q was a prime which was congruent to 1 (mod 4). Following the guidance given in Peikert's paper, Singh suggested two sets of paramters for the Ring-LWE Key Exchange.

For 128 bits of security, n = 512, q = 25601, and F(x) = x512 + 1

For 256 bits of security, n = 1024, q = 40961, and F(x) = x1024 + 1

These choices of parameters will provide greater than 128 or 256 bits of security, respectively. If we assume that the gaussian parameter σ is 8/sqrt(2π) and the uniform sampling bound (b) = 5(see Singh)[3], then the probability of key agreement failure is less than 2-71 for the 128-bit secure parameters and 2-91 for the 256-bit secure parameters.

References

  1. ^ Regev, Oded (2005). "On Lattices, Learning with Errors, Random Linear Codes, and Cryptography". Proceedings of the Thirty-seventh Annual ACM Symposium on Theory of Computing. STOC '05. New York, NY, USA: ACM: 84–93. doi:10.1145/1060590.1060603. ISBN 1-58113-960-8.
  2. ^ a b Peikert, Chris (2014). "Lattice Cryptography for the Internet". {{cite journal}}: Cite journal requires |journal= (help)
  3. ^ a b c Singh, Vikram (2015). "A Practical Key Exchange for the Internet using Lattice Cryptography". {{cite journal}}: Cite journal requires |journal= (help)