1#!/usr/bin/env python
2
3# Copyright (C) 2016 g10 Code GmbH
4#
5# This file is part of GPGME.
6#
7# GPGME is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# GPGME is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
15# Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public
18# License along with this program; if not, see <https://www.gnu.org/licenses/>.
19
20from __future__ import absolute_import, print_function, unicode_literals
21
22import os
23import subprocess
24import gpg
25import support
26
27del absolute_import, print_function, unicode_literals
28
29print("Using gpg module from {0!r}.".format(os.path.dirname(gpg.__file__)))
30
31subprocess.check_call([
32    os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"),
33    "--start"
34])
35
36with gpg.Context() as c:
37    alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
38    bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
39
40    # Mark alpha as trusted.  The signature verification tests expect
41    # this.
42    support.mark_key_trusted(c, alpha)
43
44    c.op_import(open(support.in_srcdir("encrypt-only.asc")))
45    c.op_import(open(support.in_srcdir("sign-only.asc")))
46