Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Add variable to specify gpg binary path #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions corpus/OpenPGP/gnupg-import
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

GPG=gpg

mkdir -p -m 0700 GNUPGHOME
export GNUPGHOME=$(pwd)/GNUPGHOME

Expand All @@ -9,7 +11,7 @@ no-allow-external-cache
EOF

for x in winston obrian julia; do
<$x.key gpg2 --batch --pinentry-mode=loopback --passphrase=_${x}_ --import
<$x.key $(GPG) --batch --pinentry-mode=loopback --passphrase=_${x}_ --import
done

# mark all keys with ultimate ownertrust. This is a silly hack, but
Expand All @@ -20,7 +22,7 @@ done
# pragmatically handle all the secret keys in a single homedir. For
# now, we're opting for the latter.

gpg2 --import-ownertrust <<EOF
$(GPG) --import-ownertrust <<EOF
5A7AD43844FB30BE7DB1B3FD15FB4EBC8E2D6CB7:6
9A9CC2E1546C7A04D23048641BC98889B8EA08B3:6
2BC85B8EF240B7422E9C19F2E0D7563140A09310:6
Expand Down
13 changes: 7 additions & 6 deletions generators/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import re
import subprocess

GPG = 'gpg'

data = {
'txt': '''This is a test
message on multiple lines

with a silly bit more.
--
--
and a .sig here.
''',
'html': '''<html>
Expand Down Expand Up @@ -81,8 +83,8 @@ def render_mime_structure(z, prefix='└', stream=sys.stdout):
subject = ''
if (z.is_multipart()):
print(prefix + '┬╴' + z.get_content_type() + cset +
disposition + fname, z.as_string().__len__().__str__()
+ ' bytes' + subject, file=stream)
disposition + fname, z.as_string().__len__().__str__()
+ ' bytes' + subject, file=stream)
if prefix.endswith('└'):
prefix = prefix.rpartition('└')[0] + ' '
if prefix.endswith('├'):
Expand Down Expand Up @@ -146,7 +148,7 @@ def get_password_from(self):
def sign(self,body,sender=None):
if not sender:
sender = self.get('From')
g = subprocess.Popen(['gpg2', '--batch',
g = subprocess.Popen([GPG, '--batch',
'--homedir=corpus/OpenPGP/GNUPGHOME',
'--pinentry-mode=loopback',
'--passphrase', self.get_password_from(),
Expand Down Expand Up @@ -180,7 +182,7 @@ def sign(self,body,sender=None):


def encrypt(self,body, sign=False):
args = ['gpg2', '--batch',
args = [GPG, '--batch',
'--homedir=corpus/OpenPGP/GNUPGHOME',
'--no-emit-version',
'--armor',
Expand Down Expand Up @@ -241,4 +243,3 @@ def main(self):
if self.extended_description:
print(self.extended_description, file=descstream)
render_mime_structure(self, stream=descstream)