Improvement: throw exception when given an unknown encryption method.