templated encrypt