Returns public key as PEM or DER structure.

def exportpub(self, format="PEM"):
        """
        Returns public key as PEM or DER structure.
        """
        bio = Membio()
        if format == "PEM":
            retcode = libcrypto.PEM_write_bio_PUBKEY(bio.bio, self.key)
        else:
            retcode = libcrypto.i2d_PUBKEY_bio(bio.bio, self.key)
        if retcode == 0:
            raise PKeyError("error serializing public key")
        return str(bio)