def rsa_verify(xml, signature, key, c14n_exc=True):
 if key.startswith('-----BEGIN PUBLIC KEY-----'):
  bio = BIO.MemoryBuffer(key)
  rsa = RSA.load_pub_key_bio(bio)
 else:
  rsa = RSA.load_pub_key(certificate)
 pubkey = EVP.PKey()
 pubkey.assign_rsa(rsa)
 pubkey.reset_context(md='sha1')
 pubkey.verify_init()
 pubkey.verify_update(canonicalize(xml, c14n_exc))
 ret = pubkey.verify_final(base64.b64decode(signature))
 return (ret == 1)

def rsa_verify ( xml , signature , key , c14n_exc = True ) : if key . startswith ( '-----BEGIN PUBLIC KEY-----' ) : bio = BIO . MemoryBuffer ( key ) rsa = RSA . load_pub_key_bio ( bio ) else : rsa = RSA . load_pub_key ( certificate ) pubkey = EVP . PKey ( ) pubkey . assign_rsa ( rsa ) pubkey . reset_context ( md = 'sha1' ) pubkey . verify_init ( ) pubkey . verify_update ( canonicalize ( xml , c14n_exc ) ) ret = pubkey . verify_final ( base64 . b64decode ( signature ) ) return ( ret == 1 )
verify a xml document signature usign rsa-sha1 .