# Confidential Smart Contracts and Blockchain to Implement a Watermarking Protocol
## 7 Security Analysis
### Basic Components and Their Impact on Security  
The first component that directly influences the level of security the protocol can reach is represented by the watermark insertion technique. In fact, \(\mathcal{CP}\)'s ability to identify a dishonest buyer depends on the ability of the watermark inserted in the content to resist both attacks by malicious users and manipulations conducted legitimately by the buyer himself. In this regard, it is possible to hypothesize the use of sufficiently secure and robust watermark insertion techniques, for which the removal, even partial, of the watermark determines an evident degradation of the perceived quality of the protected content, so much so as to render it substantially devoid of economic value. Insertion techniques with such characteristics are those, for example, based on \"spread spectrum\" (SS) algorithms or based on \"quantization index modulation\" (QIM), which have shown overall positive results [22; 34; 35]. Another critical component for the security of the proposed protocol is represented by the CPU-based implementation of the TEE, which, as reported in Section 5, must guarantee confidentiality, integrity, and proof of correctness in the form of attestations of the computation performed. In this regard, it is important to note that current implementations of the TEE, such as that provided by INTEL SGX [31], are characterized by several security problems [19; 30; 32]. For example, the first problem is represented by the possibility of a malicious \(\mathcal{CN}\) to interrupt the execution in TEE of the smart contract that implements the proposed protocol. In this case, the purchase transaction in progress is canceled and must be repeated. This is because the protocol considers transactions to have no internal state. They are complete only with publishing the final purchase license on the blockchain. Such a condition may seem penalizing from the point of view of the protocol's efficiency because it does not allow recovery actions. On the other hand, it constitutes a valid security countermeasure because it prevents the malicious acquisition of information relating to the interrupted transition. Other problems may arise from the manipulation of I/O operations through which data is transferred to and from the TEE's enclave. In fact, the exchanged information could \begin{table}
\begin{tabular}{l l l} \hline \hline
**Entities and** & & \\
**Interactions** & & \\ \hline \(\mathcal{CP}\) & : & finds \(X^{\prime}\) in the market and extracts \(W^{\prime}=(W^{\prime}_{\mathcal{CP}},N^{\prime})\) \\ \(\mathcal{CP}\) & : & searches its databases for a possible match on \(W^{\prime}_{\mathcal{CP}}\) \\ \(\mathcal{CP}\) & : & retrieves \(B_{id}\), \(X_{d}\), \(T_{X}\), \(pk^{X}\), \(\mathbb{E}_{pk^{X}}(N)\), and \(K^{X}_{\mathcal{CP}}\) from its databases \\ \(\mathcal{CP}\) & : & calculates \(H^{\prime}(B_{id},X_{d},T_{X},pk^{X},\mathbb{E}_{pk^{X}}(N),K^{X}_{\mathcal{CP }},N^{\prime})\) \\ \(\mathcal{CP}\) & : & retrieves from \(\mathcal{BC}\) the digest corresponding to \(T_{X}\), \\  & : & equal to \(H(B_{id},X_{d},T_{X},pk^{X},\mathbb{E}_{pk^{X}}(N),K^{X}_{\mathcal{CP}},N)\) \\ \(\mathcal{CP}\) & : & compares \(H\) with \(H^{\prime}\) and adjudicates \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Identification and arbitration protocol. be acquired or modified illegally by the processes running on \(\mathcal{CN}\). However, even in this case, the protocol is not vulnerable because all data entering or leaving the enclave are always encrypted, and their freshness is ensured by the transaction identifiers managed by the protocol. In addition, several security problems caused by side-channel attacks are documented in the literature. These are specific problems caused by malicious users who try to manipulate the data managed by the TEE. However, it is impossible to identify generalized solutions for these problems, but ad hoc solutions are needed, mostly based on using cryptographic primitives.