# Homomorphic signatures for network coding

Network coding has been shown to optimally use bandwidth in a network, maximizing information flow but the scheme is very inherently vulnerable to pollution attacks by malicious nodes in the network. A node injecting garbage can quickly affect many receivers. The pollution of network packets spreads quickly since the output of (even an) honest node is corrupted if at least one of the incoming packets is corrupted.
An attacker can easily corrupt a packet even if it is encrypted by either forging the signature or by producing a collision under the hash function. This will give an attacker access to the packets and the ability to corrupt them. Denis Charles, Kamal Jain and Kristin Lauter designed a new homomorphic encryption signature scheme for use with network coding to prevent pollution attacks.
The homomorphic property of the signatures allows nodes to sign any linear combination of the incoming packets without contacting the signing authority. In this scheme it is computationally infeasible for a node to sign a linear combination of the packets without disclosing what linear combination was used in the generation of the packet. Furthermore, we can prove that the signature scheme is secure under well known cryptographic assumptions of the hardness of the discrete logarithm problem and the computational Elliptic curve Diffie–Hellman.

## Network coding

Let $G=(V,E)$ be a directed graph where $V$ is a set, whose elements are called vertices or nodes, and $E$ is a set of ordered pairs of vertices, called arcs, directed edges, or arrows. A source $s\in V$ wants to transmit a file $D$ to a set $T\subseteq V$ of the vertices. One chooses a vector space $W/\mathbb {F} _{p}$(say of dimension $d$), where $p$ is a prime, and views the data to be transmitted as a bunch of vectors $w_{1},\ldots ,w_{k}\in W$. The source then creates the augmented vectors $v_{1},\ldots ,v_{k}$ by setting $v_{i}=(0,\ldots ,0,1,\ldots ,0,w_{i_{1}},\ldots ,w{i_{d}})$ where $w_{i_{j}}$ is the $j$-th coordinate of the vector $w_{i}$. There are $(i-1)$ zeros before the first '1' appears in $v_{i}$. One can assume without loss of generality that the vectors $v_{i}$ are linearly independent. We denote the linear subspace (of $\mathbb {F} _{p}^{k+d}$ ) spanned by these vectors by $V$ . Each outgoing edge $e\in E$ computes a linear combination, $y(e)$, of the vectors entering the vertex $v=in(e)$ where the edge originates, that is to say
    $y(e)=\sum _{f:\mathrm {out} (f)=v}(m_{e}(f)y(f))$
where $m_{e}(f)\in \mathbb {F} _{p}$. We consider the source as having $k$ input edges carrying the $k$ vectors $w_{i}$. By induction, one has that the vector $y(e)$ on any edge is a linear combination $y(e)=\sum _{1\leq i\leq k}(g_{i}(e)v_{i})$ and is a vector in $V$ . The k-dimensional vector $g(e)=(g_{1}(e),\ldots ,g_{k}(e))$ is simply the first k coordinates of the vector $y(e)$. We call the matrix whose rows are the vectors $g(e_{1}),\ldots ,g(e_{k})$, where $e_{i}$ are the incoming edges for a vertex $t\in T$, the global encoding matrix for $t$ and denote it as $G_{t}$. In practice the encoding vectors are chosen at random so the matrix $G_{t}$ is invertible with high probability. Thus, any receiver, on receiving $y_{1},\ldots ,y_{k}$ can find $w_{1},\ldots ,w_{k}$ by solving
    ${\begin{bmatrix}y'\\y_{2}'\\\vdots \\y_{k}'\end{bmatrix}}=G_{t}{\begin{bmatrix}w_{1}\\w_{2}\\\vdots \\w_{k}\end{bmatrix}}$
where the $y_{i}'$ are the vectors formed by removing the first $k$ coordinates of the vector $y_{i}$.

## Decoding at the receiver

Each receiver, $t\in T$, gets $k$ vectors $y_{1},\ldots ,y_{k}$ which are random linear combinations of the $v_{i}$’s. In fact, if
    $y_{i}=(\alpha _{i_{1}},\ldots ,\alpha _{i_{k}},a_{i_{1}},\ldots ,a_{i_{d}})$
then
    $y_{i}=\sum _{1\leq j\leq k}(\alpha _{ij}v_{j}).$
Thus we can invert the linear transformation to find the $v_{i}$’s with high probability.

## History

Krohn, Freedman and Mazieres proposed a theory in 2004 that if we have a hash function $H:V\longrightarrow G$ such that:
* $H$ is collision resistant – it is hard to find $x$ and $y$ such that $H(x)=H(y)$;
* $H$ is a homomorphism – $H(x+y)=H(x)+H(y)$.
Then server can securely distribute $H(v_{i})$ to each receiver, and to check if
    $y=\sum _{1\leq i\leq k}(\alpha _{i}v_{i})$
we can check whether
    $H(y)=\sum _{1\leq i\leq k}(\alpha _{i}H(v_{i}))$
The problem with this method is that the server needs to transfer secure information to each of the receivers. The hash functions $H$ needs to be transmitted to all the nodes in the network through a separate secure channel.$H$ is expensive to compute and secure transmission of $H$ is not economical either.

## Advantages of homomorphic signatures

* Establishes authentication in addition to detecting pollution.
* No need for distributing secure hash digests.
* Smaller bit lengths in general will suffice. Signatures of length 180 bits have as much security as 1024 bit RSA signatures.
* Public information does not change for subsequent file transmission.

## Signature scheme

The homomorphic property of the signatures allows nodes to sign any linear combination of the incoming packets without contacting the signing authority.

### Elliptic curves cryptography over a finite field

Elliptic curve cryptography over a finite field is an approach to public-key cryptography based on the algebraic structure of elliptic curves over finite fields.
Let $\mathbb {F} _{q}$ be a finite field such that $q$ is not a power of 2 or 3. Then an elliptic curve $E$ over $\mathbb {F} _{q}$ is a curve given by an equation of the form
    $y^{2}=x^{3}+ax+b,\,$
where $a,b\in \mathbb {F} _{q}$ such that $4a^{3}+27b^{2}\not =0$
Let $K\supseteq \mathbb {F} _{q}$, then,
    $E(K)=\{(x,y)|y^{2}=x^{3}+ax+b\}\bigcup \{O\}$
forms an abelian group with O as identity. The group operations can be performed efficiently.

### Weil pairing

Weil pairing is a construction of roots of unity by means of functions on an elliptic curve $E$, in such a way as to constitute a pairing (bilinear form, though with multiplicative notation) on the torsion subgroup of $E$. Let $E/\mathbb {F} _{q}$ be an elliptic curve and let $\mathbb {\bar {F}} _{q}$ be an algebraic closure of $\mathbb {F} _{q}$. If $m$ is an integer, relatively prime to the characteristic of the field $\mathbb {F} _{q}$, then the group of $m$-torsion points, $E[m]={P\in E(\mathbb {\bar {F}} _{q}):mP=O}$.
If $E/\mathbb {F} _{q}$ is an elliptic curve and $\gcd(m,q)=1$ then
    $E[m]\cong (\mathbb {Z} /m\mathbb {Z} )*(\mathbb {Z} /m\mathbb {Z} )$
There is a map $e_{m}:E[m]*E[m]\rightarrow \mu _{m}(\mathbb {F} _{q})$ such that:
* (Bilinear) $e_{m}(P+R,Q)=e_{m}(P,Q)e_{m}(R,Q){\text{ and }}e_{m}(P,Q+R)=e_{m}(P,Q)e_{m}(P,R)$.
* (Non-degenerate) $e_{m}(P,Q)=1$ for all P implies that $Q=O$.
* (Alternating) $e_{m}(P,P)=1$.
Also, $e_{m}$ can be computed efficiently.

### Homomorphic signatures

Let $p$ be a prime and $q$ a prime power. Let $V/\mathbb {F} _{p}$ be a vector space of dimension $D$ and $E/\mathbb {F} _{q}$ be an elliptic curve such that $P_{1},\ldots ,P_{D}\in E[p]$. Define $h:V\longrightarrow E[p]$ as follows: $h(u_{1},\ldots ,u_{D})=\sum _{1\leq i\leq D}(u_{i}P_{i})$. The function $h$ is an arbitrary homomorphism from $V$ to $E[p]$.
The server chooses $s_{1},\ldots ,s_{D}$ secretly in $\mathbb {F} _{p}$ and publishes a point $Q$ of p-torsion such that $e_{p}(P_{i},Q)\not =1$ and also publishes $(P_{i},s_{i}Q)$ for $1\leq i\leq D$. The signature of the vector $v=u_{1},\ldots ,u_{D}$ is $\sigma (v)=\sum _{1\leq i\leq D}(u_{i}s_{i}P_{i})$ Note: This signature is homomorphic since the computation of h is a homomorphism.

### Signature verification

Given $v=u_{1},\ldots ,u_{D}$ and its signature $\sigma$, verify that
    ${\begin{aligned}e_{p}(\sigma ,Q)&=e_{p}\left(\sum _{1\leq i\leq D}(u_{i}s_{i}P_{i}),Q\right)\\&=\prod _{i}e_{p}(u_{i}s_{i}P_{i},Q)\\&=\prod _{i}e_{p}(u_{i}P_{i},s_{i}Q)\end{aligned}}$
The verification crucially uses the bilinearity of the Weil-pairing.

## System setup

The server computes $\sigma (v_{i})$ for each $1\leq i\leq k$. Transmits $v_{i},\sigma (v_{i})$. At each edge $e$ while computing $y(e)=\sum _{f\in E:\mathrm {out} (f)=\mathrm {in} (e)}(m_{e}(f)y(f))$ also compute $\sigma (y(e))=\sum _{f\in E:\mathrm {out} (f)=\mathrm {in} (e)}(m_{e}(f)\sigma (y(f)))$ on the elliptic curve $E$.
The signature is a point on the elliptic curve with coordinates in $\mathbb {F} _{q}$. Thus the size of the signature is $2\log q$ bits (which is some constant times $log(p)$ bits, depending on the relative size of $p$ and $q$), and this is the transmission overhead. The computation of the signature $h(e)$ at each vertex requires $O(d_{in}\log p\log ^{1+\epsilon }q)$ bit operations, where $d_{in}$ is the in-degree of the vertex $in(e)$. The verification of a signature requires $O((d+k)\log ^{2+\epsilon }q)$ bit operations.

## Proof of security

Attacker can produce a collision under the hash function.
If given $(P_{1},\ldots ,P_{r})$ points in $E[p]$ find $a=(a_{1},\ldots ,a_{r})\in \mathbb {F} _{p}^{r}$ and $b=(b_{1},\ldots ,b_{r})\in \mathbb {F} _{p}^{r}$
such that $a\not =b$ and
    $\sum _{1\leq i\leq r}(a_{i}P_{i})=\sum _{1\leq j\leq r}(b_{j}P_{j}).$
Proposition: There is a polynomial time reduction from discrete log on the cyclic group of order $p$ on elliptic curves to Hash-Collision.
If $r=2$, then we get $xP+yQ=uP+vQ$. Thus $(x-u)P+(y-v)Q=0$. We claim that $x\not =u$ and $y\not =v$. Suppose that $x=u$, then we would have $(y-v)Q=0$, but $Q$ is a point of order $p$ (a prime) thus $y-u\equiv 0{\bmod {p}}$. In other words $y=v$ in $\mathbb {F} _{p}$. This contradicts the assumption that $(x,y)$ and $(u,v)$ are distinct pairs in $\mathbb {F} _{2}$. Thus we have that $Q=-(x-u)(y-v)^{-1}P$, where the inverse is taken as modulo $p$.
If we have r > 2 then we can do one of two things. Either we can take $P_{1}=P$ and $P_{2}=Q$ as before and set $P_{i}=O$ for $i$ > 2 (in this case the proof reduces to the case when $r=2$), or we can take $P_{1}=r_{1}P$ and $P_{i}=r_{i}Q$ where $r_{i}$ are chosen at random from $\mathbb {F} _{p}$. We get one equation in one unknown (the discrete log of $Q$). It is quite possible that the equation we get does not involve the unknown. However, this happens with very small probability as we argue next. Suppose the algorithm for Hash-Collision gave us that
    $ar_{1}P+\sum _{2\leq i\leq r}(b_{i}r_{i}Q)=0.$
Then as long as $\sum _{2\leq i\leq r}b_{i}r_{i}\not \equiv 0{\bmod {p}}$, we can solve for the discrete log of Q. But the $r_{i}$’s are unknown to the oracle for Hash-Collision and so we can interchange the order in which this process occurs. In other words, given $b_{i}$, for $2\leq i\leq r$, not all zero, what is the probability that the $r_{i}$’s we chose satisfies $\sum _{2\leq i\leq r}(b_{i}r_{i})=0$? It is clear that the latter probability is $1 \over p$ . Thus with high probability we can solve for the discrete log of $Q$.
We have shown that producing hash collisions in this scheme is difficult. The other method by which an adversary can foil our system is by forging a signature. This scheme for the signature is essentially the Aggregate Signature version of the Boneh-Lynn-Shacham signature scheme. Here it is shown that forging a signature is at least as hard as solving the elliptic curve Diffie–Hellman problem. The only known way to solve this problem on elliptic curves is via computing discrete-logs. Thus forging a signature is at least as hard as solving the computational co-Diffie–Hellman on elliptic curves and probably as hard as computing discrete-logs.