Implement server side encryption (re-worked patch by yuryu)