Section 5.44

Threshold secret sharing

Definition

Threshold secret sharing is a method for splitting a secret into nn pieces, called shares, so that any tt of the shares together give back the secret, while any t−1t - 1 or fewer give no information about it: every possible secret stays exactly as likely as before. The number tt is the threshold, and such a method is called a (t,n)(t, n) threshold scheme. Adi Shamir published the standard construction in 1979. The secret is the constant term of a random polynomial, and each share is one point on that polynomial.

The idea

A company protects its software releases with one signing key. If one administrator holds the key, one theft or one lost laptop is a disaster. Giving full copies to five administrators makes theft five times more likely. Splitting the key into five pieces that are all needed makes the loss of any single piece fatal. The company wants a middle ground: any three of the five administrators can restore the key, and any two together learn nothing about it.

Shamir’s idea starts from school geometry: two points determine a straight line. Let the secret be the height at which a line crosses the vertical axis, its value at x=0x = 0, and give each person one point of the line. Any two people can draw the line and read off the secret. One person alone holds a point through which a line passes for every possible crossing height. More generally, tt points determine a polynomial of degree t−1t - 1, an expression a0+a1x+…+at−1xt−1a_0 + a_1 x + \dots + a_{t-1} x^{t-1} with fixed numbers a0,…,at−1a_0, \dots, a_{t-1} called coefficients.

The picture stops being accurate for ordinary numbers. On the real number line, a point can still make some secrets more plausible than others, and there is no way to pick a real number with every value equally likely. Shamir’s scheme therefore computes in a finite field §19.1.2, here a prime field: the whole numbers 0,1,…,p−10, 1, \dots, p - 1 for a prime pp, with every sum and product replaced by its remainder after division by pp. In a prime field, every candidate secret matches exactly the same number of polynomials through the known points, so the points carry no information about the secret.

How it works

Choose a prime pp larger than every possible secret and larger than the number of shares nn. All arithmetic is modulo pp. Every nonzero number aa has a modular inverse a−1a^{-1}, the number whose product with aa leaves remainder 1; dividing by aa means multiplying by a−1a^{-1}. The dealer, the party that holds the secret SS at the start, shares it as follows.

  1. Choose t−1t - 1 coefficients a1,…,at−1a_1, \dots, a_{t-1}, each uniformly at random from all of 0,…,p−10, \dots, p - 1, independently of SS and of each other, using a cryptographically secure pseudorandom number generator §5.27 (CSPRNG).

  2. Form the polynomial f(x)=S+a1x+a2x2+…+at−1xt−1f(x) = S + a_1 x + a_2 x^2 + \dots + a_{t-1} x^{t-1}, reduced modulo pp. Its value at x=0x = 0 is the secret.

  3. Give participant jj the share (xj,f(xj))(x_j, f(x_j)). The positions xjx_j are distinct, nonzero and public; usually xj=jx_j = j for j=1,…,nj = 1, \dots, n. Position 0 is never used, because f(0)f(0) is the secret.

  4. Deliver each share over a channel that keeps it secret and reaches the right person, then erase SS and the coefficients.

To reconstruct, any tt participants give their shares (x1,y1),…,(xt,yt)(x_1, y_1), \dots, (x_t, y_t) to one combiner. The combiner uses Lagrange interpolation, the standard formula for the value at 0 of the only polynomial of degree at most t−1t - 1 that passes through tt given points: S=∑j=1tyjλjmodp,λj=∏m≠jxmxm−xj,S = \sum_{j=1}^{t} y_j \lambda_j \bmod p, \qquad \lambda_j = \prod_{m \ne j} \frac{x_m}{x_m - x_j}, where the product runs over the other t−1t - 1 participants and each division uses a modular inverse.

Fewer than tt shares reveal nothing, and the reason is counting. Take t−1t - 1 shares and any candidate secret S′S'. The t−1t - 1 known points and the point (0,S′)(0, S') are tt points with distinct positions, and exactly one polynomial of degree at most t−1t - 1 passes through them. So every candidate secret corresponds to exactly one choice of the coefficients, and the dealer picked each choice with the same probability p−(t−1)p^{-(t-1)}. The shares held are therefore equally likely whatever the secret is, and observing them changes no probability. This argument uses no assumption about the attacker’s computing power, so the secrecy is called information-theoretic or perfect.

A 256-bit key needs a prime larger than 22562^{256}. Many implementations instead share each byte of the key separately, in a finite field with 256 elements; such a field allows at most 255 shares, since position 0 is excluded.

Worked example

Take p=17p = 17, threshold t=2t = 2, n=3n = 3 shares and the secret S=5S = 5. The dealer draws one random coefficient; suppose it is a1=13a_1 = 13. Then f(x)=(5+13x)mod17f(x) = (5 + 13x) \bmod 17.

Participants 1 and 3 reconstruct. The Lagrange weights are λ1=3/(3−1)=3/2\lambda_1 = 3 / (3 - 1) = 3 / 2 and λ3=1/(1−3)=1/(−2)\lambda_3 = 1 / (1 - 3) = 1 / (-2). The inverse of 2 is 9, because 2⋅9=18=17+12 \cdot 9 = 18 = 17 + 1. So λ1=3⋅9=27\lambda_1 = 3 \cdot 9 = 27, which reduces to 27−17=1027 - 17 = 10. Next, −2-2 is 15 modulo 17, and the inverse of 15 is 8, because 15⋅8=120=7⋅17+115 \cdot 8 = 120 = 7 \cdot 17 + 1. So λ3=8\lambda_3 = 8. Then S=1⋅10+10⋅8=90S = 1 \cdot 10 + 10 \cdot 8 = 90, and 90−5⋅17=90−85=590 - 5 \cdot 17 = 90 - 85 = 5. The secret is recovered.

Participant 2 alone holds (2,14)(2, 14). For a candidate secret S′S', the line through (0,S′)(0, S') and (2,14)(2, 14) needs S′+2a=14S' + 2a = 14, so a=(14−S′)⋅9mod17a = (14 - S') \cdot 9 \bmod 17. For S′=0S' = 0: a=14⋅9=126a = 14 \cdot 9 = 126, which reduces to 126−119=7126 - 119 = 7; check: 0+2⋅7=140 + 2 \cdot 7 = 14. For S′=5S' = 5: a=9⋅9=81a = 9 \cdot 9 = 81, which reduces to 81−68=1381 - 68 = 13, the dealer’s actual coefficient. For S′=16S' = 16: a=(−2)⋅9=−18a = (-2) \cdot 9 = -18, which is 16 modulo 17; check: 16+32=48=2⋅17+1416 + 32 = 48 = 2 \cdot 17 + 14. Each of the 17 candidate secrets matches exactly one coefficient, and each coefficient had probability 1/171/17. So the probability of seeing the share value 14 is 1/171/17 under every candidate, and participant 2 learns nothing.

The candidate S′=14S' = 14 needs a=0a = 0. A dealer who drew the coefficient only from 1 to 16, to keep the line from being flat, would make share (2,14)(2, 14) rule out the secret 14. The coefficients must range over every value, zero included.

Stated precisely

Let pp be a prime and compute modulo pp. The dealer holds S∈{0,…,p−1}S \in \{0, \dots, p - 1\}, draws a1,…,at−1a_1, \dots, a_{t-1} independently and uniformly from {0,…,p−1}\{0, \dots, p - 1\}, sets f(x)=S+∑i=1t−1aixif(x) = S + \sum_{i=1}^{t-1} a_i x^i, and gives share jj as (xj,f(xj))(x_j, f(x_j)), with x1,…,xnx_1, \dots, x_n distinct and nonzero, which needs n≤p−1n \le p - 1.

Correctness: for every set QQ of tt share indexes, S=∑j∈Qf(xj)∏m∈Q,m≠jxm(xm−xj)−1S = \sum_{j \in Q} f(x_j) \prod_{m \in Q,\, m \ne j} x_m (x_m - x_j)^{-1}. Perfect secrecy: for every set UU of fewer than tt share indexes, the share values (f(xj))j∈U(f(x_j))_{j \in U} are uniformly distributed and independent of SS. Hence, for every secret ss and every observed values vv, Pr[S=s∣shares in U=v]=Pr[S=s]\Pr[S = s \mid \text{shares in } U = v] = \Pr[S = s].

The guarantee depends on five assumptions.

  1. The coefficients are uniform over the whole field, independent of SS and of each other.

  2. The positions are distinct and nonzero.

  3. The attacker obtains fewer than tt shares in total, counting shares stolen at different times.

  4. The dealer follows the procedure and erases SS and the coefficients.

  5. Shares travel and rest where only their owners can read them.

Each share is a field element, as large as the secret. No perfectly secret threshold scheme can use shares smaller than the secret.

Limits and common mistakes

Secret sharing gives no integrity §1.9: nothing detects a wrong share. If share (3,10)(3, 10) in the example is changed to (3,11)(3, 11), reconstruction from participants 1 and 3 gives 1⋅10+11⋅8=981 \cdot 10 + 11 \cdot 8 = 98, which reduces to 98−85=1398 - 85 = 13: a wrong secret, with no error. Verifiable secret sharing (Feldman, 1987 [355]; Pedersen, 1991 [354]) lets each participant check its share against published commitments. A simpler defense stores a check value, such as a hash or a message authentication code §5.7 of the secret, and tests the reconstructed result.

Reconstruction puts the whole secret in one place, the combiner, and one compromise there at that moment exposes it. Threshold cryptography, for example threshold signatures, lets tt participants use a key without ever assembling it; secure multiparty computation §5.48 generalizes that idea.

The dealer sees the secret. Protocols for distributed key generation create a shared key that no single party ever holds.

Shares accumulate. An attacker who steals one share a year eventually holds tt. Proactive secret sharing periodically refreshes all shares, for example by adding a fresh random sharing of zero, so that shares from different periods do not combine.

Predictable coefficients destroy the secrecy, because the attacker can then solve for SS from a single share.

The threshold sets a trade-off. With t=1t = 1 every share is the secret itself; with t=nt = n the loss of one share loses the secret. Splitting a key into nn random pieces whose bitwise exclusive OR is the key is an nn-of-nn scheme.

Secret sharing is not access control §1.7. Whoever gathers tt shares has the secret; the rules on who may ask for shares, and when, lie outside the scheme.

Questions answered

Why do fewer than the threshold shares reveal no additional information under Shamir’s assumptions?

Fewer than tt shares reveal nothing because, for every possible secret, exactly the same number of polynomials pass through the shares held and give that secret, and the dealer chose each of those polynomials with the same probability. In Shamir’s scheme, the secret SS is the value at x=0x = 0 of a polynomial of degree t−1t - 1 whose other t−1t - 1 coefficients are chosen uniformly at random in a prime field, the numbers 0,…,p−10, \dots, p - 1 with arithmetic modulo a prime pp. Each share is one point (xj,f(xj))(x_j, f(x_j)). Take t−1t - 1 shares and any candidate secret: those points plus the point at 0 are tt points with distinct positions, and exactly one polynomial of degree at most t−1t - 1 passes through them. So each candidate corresponds to exactly one choice of coefficients, each with probability p−(t−1)p^{-(t-1)}. The observed shares are equally likely under every candidate, and by the rule for updating probabilities after an observation (Bayes’ rule) the attacker’s probabilities for the secret stay exactly where they were. With fewer than t−1t - 1 shares the count is larger but still the same for every candidate.

Example: with p=17p = 17 and t=2t = 2, the share (2,14)(2, 14) fits each of the 17 possible secrets with exactly one slope. The argument needs these assumptions: arithmetic in a finite field; coefficients uniform over the whole field, zero included, and independent of the secret; distinct nonzero positions; an honest dealer who erases the secret; and fewer than tt shares in the attacker’s hands. Under them the secrecy holds against unlimited computing power.

Related entries: Entropy and min-entropy (§5.26), Secure multiparty computation (§5.48), Least privilege (§1.15). Further reading: [98, 354, 355].