Generic way of handling encrypted files