Set encryption key and configure database