added encryption for encrypted keys