Atomic write of certificate files and revocation list

Using a rename from a temporary file to avoid having partial writes.

Closes-Bug: #1285833

Change-Id: I3e70c795be357ceab8e5a1d12202c04fd88a02b8