summaryrefslogtreecommitdiff
path: root/obnamlib/encryption.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-07-26 14:23:55 +0100
committerLars Wirzenius <liw@liw.fi>2011-07-26 14:23:55 +0100
commit44a058b354d14babc8e019b8d2811c853428e236 (patch)
treed06c923e03d0157f93d5657d38a860c8aec79490 /obnamlib/encryption.py
parentf72419406ef2f3dd1aa3814b6966973f09c38bf5 (diff)
downloadobnam-44a058b354d14babc8e019b8d2811c853428e236.tar.gz
Add tracing and logging to help finding missing node bugs.
Diffstat (limited to 'obnamlib/encryption.py')
-rw-r--r--obnamlib/encryption.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index 39b88470..4ea2b3db 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -18,12 +18,15 @@ import os
import shutil
import subprocess
import tempfile
+import tracing
import obnamlib
def generate_symmetric_key(numbits, filename='/dev/random'):
'''Generate a random key of at least numbits for symmetric encryption.'''
+
+ tracing.trace('numbits=%d', numbits)
bytes = (numbits + 7) / 8
f = open(filename, 'rb')
@@ -80,6 +83,7 @@ def _gpg_pipe(args, data, passphrase):
# Actually run gpg.
argv = ['gpg', '--passphrase-fd', str(keypipe[0]), '-q', '--batch'] + args
+ tracing.trace('argv=%s', repr(argv))
p = subprocess.Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate(data)
@@ -112,6 +116,7 @@ def _gpg(args, stdin='', gpghome=None):
env['GNUPGHOME'] = gpghome
argv = ['gpg', '-q', '--batch'] + args
+ tracing.trace('argv=%s', repr(argv))
p = subprocess.Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
out, err = p.communicate(stdin)