added support for encrypted keys