title: Module 'Crypto.PublicKey.RSA' has no attribute 'import_key'
body: <p>I have a C# application that uses following public keys to encrypt and decrypt (using corresponding private key) successfully. I am using the same Public Key in Python to encrypt, using following code. I am getting following error:</p>
  
  <blockquote>
    <p>module 'Crypto.PublicKey.RSA' has no attribute 'import_key'</p>
  </blockquote>
  
  <p>I referred <a href="https://pycryptodome.readthedocs.io/en/latest/src/public_key/rsa.html" rel="nofollow noreferrer">RSA - pycryptodome.readthedocs.io</a> to check 'import_key'. It says <code>extern_key (string or byte string)</code>.</p>
  
  <p>Note: I have <code>pycrypto 2.6.1</code>  installed. Verified using <code>conda list</code>.</p>
  
  <p>How to fix this so that Python can use the same key that was successfully used by C# application?</p>
  
  <p><strong>Python Code</strong></p>
  
  <pre><code>import Crypto
  from Crypto.PublicKey import RSA
  pubkey = 'BgIAAACkAABSU0ExAAQAAAEAAQB5ad3IFUIQ+NJeJEVlHJb0BaXhPCpeP+477ql+2dsNLzpn+3f2Lm5UWZhig60rx7/5/rAlAH+emU6WwOZNxtMtFbdu9CNBUjRp9FiEmJHZLaGqqmEFDyp287k3HVCFVzxxRAEy8ftL/q6KaE3KKrHoFiMozretUXulYy5OE1yR7w=='
  
  import base64
  decodedPublicKey = base64.b64decode(pubkey)
  pub_key = RSA.import_key(decodedPublicKey)
  encrypted = pub_key.encrypt('hello world', None)
  print(encrypted)
  text = pvt_key.decrypt(encrypted)
  print(text)
  </code></pre>