Imported Upstream version 1.12.0
[platform/upstream/gpgme.git] / lang / python / tests / t-export.py
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 <http://www.gnu.org/licenses/>.
19
20 from __future__ import absolute_import, print_function, unicode_literals
21
22 import gpg
23 import support
24
25 del absolute_import, print_function, unicode_literals
26
27 c = gpg.Context()
28 c.set_armor(True)
29
30 sink = gpg.Data()
31 c.op_export_ext(['Alpha', 'Bob'], 0, sink)
32 support.print_data(sink)
33
34 # Again. Now using a key array.
35 keys = []
36 keys.append(c.get_key("0x68697734", False))  # Alpha
37 keys.append(c.get_key("0xA9E3B0B2", False))  # Bob
38 sink = gpg.Data()
39 c.op_export_keys(keys, 0, sink)
40 support.print_data(sink)