implement auth in encrypt module