## 3 Method
### Authentication and Issuing Invoice Phase
#### 3.5.2 Case 2: Proxy Authorization  
When the Licenseee submits an application request to the Proxy, the Proxy transfers it to the CA for verification. After reviewing the Licensee's identity, the CA generates a transaction ID and invoice to the Licensee. We present the flowchart of the authentication and issuing invoice phase (L to P) in Figure 7, the flowchart of the authentication and issuing invoice phase (P to CA) in Figure 8, the flowchart of the authentication and issuing invoice phase (CA to P) in Figure 9, and the flowchart of the authentication and issuing invoice phase (P to L) in Figure 10.  
Figure 7: Authentication and issuing invoice phase (L to P). * Step 1: The Licensee generates a random value \(k_{L-A}\), calculates: \[z_{L-A}=h(ID_{L},M_{L-A},Cert_{L},TS_{L-A},ID_{BC}),\] (28) \[(x_{L-A},y_{L-A})=k_{L-A}G,\] (29) \[r_{L-A}=x_{L-A}\text{mod}n,\] (30) \[s_{L-A}=k_{L-A}{}^{-1}(z_{L-A}+r_{L-A}d_{L})\text{mod}n,\] (31) \[Enc_{L-A}=E_{PK_{A}}(ID_{L},M_{L-A},Cert_{L},TS_{L-A},ID_{BC}),\] (32) and sends \(ID_{L},Enc_{L-A},(r_{L-A},s_{L-A})\) to the proxy. * Step 2: The proxy first calculates: \[(ID_{L},M_{L-A},Cert_{L},TS_{L-A},ID_{BC})=D_{SK_{A}}(Enc_{L-A}),\] (33) uses \[TS_{NOW}-TS_{L-A}\leq\Delta T\] (34) to confirm whether the timestamp is valid, verifies \(Cert_{L}\) with \(PK_{L}\), verifies the correctness of the ECDSA signature, and then calculates: \[z_{L-A}{}^{\prime}=h(ID_{L},M_{L-A},Cert_{L},TS_{L-A},ID_{BC}),\] (35) Figure 7:0 (36) Figure 7:1 (37) Figure 7:2 (38) Figure 7:3 (39)  
Figure 7:4 Authentication and issuing invoice phase (P to L). If the verification is passed, the proxy will get the relevant content request information and trigger the smart contracts lains and lachk. The content is as follows (Scheme 5):  
\[ \begin{array}{|c|}\hline\text{function insert smart contract lains(}\\ \text{string la\_id, string la\_detail,}\\ \text{string la\_cert, string la\_tsp)}\{\\ \text{count}++;\\ \text{la[count].id=id;}\\ \text{la[count].detail=detail;}\\ \text{la[count].cert=cert;}\\ \text{la[count].tsp=tsp;}\\ \}\\ \text{sign string l\_key (la\_id, la\_detail,}\\ \text{la\_cert, la\_tsp);}\\ \hline\end{array} \]  
\[ \begin{array}{|c|}\hline\text{verify string l\_key (la\_id, la\_detail,}\\ \text{la\_cert, la\_tsp);}\\ \text{function check smart contract lachk(}\\ \text{string la\_id, string la\_detail,}\\ \text{string la\_cert, string la\_tsp)}\{\\ \text{return la\_id.exist;}\\ \text{return la\_detail.exist;}\\ \text{return la\_cert.exist;}\\ \text{return la\_tsp.exist;}\\ \text{\}\}\\ \text{\}\end{array} \]  
\[ \begin{array}{|c|}\hline\text{return la\_tgt.exist;}\\ \text{return la\_tgt.exist;}\\ \text{return la\_tgt.exist;}\\ \text{return la\_tgt.exist;}\\ \text{}\}\\ \text{}\end{array} \]  
\[\begin{array}{|c|}\hline\text{\bf Scheme 5. The smart contracts lains and lachk.}\\ \hline\text{\bf Scheme 5.  
function insert smart contract amins( string am_id, string am_detail, string am_cert, string am_tsp) { count ++; am[count].id = id; am[count].detail = detail; am[count].cert = cert; am[count].tsp = tsp; } sign string a_key (am_id, am_detail, am_cert, am_tsp); } ```  
The CA calculates:  
\[BC_{A-M}=h(r_{A-M},s_{A-M}), \tag{53}\]  
\((ID_{BC},BC_{A-M})\) will also be uploaded to the blockchain center. Step 5: The CA generates a random value \(k_{M-A}\) and calculates:  
\[z_{M-A}=h(ID_{M},M_{M-A},TID,invoice,TS_{M-A},ID_{BC}), \tag{54}\]  
\[(x_{M-A},y_{M-A})=k_{M-A}G, \tag{55}\]  
\[r_{M-A}=x_{M-A}\text{mod}n, \tag{56}\]  
\[s_{M-A}=k_{M-A}{}^{-1}(z_{M-A}+r_{M-A}d_{M})\text{mod}n, \tag{57}\]  
\[Enc_{M-A}=E_{PK_{A}}(ID_{M},M_{M-A},TID,invoice,TS_{M-A},ID_{BC}), \tag{58}\]  
and sends \(ID_{M},Enc_{M-A},(r_{M-A},s_{M-A})\) to the proxy.