server: move crypto logic into resource