title: How do you extract N and E from a RSA public key in python?
body: <p>I have a RSA public key such that it looks like </p>
  
  <pre><code>-----BEGIN PUBLIC KEY-----
  MIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEAvm0WYXg6mJc5GOWJ+5jk
  htbBOe0gyTlujRER++cvKOxbIdg8So3mV1eASEHxqSnp5lGa8R9Pyxz3iaZpBCBB
  vDB7Fbbe5koVTmt+K06o96ki1/4NbHGyRVL/x5fFiVuTVfmk+GZNakH5dXDq0fwv
  JyVmUtGYAiMJWPni2hGpAsbyjzLix9UNX5XiYIIrIr55IHtD5u1XNkmYLOdVQ98r
  6hez3t2eaE0pP2k+mjRach+2tD93PBZmreHgVZtejumi+ZWLMqpd++AY0AzH0m8E
  6sa8JFUAiYZbVtmrcGTCUCkzC2Es1/knSeZ41xki1qD0V3uw/APP8Q+BgbX3SJp0
  EQIBAw==
  -----END PUBLIC KEY-----
  </code></pre>
  
  <p>I want to find out what the modulo N and exponent E are from this key, in python?</p>
  
  <p>Using pycrypto package I am able to load to the key as such:</p>
  
  <pre><code>from Crypto.PublicKey import RSA
  
  # read the public key in:
  public_key = RSA.importKey(open('key.pub', 'r').read())
  </code></pre>
  
  <p>but following the documentation of <a href="https://www.dlitz.net/software/pycrypto/api/current/Crypto.PublicKey.RSA-module.html" rel="noreferrer">pycrypto's rsa module</a> It wasn't clear how to extract the smaller components. How do I do this?</p>