# DSVN: A Flexible and Secure Data-Sharing Model for VANET Based on Blockchain
## 4 System Design
### ORCP-ABE Algorithm
\] (6) where \(k_{y}\in Z_{p}^{*}\), \(G_{i}\) is the set of user attributes containing attribute \(att_{i}\), and \(\theta_{j}\) is the value in the leaf node \(V_{j}\) (note: \(V_{j}\) is different from \(y\); \(V_{j}\) is a leaf node in the key encryption key tree, where \(y\) is a leaf node in the visited tree);
* Pre-decryption \((CT^{\prime},SK_{id},KEK)\to PDCT\): The algorithm takes ciphertext \(CT^{\prime}\), access user key \(SK_{id}\) and user attribute group encryption information KEK. Algorithm preorder traversal attribute-weighted tree \(T^{*}\). For node \(x\in T^{*}\), algorithm calculates the decryption value of leaf node \(DN\) or the decryption value of non-leaf node \(F_{x}\). If \(x\) is leaf node calculate \(DN\): \[ \begin{split} DN(CT^{\prime},SK_{id},KEK,x)&=\frac{ \epsilon\left(D^{\prime},C_{y}\right)}{\epsilon\left(KEK,E\left(k_{y}\right) \right)},\\ &=e(g,g)^{util-USK-Q_{y}(0)}\end{split} \] (7) else calculate \(F_{x}\): \[ \begin{split} F_{x}&=\prod\limits_{z\in S_{x}}F_{ z}^{Al_{x}S_{x}^{\prime}(0)}\\ &=\prod\limits_{z\in S_{x}}\left(e(g,g)^{util-USK-Q_{y}(0)} \right)^{Al_{x}S_{x}^{\prime}(0)}\\ &=\prod\limits_{z\in S_{x}}\left(e(g,g)^{util-USK-Q_{y}(0)} \right)^{Al_{x}S_{x}^{\prime}(0)}\\ &=e(g,g)^{util-USK-Q_{y}(0)}\end{split} \] (8) where \(x\) represents the currently traversed node. \(S_{x}\) denote any set of child nodes of scale \(t_{x}\). For all leaf nodes \(z\in S_{x}\), transfer \(DN(CT^{\prime},SK_{id},KEK,z)\to F_{z}\). When user does not satisfy the set of attribute groups \(G_{x}\), \(DN(CT^{\prime},SK_{id},KEK,x)\) will not be calculated and will be skipped. Finally, algorithm calculates \(PDCT\): \[PDCT=(F_{root},\widetilde{C})=(e(g,g)^{util-USK-s},Me(g,g)^{as});\] (9)* Decryption algorithm \((PDCT,USK)\rightarrow\overline{M}\): The algorithm takes pre-decrypted information \(PDCT\) and user data private key \(USK\) as input. Algorithm calculates \(\overline{M}\): \[\overline{M}=\frac{\widetilde{C}.A^{\frac{1}{\text{th}x}}}{e(C,D)}=\frac{Me(g,g )^{\text{ss}}}{\frac{e\left(g^{\text{ss}}.g^{\text{ss}}\right)}{e(g,\delta)^{ \text{ss}}}};\] (10)
* Update \(KEK\left(id,att_{x}\right)\to KEK\): The algorithm takes user \(id\) and revoked attribute \(att_{x}\) as input. Algorithm randomly selects \(\sigma_{x}\), and updates data key pair \(DSK\), \(DPK\): \[ \begin{split} DSK=\{t_{i}|1\leq i\leq n,i\
eq x\}\cup\{t_{x}^{*}=t _{x}\text{-}\sigma_{x}\},\\ DPK=\{T_{i}|1\leq i\leq n,i\
eq x\}\cup\{T_{x}^{*}=T_{x}^{*}\}. \end{split} \] (11) where \(\sigma_{x}\in Z_{p}^{*}\). For \(u_{k}\in G_{x}\), the algorithm calculates user attribute group encryption information \(KEK\): \[ \begin{split}\overline{\varphi_{x}}=Path(u_{k})\cap Mincs(G_{x}),\\ kek_{x}=(kek_{x})^{\sigma_{x}},KEK_{x}=(kek_{x})^{\theta_{f}}. \end{split} \] (12) where, \(\theta_{f}\) is a value corresponding to the node \(\overline{\varphi_{x}}\);
* Update ciphertext \((CT^{\prime})\to CT*\): The algorithm takes ciphertext \(CT^{\prime}\) as input. Algorithm randomly selects \(s^{\prime},k^{\prime}_{y}\), and updates \(CT*\): \[ \begin{split}\widetilde{C}=\widetilde{C}.e(g,g)^{\text{ss}^{ \prime}},C=C.h^{s^{\prime}},C_{y}^{\prime}=g^{\text{Q}_{y}(0)}.g^{\text{t}},\\ Hdr=\begin{cases}\left\{\overline{v^{\prime}_{f}}\,E\left(k_{y} \right)=g^{k^{\prime}_{y}\theta_{f}/t_{x}}\right\}&\overline{v^{\prime}_{f} }\in Mincs(G_{x})\\ \left\{v^{\prime}_{f}\,E\left(k_{y}\right)=g^{k_{y}\theta_{f}/t_{x}}\right\}& v^{\prime}_{f}\in Mincs(G_{i}),i\
eq x\end{cases}.\end{split} \] (13) where \(s^{\prime},k^{\prime}_{y}\in Z_{p}^{*}\).