Skip to content

Unable to import private key with passpharse #284

@pajuscz

Description

@pajuscz

I came across this while looking into this closed issue: #194

I wasn't able to import private key with passpharse using the same method. What happens is that public key is imported, but not the secret key - I cannot decrypt data after I do the import.

While looking into the code I don't think it is possible to import a key using passpharse, because the passpharse is set to False by default.

The _handle_io:
def _handle_io(self, args, file, result, passphrase=False, binary=False):

called from import_keys(self, key_data) is called in this fashion:
self._handle_io(['--import'], data, result, binary=True) I don't see a way to pass passphase there.

When I 'hard-code' the passphasee into the self._handle_io(['--import'], data, result, passphrase='secret', binary=True)
It works as expected. I think there should be a posibility to pass passpharse as an argument into GPG.import_keys()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions