title: Sign a message with DSA with library pyOpenSSL
body: <p>This is my first question here, because I have not found a solution for this. Hopefully someone has an answer for this issue.</p>
  
  <p>I try to sign and verify a message with DSA (Digital Signature Algorithm) and pyOpenSSL wrapper.</p>
  
  <p>I've created an example below:</p>
  
  <pre><code>from OpenSSL.crypto import TYPE_DSA, Error, PKey
  from OpenSSL.crypto import FILETYPE_PEM, sign
  from Crypto.Hash import SHA
  key = PKey()
  key.generate_key(TYPE_DSA, 1024)
  message = "abc"
  digest = SHA.new(message).digest()
  data_to_sign = base64.b64encode(digest)
  signature = sign(key, data_to_sign, 'sha1')
  </code></pre>
  
  <p>After running this piece of code I'll get the following result:</p>
  
  <pre><code>OpenSSL.crypto.Error: [('digital envelope routines', 'EVP_SignFinal', 'wrong public key type')]
  </code></pre>