Code for converting Writecaps to and from the X.509 certificate format. TODO: Improve the efficiency and quality of this code by moving to a different library for handling X.509 certificates.