title: python string format pkcs8 RSA signature
body: <p>I need to use pkcs8 private key in my project as example below, I can't found any library or  method relate to pkcs8 signature only pkcs1 are available for the <code>Crypto.Signature</code>.</p>
  
  <p>My python code example:</p>
  
  <pre class="lang-py prettyprint-override"><code>from Crypto.Signature import PKCS1_v1_5
  from Crypto.Hash import SHA
  from Crypto.PublicKey import RSA
  
  privatekey='''-----BEGIN PRIVATE KEY-----
  MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOuxJs5RD6s2ECEV
  C38Jfj6xBBrcX6W1Qy+GLiXhh+wKj650BPSerQNQI+XPx/+uUemk/dJM3RMm75Di
  mXJlp7/5LY11VyKSqS+x6ELIvWz8lo2OhHW6/wU4jiQ1MlburYbn/pRRClGGA8i4
  FjHMvMu9/QCNPlNTlf7qJDO6lDVlAgMBAAECgYB0iP76/DGXIgAPm2w3v+Xf8X5q
  GZRhRqKVmO6wZDbkisRIKa1ZlitNfA6DzpzA2tw9fgrSNJcKpTHGnYPpgEHUQrcw
  t471yuAvzAOBffaqVjIt7vKyL3QnkNfxWenliasacX3olwBpKPrkvG75H2KBe9S0
  WKpju1Cm6MebAJ3z8QJBAP8gSx3l9nNTqJcBBmP+TGDcTL9Sif2nBZrU/pWnzzop
  HolaFIQTYXPIj8rMoVT/c0gLo1gcdHoSUJTbB0WO7V8CQQDsf9FAWCI3fkWgS/fW
  21ApO6B07/388CpNHOTjvfsdlent4yXLL+Guh5apMH4Oq0tkGkEij5YPG1EZSYXi
  48+7AkEAiX3m3ZMMMXTZe5/CyOrIUL8I4WbjFP8JJzs4hICuTmLQoScZvWAQeeyR
  ibKkE4GjqCUVf6u+Hfd20/ICRjtTswJANCjEh8JoWYDZ7k6S7KoV9eIWs3OyurRl
  P/idarUdyxqjKzorvbJjvdBdpBbz1lxlFkDMGMk+OTq3GjKi+rVvvQJAGhBieR2Q
  69JNeoOg7J8Xk7evNBJHwtJfRDQXKJpN5YZsKclf6oRaYFEQOM6ThuNoYHISfGKw
  UbDoUsPZoQFPtQ==
  -----END PRIVATE KEY-----'''
  
  signstr = testdata123
  
  key = RSA.importKey(privatekey) 
  h = SHA.new(signstr) 
  signer = PKCS1_v1_5.new(key) 
  signature = signer.sign(h) 
  sign = base64.b64encode(signature) 
  </code></pre>
  
  <p>The signature generated by code above do not match the public key in the api system I am using.</p>
  
  <p>For PHP side I am able to sign correctly. The working code for PHP as below:</p>
  
  <pre class="lang-php prettyprint-override"><code>$private_key= openssl_get_privatekey($private_key);
  openssl_sign($signStr,$sign_info,$private_key,OPENSSL_ALGO_MD5);
  $sign = base64_encode($sign_info);
  </code></pre>
  
  <p>Any advice on how to sign with RSA pkcs8 format private key using python is much appreciated.</p>