summaryrefslogtreecommitdiff
path: root/tickets/b6df8a5d7d3d4b7e8c2ddf8c95cfc33d/Maildir/new/1455998995.M179764P17339Q28.exolobe1
blob: f66b451c55f7cc252bfebb9ecfe9b487a9a79849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Return-Path: <obnam-dev-bounces@obnam.org>
X-Original-To: distix@pieni.net
Delivered-To: distix@pieni.net
Received: from bagpuss.pepperfish.net (bagpuss.pepperfish.net [148.251.8.16])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pieni.net (Postfix) with ESMTPS id CBDA02B256
	for <distix@pieni.net>; Fri, 25 Sep 2015 07:38:22 +0200 (CEST)
Received: from platypus.pepperfish.net (unknown [10.112.100.20])
	by bagpuss.pepperfish.net (Postfix) with ESMTP id 7DD20BA5;
	Fri, 25 Sep 2015 06:38:22 +0100 (BST)
Received: from ip6-localhost ([::1] helo=platypus.pepperfish.net)
	by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
	id 1ZfLiA-0006wu-BT; Fri, 25 Sep 2015 06:38:22 +0100
Received: from inmail0 ([10.112.100.10] helo=mx0.pepperfish.net)
 by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
 id 1ZfLi8-0006wm-Ht
 for <obnam-dev@obnam.org>; Fri, 25 Sep 2015 06:38:20 +0100
Received: from mail-ig0-f170.google.com ([209.85.213.170])
 by mx0.pepperfish.net with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128)
 (Exim 4.80) (envelope-from <mathstuf@gmail.com>) id 1ZfLi6-0005Qw-Rf
 for obnam-dev@obnam.org; Fri, 25 Sep 2015 06:38:20 +0100
Received: by igbkq10 with SMTP id kq10so4584899igb.0
 for <obnam-dev@obnam.org>; Thu, 24 Sep 2015 22:38:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=Oyvo68dvp0hPQFMuJiv3Ln+MyNaOa5ds+ACUQaFtda4=;
 b=P1SKsrSYSkBxLhHYvKLw8m+fIXGqgmF2822yJi21Naw8cIuJUsdOdjj+i9/OcyPNiA
 VKVCPV+YHMp5+HXef8zhvNh7pp5fCmK7xcRxsBO4frMvv2d/4zVRJQLT5uHQUP8sv6eO
 MUHyCRqDrmhynE3ja5ey1ocNm+fwF0dPC4lavfgu12npMdaJjzv5c0SVxJprzsdsQ0Wq
 w4Jt+qpltCChghwGCOSRWKEibqj5Uo/Mq4su3acsa5wrKNQavP+HS0NWbAr/4te/xqm0
 B+gz5mqIyRLEHqSeVj/mH7Z2S7tHUtSH8fdnT95mp1SWqUNkCHP2cVEKAOs+yNLUtlNx
 t0vw==
X-Received: by 10.50.30.226 with SMTP id v2mr783605igh.11.1443159486600;
 Thu, 24 Sep 2015 22:38:06 -0700 (PDT)
Received: from localhost (26.sub-70-209-128.myvzw.com. [70.209.128.26])
 by smtp.gmail.com with ESMTPSA id ht6sm758051igb.11.2015.09.24.22.38.04
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 24 Sep 2015 22:38:05 -0700 (PDT)
From: Ben Boeckel <mathstuf@gmail.com>
To: obnam-dev@obnam.org
Date: Fri, 25 Sep 2015 01:37:52 -0400
Message-Id: <1443159474-27126-3-git-send-email-mathstuf@gmail.com>
X-Mailer: git-send-email 2.5.3
In-Reply-To: <1443159474-27126-1-git-send-email-mathstuf@gmail.com>
References: <1441948936-12526-1-git-send-email-mathstuf@gmail.com>
 <1443159474-27126-1-git-send-email-mathstuf@gmail.com>
X-Spam-Score: -0.5
X-Spam-Score-int: -4
X-Spam-Bar: /
X-Scanned-By: pepperfish.net, Fri, 25 Sep 2015 06:38:20 +0100
X-Spam-Report: Content analysis details: (-0.5 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.0 PPF_FROM_CONTAINS_MAIL The From header contains 'mail'
 1.2 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (mathstuf[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
 domain
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
 not necessarily valid
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
 trust [209.85.213.170 listed in list.dnswl.org]
X-ACL-Warn: message may be spam
X-Scan-Signature: 37750eb53cbbcd37f0cf4d6178be310e
Cc: Ben Boeckel <mathstuf@gmail.com>
Subject: [PATCH v4 2/4] encryption: support custom gpghome in symmetric key
	functions
X-BeenThere: obnam-dev@obnam.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Obnam development discussions <obnam-dev-obnam.org>
List-Unsubscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=unsubscribe>
List-Archive: <http://listmaster.pepperfish.net/pipermail/obnam-dev-obnam.org>
List-Post: <mailto:obnam-dev@obnam.org>
List-Help: <mailto:obnam-dev-request@obnam.org?subject=help>
List-Subscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=subscribe>
Sender: obnam-dev-bounces@obnam.org
Errors-To: obnam-dev-bounces@obnam.org

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 obnamlib/encryption.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index d76193c..bed4e66 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -67,7 +67,7 @@ class SymmetricKeyCache(object):
         self.repos = {}
 
 
-def _gpg_pipe(args, data, passphrase):
+def _gpg_pipe(args, data, passphrase, gpghome=None):
     '''Pipe things through gpg.
 
     With the right args, this can be either an encryption or a decryption
@@ -91,7 +91,8 @@ def _gpg_pipe(args, data, passphrase):
     os.close(keypipe[1])
 
     try:
-        out = _gpg(args + ['--passphrase-fd', str(keypipe[0])], stdin=data)
+        out = _gpg(args + ['--passphrase-fd', str(keypipe[0])], stdin=data,
+                   gpghome=gpghome)
     except: # pragma: no cover
         os.close(keypipe[0])
         raise
@@ -101,14 +102,14 @@ def _gpg_pipe(args, data, passphrase):
     return out
 
 
-def encrypt_symmetric(cleartext, key):
+def encrypt_symmetric(cleartext, key, gpghome=None):
     '''Encrypt data with symmetric encryption.'''
-    return _gpg_pipe(['-c'], cleartext, key)
+    return _gpg_pipe(['-c'], cleartext, key, gpghome=gpghome)
 
 
-def decrypt_symmetric(encrypted, key):
+def decrypt_symmetric(encrypted, key, gpghome=None):
     '''Decrypt encrypted data with symmetric encryption.'''
-    return _gpg_pipe(['-d'], encrypted, key)
+    return _gpg_pipe(['-d'], encrypted, key, gpghome=gpghome)
 
 
 def _gpg(args, stdin='', gpghome=None):
-- 
2.5.3


_______________________________________________
obnam-dev mailing list
obnam-dev@obnam.org
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org