def pem(self):
        """ Returns PEM represntation of the certificate """
        bio = Membio()
        if libcrypto.PEM_write_bio_X509(bio.bio, self.cert) == 0:
            raise X509Error("error serializing certificate")
        return str(bio)