Gen public key from xml data file using M2Crypto for signature verification
I have pub key in xml format: <RSAKeyValue><Modulus>xF9y25EXh8n99sXtU/JAsYTwML6PB7gSCE8tWw8Www2KBfDqohQBL8FMs8jzsDQa7WwoEmiVJ1resEC9YXJGbwQyWgb9qgooC9oSnCB/TkRdBybwby0DKuZOzq+609OBGkwWpgnS4QVCBc6eW+10l3qE3/2hKdcSV+08iRYp7zs=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue> So i try thms like this: from M2Crypto import RSA from xml.dom.minidom import parseString import base64 dom = parseString(pubKey) e = base64.b64decode(dom.getElementsByTagName('Exponent')[0].childNodes[0].data) n = base64.b64decode(dom.getElementsByTagName('Modulus')[0].childNodes[0].data) rsa = RSA.new_pub_key((e, n)) Got