Mercurial > libervia-backend
annotate sat_frontends/jp/cmd_encryption.py @ 3049:9839ce068140
jp: password is now prompted if needed:
if password is not specified on command line, it is now prompted if it is needed to start
a profile session or connect it. The password is prompted with echo disabled, so somebody
seing the computer screen can't see the password.
fix 207
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Oct 2019 22:49:11 +0200 |
parents | fee60f17ebac |
children | 7574f795bd1e |
rev | line source |
---|---|
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # jp: a SAT command line tool |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 from sat_frontends.jp import base |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 from sat_frontends.jp.constants import Const as C |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from sat.core.i18n import _ |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from sat.tools.common import data_format |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from sat_frontends.jp import xmlui_manager |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 __commands__ = ["Encryption"] |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 class EncryptionAlgorithms(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 extra_outputs = {"default": self.default_output} |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 super(EncryptionAlgorithms, self).__init__( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 host, "algorithms", |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 use_output=C.OUTPUT_LIST_DICT, |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 extra_outputs=extra_outputs, |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 use_profile=False, |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 help=_("show available encryption algorithms")) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 def add_parser_options(self): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 pass |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 def default_output(self, plugins): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 if not plugins: |
3028 | 45 self.disp(_("No encryption plugin registered!")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 else: |
3028 | 47 self.disp(_("Following encryption algorithms are available: {algos}").format( |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 algos=', '.join([p['name'] for p in plugins]))) |
3040 | 49 |
50 async def start(self): | |
51 try: | |
52 plugins = await self.host.bridge.encryptionPluginsGet() | |
53 except Exception as e: | |
54 self.disp(f"can't retrieve plugins: {e}", error=True) | |
55 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
56 else: | |
57 await self.output(plugins) | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 self.host.quit() |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 class EncryptionGet(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 super(EncryptionGet, self).__init__( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 host, "get", |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 use_output=C.OUTPUT_DICT, |
3028 | 67 help=_("get encryption session data")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 def add_parser_options(self): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 self.parser.add_argument( |
3028 | 71 "jid", |
72 help=_("jid of the entity to check") | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 ) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 |
3040 | 75 async def start(self): |
76 jids = await self.host.check_jids([self.args.jid]) | |
77 jid = jids[0] | |
78 try: | |
79 serialised = await self.host.bridge.messageEncryptionGet(jid, self.profile) | |
80 except Exception as e: | |
81 self.disp(f"can't get session: {e}", error=True) | |
82 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
83 | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 session_data = data_format.deserialise(serialised) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 if session_data is None: |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 self.disp( |
3028 | 87 "No encryption session found, the messages are sent in plain text.") |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 self.host.quit(C.EXIT_NOT_FOUND) |
3040 | 89 await self.output(session_data) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 self.host.quit() |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 class EncryptionStart(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 super(EncryptionStart, self).__init__( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 host, "start", |
3028 | 98 help=_("start encrypted session with an entity")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 def add_parser_options(self): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 self.parser.add_argument( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 "--encrypt-noreplace", |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 action="store_true", |
3028 | 104 help=_("don't replace encryption algorithm if an other one is already used")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 algorithm = self.parser.add_mutually_exclusive_group() |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 algorithm.add_argument( |
3028 | 107 "-n", "--name", help=_("algorithm name (DEFAULT: choose automatically)")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 algorithm.add_argument( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 "-N", "--namespace", |
3028 | 110 help=_("algorithm namespace (DEFAULT: choose automatically)")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 self.parser.add_argument( |
3028 | 112 "jid", |
113 help=_("jid of the entity to stop encrypted session with") | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 ) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 |
3040 | 116 async def start(self): |
117 if self.args.name is not None: | |
118 try: | |
119 namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name) | |
120 except Exception as e: | |
121 self.disp(f"can't get encryption namespace: {e}", error=True) | |
122 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
123 elif self.args.namespace is not None: | |
124 namespace = self.args.namespace | |
125 else: | |
126 namespace = "" | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 |
3040 | 128 jids = await self.host.check_jids([self.args.jid]) |
129 jid = jids[0] | |
130 | |
131 try: | |
132 await self.host.bridge.messageEncryptionStart( | |
133 jid, namespace, not self.args.encrypt_noreplace, | |
134 self.profile) | |
135 except Exception as e: | |
136 self.disp(f"can't get encryption namespace: {e}", error=True) | |
137 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
138 | |
139 self.host.quit() | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 class EncryptionStop(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 super(EncryptionStop, self).__init__( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 host, "stop", |
3028 | 147 help=_("stop encrypted session with an entity")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 def add_parser_options(self): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 self.parser.add_argument( |
3028 | 151 "jid", |
152 help=_("jid of the entity to stop encrypted session with") | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 ) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 |
3040 | 155 async def start(self): |
156 jids = await self.host.check_jids([self.args.jid]) | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
157 jid = jids[0] |
3040 | 158 try: |
159 await self.host.bridge.messageEncryptionStop(jid, self.profile) | |
160 except Exception as e: | |
161 self.disp(f"can't end encrypted session: {e}", error=True) | |
162 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
163 | |
164 self.host.quit() | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
165 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
166 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
167 class TrustUI(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
168 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
169 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 super(TrustUI, self).__init__( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
171 host, "ui", |
3028 | 172 help=_("get UI to manage trust")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
173 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
174 def add_parser_options(self): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 self.parser.add_argument( |
3028 | 176 "jid", |
177 help=_("jid of the entity to stop encrypted session with") | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 ) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 algorithm = self.parser.add_mutually_exclusive_group() |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 algorithm.add_argument( |
3028 | 181 "-n", "--name", help=_("algorithm name (DEFAULT: current algorithm)")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
182 algorithm.add_argument( |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
183 "-N", "--namespace", |
3028 | 184 help=_("algorithm namespace (DEFAULT: current algorithm)")) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
185 |
3040 | 186 async def start(self): |
187 if self.args.name is not None: | |
188 try: | |
189 namespace = await self.host.bridge.encryptionNamespaceGet(self.args.name) | |
190 except Exception as e: | |
191 self.disp(f"can't get encryption namespace: {e}", error=True) | |
192 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
193 elif self.args.namespace is not None: | |
194 namespace = self.args.namespace | |
195 else: | |
196 namespace = "" | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
197 |
3040 | 198 jids = await self.host.check_jids([self.args.jid]) |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
199 jid = jids[0] |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 |
3040 | 201 try: |
202 xmlui_raw = await self.host.bridge.encryptionTrustUIGet( | |
203 jid, namespace, self.profile) | |
204 except Exception as e: | |
205 self.disp(f"can't get encryption session trust UI: {e}", error=True) | |
206 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
207 |
3040 | 208 xmlui = xmlui_manager.create(self.host, xmlui_raw) |
209 await xmlui.show() | |
210 if xmlui.type != C.XMLUI_DIALOG: | |
211 await xmlui.submitForm() | |
212 self.host.quit() | |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
213 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
214 class EncryptionTrust(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
215 subcommands = (TrustUI,) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
216 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
217 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
218 super(EncryptionTrust, self).__init__( |
3028 | 219 host, "trust", use_profile=False, help=_("trust manangement") |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 ) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
222 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
223 class Encryption(base.CommandBase): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
224 subcommands = (EncryptionAlgorithms, EncryptionGet, EncryptionStart, EncryptionStop, |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
225 EncryptionTrust) |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
226 |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
227 def __init__(self, host): |
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
228 super(Encryption, self).__init__( |
3028 | 229 host, "encryption", use_profile=False, help=_("encryption sessions handling") |
2740
8fd8ce5a5855
jp (message/send, encryption): encryption handling:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
230 ) |