Python gnupg does not generate key

324 Views Asked by At

I was trying to generate a key with python-gnupg library. My code is running perfectly but it is not creating a key.

Code:

import gnupg

gpg = gnupg.GPG()

# generate key
input_data = gpg.gen_key_input(
    name_real='name',
    name_email='[email protected]',
    passphrase='passphrase',
    key_type='EDDSA', 
    key_curve='ed25519',
    key_usage='sign encrypt',
    subkey_type='ecdh',
    subkey_curve='cv25519',
    expire_date='2y'
)
key = gpg.gen_key(input_data)
print(key)

I have found that if I remove "key_usage" it generates the key, but I want to generate the key with "key_usage".

I have followed this link to generate a key: https://gnupg.readthedocs.io/en/latest/.

I will be happy to hear your suggestions.

0

There are 0 best solutions below