Coding for Security and Reliability in Distributed Systems