# Socialist millionaire problem

(Redirected from Socialist millionaire)
Jump to navigation Jump to search

In cryptography, the socialist millionaire problem[1] is one in which two millionaires want to determine if their wealth is equal without disclosing any information about their riches to each other. It is a variant of the Millionaire's Problem[2][3] whereby two millionaires wish to compare their riches to determine who has the most wealth without disclosing any information about their riches to each other.

It is often used as a cryptographic protocol that allows two parties to verify the identity of the remote party through the use of a shared secret, avoiding a man-in-the-middle attack without the inconvenience of manually comparing public key fingerprints through an outside channel. In effect, a relatively weak password/passphrase in natural language can be used.

## Motivation

Alice and Bob have secret values ${\displaystyle x}$ and ${\displaystyle y}$, respectively. Alice and Bob wish to learn if ${\displaystyle x~=~y}$ without allowing either party to learn anything else about the other's secret value.

A passive attacker simply spying on the messages Alice and Bob exchange learns nothing about ${\displaystyle x}$ and ${\displaystyle y}$, not even whether ${\displaystyle x~=~y}$.

Even if one of the parties is dishonest and deviates from the protocol, that person cannot learn anything more than if ${\displaystyle x~=~y}$.

An active attacker capable of arbitrarily interfering with Alice and Bob's communication (a man-in-the-middle) cannot learn more than a passive attacker and cannot affect the outcome of the protocol other than to make it fail.

Therefore, the protocol can be used to authenticate whether two parties have the same secret information. Popular instant message cryptography package Off-the-Record Messaging uses the Socialist Millionaire protocol for authentication, in which the secrets ${\displaystyle x}$ and ${\displaystyle y}$ contain information about both parties' long-term authentication public keys as well as information entered by the users themselves.

## Off-the-Record Messaging protocol

State machine of a socialist millionaire protocol (SMP) implementation.

A prime, ${\displaystyle \scriptstyle p}$, and any non-identity element, ${\displaystyle \scriptstyle h}$, of ${\displaystyle \scriptstyle (\mathbb {Z} /p\mathbb {Z} )^{*}}$ are agreed on before the protocol, and in practice are generally fixed in a given implementation. For example, in the Off-the-Record Messaging protocol, ${\displaystyle \scriptstyle p}$ is a specific fixed 1,536-bit prime. ${\displaystyle \scriptstyle h}$ is then a generator of ${\displaystyle \scriptstyle (\mathbb {Z} /p\mathbb {Z} )^{*}}$, and all operations are performed modulo ${\displaystyle \scriptstyle p}$, or in other words, in the multiplicative group, ${\displaystyle \scriptstyle (\mathbb {Z} /p\mathbb {Z} )^{*}}$.

By ${\displaystyle \scriptstyle \langle h|a,\,b\rangle }$, denote the secure multiparty computation, Diffie–Hellman–Merkle key exchange, which, for the integers, ${\displaystyle \scriptstyle a,\,b}$, returns ${\displaystyle \scriptstyle h^{ab}}$ to each party:

• Alice calculates ${\displaystyle \scriptstyle h^{a}}$ and sends it to Bob, who then calculates ${\displaystyle \scriptstyle \left(h^{a}\right)^{b}~\equiv ~h^{ab}}$.
• Bob calculates ${\displaystyle \scriptstyle h^{b}}$ and sends it to Alice, who then calculates ${\displaystyle \scriptstyle \left(h^{b}\right)^{a}~\equiv ~h^{ba}}$.

${\displaystyle \scriptstyle h^{ab}~\equiv ~h^{ba}}$ as multiplication in ${\displaystyle \scriptstyle (\mathbb {Z} /p\mathbb {Z} )^{*}}$ is associative. Note that this procedure is insecure against man-in-the-middle attacks.

The Socialist millionaire protocol[4] only has a few steps that are not part of the above procedure, and the security of each relies on the difficulty of the discrete logarithm problem, just as the above does. All sent values also include zero-knowledge proofs that they were generated according to protocol.

Part of the security also relies on random secrets. However, as written below, the protocol is vulnerable to poisoning if Alice or Bob chooses any of ${\displaystyle \scriptstyle a}$, ${\displaystyle \scriptstyle b}$, ${\displaystyle \scriptstyle \alpha }$, or ${\displaystyle \scriptstyle \beta }$ to be zero. To solve this problem, each party must check during the Diffie-Hellman exchanges that none of the ${\displaystyle \scriptstyle h^{a},\,h^{b},\,h^{\alpha },}$ or ${\displaystyle \scriptstyle h^{\beta }}$ that they receive is equal to 1. It is also necessary to check that ${\displaystyle \scriptstyle P_{a}~\neq ~P_{b}}$ and ${\displaystyle \scriptstyle Q_{a}~\neq ~Q_{b}}$.

Alice Multiparty Bob
1 Message ${\displaystyle x}$
Random ${\displaystyle a,\alpha ,r}$
Public ${\displaystyle p,h}$ Message ${\displaystyle y}$
Random ${\displaystyle b,\beta ,s}$
2 Secure ${\displaystyle g=\langle h|a,b\rangle }$
3 Secure ${\displaystyle \gamma =\langle h|\alpha ,\beta \rangle }$
4 Test ${\displaystyle h^{b}\neq 1}$, ${\displaystyle h^{\beta }\neq 1}$ Test ${\displaystyle h^{a}\neq 1}$, ${\displaystyle h^{\alpha }\neq 1}$
5 {\displaystyle {\begin{aligned}P_{a}&=\gamma ^{r}\\Q_{a}&=h^{r}g^{x}\end{aligned}}} {\displaystyle {\begin{aligned}P_{b}&=\gamma ^{s}\\Q_{b}&=h^{s}g^{y}\end{aligned}}}
6 Insecure exchange ${\displaystyle P_{a},Q_{a},P_{b},Q_{b}}$
7 Secure ${\displaystyle c=\left\langle \left.Q_{a}Q_{b}^{-1}\right|\alpha ,\beta \right\rangle }$
8 Test ${\displaystyle P_{a}\neq P_{b}}$, ${\displaystyle Q_{a}\neq Q_{b}}$ Test ${\displaystyle P_{a}\neq P_{b}}$, ${\displaystyle Q_{a}\neq Q_{b}}$
9 Test ${\displaystyle c=P_{a}P_{b}^{-1}}$ Test ${\displaystyle c=P_{a}P_{b}^{-1}}$

Note that:

{\displaystyle {\begin{aligned}P_{a}P_{b}^{-1}&=\gamma ^{r}\gamma ^{-s}=\gamma ^{r-s}\\&=h^{\alpha \beta (r-s)}\end{aligned}}}

and therefore

{\displaystyle {\begin{aligned}c&=\left(Q_{a}Q_{b}^{-1}\right)^{\alpha \beta }\\&=\left(h^{r}g^{x}h^{-s}g^{-y}\right)^{\alpha \beta }=\left(h^{r-s}g^{x-y}\right)^{\alpha \beta }\\&=\left(h^{r-s}h^{ab(x-y)}\right)^{\alpha \beta }=h^{\alpha \beta (r-s)}h^{\alpha \beta ab(x-y)}\\&=\left(P_{a}P_{b}^{-1}\right)h^{\alpha \beta ab(x-y)}\end{aligned}}}.

Because of the random values stored in secret by the other party, neither party can force ${\displaystyle \scriptstyle c}$ and ${\displaystyle \scriptstyle P_{a}P_{b}^{-1}}$ to be equal unless ${\displaystyle \scriptstyle x}$ equals ${\displaystyle \scriptstyle y}$, in which case ${\displaystyle \scriptstyle h^{\alpha \beta ab(x-y)}~=~h^{0}~=~1}$. This proves correctness.

## References

1. ^ Markus Jakobsson, Moti Yung (1996). "Proving without knowing: On oblivious, agnostic and blindfolded provers.". Advances in Cryptology - CRYPTO '96, volume 1109 of Lecture Notes in Computer Science. Berlin. pp. 186–200. doi:10.1007/3-540-68697-5_15.
2. ^ Andrew Yao (1982). "Protocols for secure communications" (PDF). Proc. 23rd IEEE Symposium on Foundations of Computer Science (FOCS '82). pp. 160–164. doi:10.1109/SFCS.1982.88.
3. ^ Andrew Yao (1986). "How to generate and exchange secrets" (PDF). Proc. 27th IEEE Symposium on Foundations of Computer Science (FOCS '86). pp. 162–167. doi:10.1109/SFCS.1986.25.
4. ^ Fabrice Boudot, Berry Schoenmakers, Jacques Traoré (2001). "A Fair and Efficient Solution to the Socialist Millionaires' Problem" (PDF). Discrete Applied Mathematics. 111 (1). pp. 23-–36. doi:10.1016/S0166-218X(00)00342-5.CS1 maint: multiple names: authors list (link)