# BioShare: An Open Framework for Trusted Biometric Authentication under User Control
## 3 BioShare Design
### Secured Communication Module (SCM)  
The Secured Communication Module ensures secure and undeniable communication between user terminals and the server through cryptographic techniques such as symmetric encryption, asymmetric encryption, and hash and digital signatures. To ensure security, all encryption/decryption actions are conducted in the trusted environment of either the server or the terminal. Secured communication channels combine terminal TEEs and the server enclave, forming an integrated trusted environment for trusted computing.  
**Secured Channels:** Before the server and the terminal communicate with each other, for example, the UA module on the terminal authorizes the server in Section 3.2 and Algorithm 1 and the SA module on the server forwards service requests to the user terminals in Section 3.3, we use an asymmetric encryption algorithm RSA (with a key length of 3072 bytes) to build secure communication channels between the server and the terminal. RSA algorithms with a key length of 7680 bytes will provide higher security, and alternative algorithms include ECC algorithms with key lengths of 256/384 bytes. First, random numbers are generated in the server enclave and terminal TEEs, then public/private key pairs are generated on both sides, based on the random numbers with an asymmetric encryption algorithm (i.e., the RSA or ECC algorithm). Finally, private keys are stored in trusted environments and public keys are exchanged with each other. Please be reminded that asymmetric encryption applies only to small data sets due to high computing costs.  
**Data Encryption:** In BioShare, user biometric data are only processed in secure environments including terminal TEEs and server enclaves, and that are transferred in encrypted format outside secure environments and decrypted in secure environments to ensure data security and privacy protection. We use the symmetric encryption algorithm AES-128 to efficiently encrypt/decrypt the biometric data during terminal-server communications. The following are the main steps: a. A random number is generated for each user by the hardware device in the server enclave. b. A working key is generated for the user based on the random numbers using the symmetric encryption algorithm (i.e., AES), and saved in the server enclave. c. The working key is encrypted with the terminal public key and sent to the user's terminal. d. The working key is decrypted and stored in the terminal TEE, so that both sides share the same working key.  
**Digital Signatures:** To ensure nonrepudiation, we use digital signatures on both the server and terminal sides. In the terminal TEE, a message can be signed with the following steps: a. Calculate the hash value for the target message with the hash algorithm SHA-256. b. Encrypt the hash value with the user's private key. c. Send the message along with the ciphertext to the server. On the server enclave, the message can be verified via the following steps: a. Decrypt the ciphertext to a plaintext format. b. Calculate the hash value for the message with the SHA-256 algorithm. c. Check whether the hash value is consistent with the plaintext. Digital signatures are used in the return values of the SA module as a response to service requests from network applications as in Section 3.3 and Algorithm 2.