# Proxy Signature-Based Management Model of Sharing Energy Storage in Blockchain Environment
## 4 Proxy Signature Method Based on ElGamal Algorithm  
On a blockchain of the SES market, the participants orderly exercise their own rights through their digital signature. Unlike other participants, the rights of SESOs mainly come from the owners who delegate them, so SESOs need to use the corresponding digital signature to exercise the rights of an owner. However, the private key is the most important thing for nodes on blockchains because anyone who acquires the private key may abuse the rights of nodes. The private key is to the node as a password is to a bank account. Therefore, it is impossible for SESOs to directly utilize the digital signature of the node. In order to address the above problem, a proxy signature mechanism is proposed to achieve the delegation of digital signature power in a secure environment. By using a proxy signature mechanism, a node called the original signer can delegate its digital signature power to another node called the proxy signer. The proxy signer can generate the digital signature on behalf of the original signer--i.e., a proxy signature. A basic protocol of proxy signatures is presented in [28], and the original signature scheme is kept unchanged. Therefore, a proxy signature mechanism based on the basic protocol and EIGamal algorithm is proposed in this paper, and its flowchart is shown in Figure 4. It can be seen that the proxy signature mechanism consists of the following four parts:  
1. Initialization. The parameters of the signature mechanism and the key pair of the node are determined in this stage. The first parameter to be determined is \(p\), a large prime number. The range of \(p\) can be selected by considering encryption bits. The EIGamal algorithm is based on the discrete logarithm problem  
Figure 4: The flowchart of the proxy signature mechanism. over prime fields, which is not solved in polynomial time if \(p\) is a large enough prime number [32]. For example, if \(p\) is a prime number of 256 bits, the discrete logarithm based on the \(p\) needs more than \(10^{19}\) operations to be solved by [PERSON]'s rho algorithm, a recognized optimal algorithm, whose time complexity is \(O(p^{1/4})\), for computing discrete logarithms [33]. At present, the prime number \(p\) is 1024 bits or even 2048 bits in industrial applications, and therefore the solving time for the discrete logarithm is astronomical even if supercomputers are used. The variable \(g\) less than \(p\) is a generator of \(Z_{p}^{*}\). \(Z_{p}^{*}\) is a multiplicative group of integers modulo \(p\) and \(Z_{p}^{*}=\{g\big{|}1\leq g\leq p-1,\gcd(g,p)=1\}\), where \(\gcd(\,)\) is a function of computing the greatest common divisor between two numbers. For each \(b\) from 1 to \(p\)-1, there exist an \(a\) where \(g^{a}\equiv b\ (\bmod\ p)\). It is difficult for a large prime number to select generators. Therefore, a large safe prime \(p\) (\(p\) and \(q\)\(=(p-1)/2\) are all the primes) is selected in order to obtain the generators easily because \(p\)-1 has only two factors--i.e., 2 and \(q\). If \(g^{2}(\bmod\ p)\) and \(g^{q}(\bmod\ p)\) are not equal to 1, then \(g\) is a generator. \(p\) and \(g\) are the system parameters of the proxy signature mechanism. Next, a private key \(x\) is freely selected as follows:  
\[0<x<p\quad x\in\mathbb{Z} \tag{1}\]  
Then, the corresponding public key \(y\) can be obtained as follows:  
\[y=g^{x}(\bmod\ p) \tag{2}\]  
The public key \(y\), \(p\) and \(g\) constitute a group (\(y,p,g\)), which is public to all and used to verify that the owner of the public key has signed the message. 2. Delegation of digital signature power. In this stage, the digital signature power of the original signer is delegated to a proxy signer. A random number \(k\) is generated by the original signer, and a proxy key is computed as follows:  
\[0<k<p\quad k\in\mathbb{Z} \tag{3}\]  
\[K=g^{k}(\bmod\ p) \tag{4}\]  
\[\delta=x+\mathrm{k}K(\bmod\ q) \tag{5}\]  
where (\(K,\delta\)) is the proxy key of the original signer.