jaymzh / pius

PGP Individual User Signer
Other
97 stars 25 forks source link

Fix Remove signing key from trustdb (#47) #55

Closed pstarrev closed 7 years ago

pstarrev commented 7 years ago

When pius imports the keys into the temporary pius_pubring.gpg using gpg2 the signing key may end up being removed from the default ownertrust database ~/.gnupg/trustdb.gpg (Issue #47).

This fix prevents pius from removing the signing key from the default ownertrust database by:

pstarrev commented 7 years ago

Hi Phil,

Many thanks for the review. I have updated the clean_clean_key function as you suggested with one minor change.

Using:

paths = [self._tmpfile_path('%s.asc', x) for x in [self.signer, key]]

leads to the following _tempfile.path error:

TypeError: _tmpfile_path() takes exactly 2 arguments (3 given)

You probably intended this as:

paths = [self._tmpfile_path('%s.asc' % x) for x in [self.signer, key]]

I changed the remaining 'for k in' clauses from the initial pull request into 'for x in' clauses as well for consistency.

The above changes have been committed and uploaded to GitHub i.e. added to the pull request.  

Kind regards, Piet

On zo, 2017-02-26 at 13:08 -0800, Phil Dibowitz wrote:

@jaymzh requested changes on this pull request. This is really nice, thank you. One small change. In libpius/signer.py:

      def clean_clean_key(self, key):      '''Delete the "clean" unsigned key which we exported temporarily.''' -    path = self._tmpfile_path('%s.asc' % key) -    clean_files([path]) +    # Remove the temporary exports of the public keys +    for k in [self.signer, key]: +        path = self._tmpfile_path('%s.asc' % k) +        clean_files([path]) it takes a list... paths = [self._tmpfile_path('%s.asc', x) for x in [self.signer, key]] clean_files(paths) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jaymzh commented 7 years ago

I actually prefer k to x, but whatever. :) Thanks so much for doing this.