def exportPublicKey(key, filename):
    """
    Stores the public key of a key pair in PEM format.
    """
    public = key.publickey()
    with open(filename, 'wb') as f:
        f.write(public.exportKey('PEM'))
