A security-preserving compiler for distributed programs: from information-flow policies to cryptographic mechanisms