| |
@@ -7,6 +7,7 @@
|
| |
import sys
|
| |
|
| |
from .exceptions import GpgErrorException, KeygenServiceBaseException
|
| |
+ from .gpg import gpg_cmd
|
| |
|
| |
log = logging.getLogger(__name__)
|
| |
|
| |
@@ -43,9 +44,7 @@
|
| |
:raises: GpgErrorException
|
| |
|
| |
"""
|
| |
- cmd = [app.config["GPG_BINARY"],
|
| |
- "--homedir", app.config["GNUPG_HOMEDIR"],
|
| |
- "--list-secret-keys", "--with-colons", "<{0}>".format(mail)]
|
| |
+ cmd = gpg_cmd + ["--list-secret-keys", "--with-colons", "<{0}>".format(mail)]
|
| |
|
| |
try:
|
| |
handle = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
| |
@@ -56,7 +55,7 @@
|
| |
cmd=" ".join(cmd), err=e)
|
| |
|
| |
if handle.returncode == 0:
|
| |
- # TODO: validate that we really got exactly one line in stdout
|
| |
+ # TODO: validate that the key is ultimately trusted
|
| |
log.debug("user {} has keys in keyring".format(mail))
|
| |
ensure_passphrase_exist(app, mail)
|
| |
return True
|
| |
@@ -120,11 +119,7 @@
|
| |
raise GpgErrorException(msg="Failed to write tmp file for gen_key",
|
| |
err=e)
|
| |
|
| |
- cmd = [
|
| |
- app.config["GPG_BINARY"], "--batch",
|
| |
- "--homedir", app.config["GNUPG_HOMEDIR"],
|
| |
- "--gen-key", out.name
|
| |
- ]
|
| |
+ cmd = gpg_cmd + ["--batch", "--gen-key", out.name]
|
| |
|
| |
log.debug("CMD: {}".format(' '.join(map(str, cmd))))
|
| |
try:
|
| |