Finished the encrypted sharing function