-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenPGP: added test key and real test environment.
- Loading branch information
1 parent
ee9cadd
commit 6fc9f35
Showing
6 changed files
with
158 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
First test key material created with | ||
|
||
Package: gnupg2 | ||
Architecture: i386 | ||
Version: 2.0.25-99intevation2 | ||
|
||
libgcrypt 1.5.3 | ||
|
||
test1.intelmq@example.org | ||
-------------------------- | ||
|
||
``` | ||
LANG=C GNUPGHOME=~/tmp/dot.gnupg gpg2 --full-gen-key | ||
RSA (sign only) | ||
Requested keysize is 4096 bits | ||
Key does not expire at all | ||
Real name: Test1 IntelMQ | ||
Email address: test1.intelmq@example.org | ||
Comment: no passphrase | ||
``` | ||
|
||
``` | ||
LANG=C GNUPGHOME=~/tmp/dot.gnupg gpg2 --export-secret-key test1 >test1.gpg | ||
LANG=C GNUPGHOME=~/tmp/dot.gnupg gpg2 --armor --export test1 >test1.pub | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v2 | ||
|
||
mQINBFdO3UsBEADLQUlMuWZbj64i54kO4/4I6JIjzd9ko4VTKYm/1BHeWA6+lxBk | ||
sxzQ+9oYFJqqG5F22iJ1T/x0W5cgXqGz5ihyAXld6EfbDi6NbDVtbtYrYYZQcHCs | ||
TAhk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iwJnNxUEfD | ||
DzOuEWw0+0XNAszXCvc9DqO/1WlVOI8mtTXuunY3sK8MJ1IRgPjUaJT2waYWDELb | ||
icFYwvVdnJr+I+y+b4mc/RL8hAgjMAY/nf+MAVg1l6XORtlGvGbTsH1/wLQcmPre | ||
jnY7ufWYn5afvxo/XZt6/T8SAOYf0y89D1zN0ZGzLEf7QD4+3YQ+M/+i/qYe4W/m | ||
MolwGaLqrXDEJTkCYf/I1C/Q3q0R68nighXl7hAbnJstWYc8Pik7uy2+xKfK5adS | ||
GCR/TEvGT1BtVQVSdPlMf6bLRtnVp+361tOOR+Sw3HbTfdmxJ5qN7gsqhI4Va5LS | ||
QZUfa8SQ3qtwqa2OhKQDsIbjpZGmcTn77gRB17PNR/VTecvQzOKPGcI9lYGbfl1a | ||
IRFOLVjGJQ== | ||
=/QOZ | ||
-----END PGP PUBLIC KEY BLOCK----- |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"""Support test cases with pygpgme. | ||
Initially imported from https://pypi.python.org/pypi/pygpgme/0.3 | ||
sha256sum pygpgme-0.3.tar.gz | ||
5fd887c407015296a8fd3f4b867fe0fcca3179de97ccde90449853a3dfb802e1 | ||
# pygpgme - a Python wrapper for the gpgme library | ||
# Copyright (C) 2006 James Henstridge | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2.1 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
""" | ||
|
||
import os | ||
import shutil | ||
import tempfile | ||
import unittest | ||
|
||
import gpgme | ||
|
||
__all__ = ['GpgHomeTestCase'] | ||
|
||
keydir = os.path.join(os.path.dirname(__file__), 'keys') | ||
|
||
class GpgHomeTestCase(unittest.TestCase): | ||
|
||
gpg_conf_contents = '' | ||
import_keys = [] | ||
|
||
def keyfile(self, key): | ||
return open(os.path.join(keydir, key), 'rb') | ||
|
||
def setUp(self): | ||
self._gpghome = tempfile.mkdtemp(prefix='tmp.gpghome') | ||
os.environ['GNUPGHOME'] = self._gpghome | ||
fp = open(os.path.join(self._gpghome, 'gpg.conf'), 'wb') | ||
fp.write(self.gpg_conf_contents.encode('UTF-8')) | ||
fp.close() | ||
|
||
# import requested keys into the keyring | ||
ctx = gpgme.Context() | ||
for key in self.import_keys: | ||
with self.keyfile(key) as fp: | ||
ctx.import_(fp) | ||
|
||
def tearDown(self): | ||
del os.environ['GNUPGHOME'] | ||
#shutil.rmtree(self._gpghome, ignore_errors=True) |