How to use pyopenssl to read a pfx file? And how to sign an XML with this SSL certificate?
I'm still having trouble understanding how to read, but I also have no idea how to sign. I thought I'd use the pip signxml library but I do not know if that's the way.
My code so far:
import OpenSSL
def load_public_key(pfx_path, pfx_password):
        ''' Read the public key and return as PEM encoded '''
        # print('Opening:', pfx_path)
        with open(pfx_path, 'rb') as f:
                pfx_data = f.read()
        # print('Loading PFX contents:')
        pfx = OpenSSL.crypto.load_pkcs12(pfx_data, pfx_password)
        public_key = OpenSSL.crypto.dump_publickey(
                OpenSSL.crypto.FILETYPE_PEM,
                p12.get_certificate().get_pubkey())
        print(public_key)
        return public_key
teste = load_public_key("certificates/myfile.pfx", 'mypass')
I need to read a script, sign any XML and get a string with that xml.