This is my first question here, because I have not found a solution for this. Hopefully someone has an answer for this issue.
I try to sign and verify a message with DSA (Digital Signature Algorithm) and pyOpenSSL wrapper.
I've created an example below:
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')
After running this piece of code I'll get the following result:
OpenSSL.crypto.Error: [('digital envelope routines', 'EVP_SignFinal', 'wrong public key type')]