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 error:
...
rsa = RSA.new_pub_key((e, n))
File "/usr/lib/pymodules/python2.6/M2Crypto/RSA.py", line 390, in new_pub_key
m2.rsa_set_e(rsa, e)
M2Crypto.RSA.RSAError: invalid length
Any ideas?