Implement crypto and rewrite packet read/write