Move logic to determine encryption options to a function.