rtty-soda 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rtty-soda might be problematic. Click here for more details.
- rtty_soda/cli_io.py +4 -4
- rtty_soda/main.py +161 -97
- {rtty_soda-0.2.2.dist-info → rtty_soda-0.2.3.dist-info}/METADATA +50 -70
- {rtty_soda-0.2.2.dist-info → rtty_soda-0.2.3.dist-info}/RECORD +6 -6
- {rtty_soda-0.2.2.dist-info → rtty_soda-0.2.3.dist-info}/WHEEL +0 -0
- {rtty_soda-0.2.2.dist-info → rtty_soda-0.2.3.dist-info}/entry_points.txt +0 -0
rtty_soda/cli_io.py
CHANGED
|
@@ -106,8 +106,8 @@ def write_output(target: Path | None, data: bytes) -> None:
|
|
|
106
106
|
write_bytes_atomic(target, data)
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
def print_stats(plaintext:
|
|
110
|
-
click.echo(f"Plaintext: {
|
|
111
|
-
click.echo(f"Ciphertext: {
|
|
112
|
-
overhead =
|
|
109
|
+
def print_stats(plaintext: int, ciphertext: int) -> None:
|
|
110
|
+
click.echo(f"Plaintext: {plaintext}", err=True)
|
|
111
|
+
click.echo(f"Ciphertext: {ciphertext}", err=True)
|
|
112
|
+
overhead = ciphertext / plaintext
|
|
113
113
|
click.echo(f"Overhead: {overhead:.3f}", err=True)
|
rtty_soda/main.py
CHANGED
|
@@ -40,12 +40,16 @@ def cli() -> None:
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
@cli.command() # pyright: ignore[reportAny]
|
|
43
|
-
@click.option(
|
|
43
|
+
@click.option(
|
|
44
|
+
"--encoding", "-e", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
45
|
+
)
|
|
44
46
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
45
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
46
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
47
|
-
@click.option("--padding", default=0, show_default=True)
|
|
48
|
-
@click.option(
|
|
47
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
48
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
49
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
50
|
+
@click.option(
|
|
51
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
52
|
+
)
|
|
49
53
|
def genkey_cmd(
|
|
50
54
|
encoding: str,
|
|
51
55
|
output_file: Path | None,
|
|
@@ -63,10 +67,10 @@ def genkey_cmd(
|
|
|
63
67
|
key = bytes(PrivateKey.generate())
|
|
64
68
|
key = enc.encode(key)
|
|
65
69
|
|
|
66
|
-
|
|
70
|
+
formatted, groups = format_output(
|
|
67
71
|
data=key, encoder=enc, group_len=group_len, line_len=line_len, padding=padding
|
|
68
72
|
)
|
|
69
|
-
write_output(target=output_file, data=
|
|
73
|
+
write_output(target=output_file, data=formatted)
|
|
70
74
|
|
|
71
75
|
if verbose:
|
|
72
76
|
click.echo(f"Groups: {groups}", err=True)
|
|
@@ -74,12 +78,16 @@ def genkey_cmd(
|
|
|
74
78
|
|
|
75
79
|
@cli.command() # pyright: ignore[reportAny]
|
|
76
80
|
@click.argument("private_key_file", type=in_path)
|
|
77
|
-
@click.option(
|
|
81
|
+
@click.option(
|
|
82
|
+
"--encoding", "-e", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
83
|
+
)
|
|
78
84
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
79
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
80
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
81
|
-
@click.option("--padding", default=0, show_default=True)
|
|
82
|
-
@click.option(
|
|
85
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
86
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
87
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
88
|
+
@click.option(
|
|
89
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
90
|
+
)
|
|
83
91
|
def pubkey_cmd(
|
|
84
92
|
private_key_file: Path,
|
|
85
93
|
encoding: str,
|
|
@@ -100,10 +108,10 @@ def pubkey_cmd(
|
|
|
100
108
|
pub = bytes(priv.public_key)
|
|
101
109
|
pub = enc.encode(pub)
|
|
102
110
|
|
|
103
|
-
|
|
111
|
+
formatted, groups = format_output(
|
|
104
112
|
data=pub, encoder=enc, group_len=group_len, line_len=line_len, padding=padding
|
|
105
113
|
)
|
|
106
|
-
write_output(target=output_file, data=
|
|
114
|
+
write_output(target=output_file, data=formatted)
|
|
107
115
|
|
|
108
116
|
if verbose:
|
|
109
117
|
click.echo(f"Groups: {groups}", err=True)
|
|
@@ -111,13 +119,19 @@ def pubkey_cmd(
|
|
|
111
119
|
|
|
112
120
|
@cli.command() # pyright: ignore[reportAny]
|
|
113
121
|
@click.argument("password_file", type=in_path)
|
|
114
|
-
@click.option(
|
|
115
|
-
|
|
122
|
+
@click.option(
|
|
123
|
+
"--encoding", "-e", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
124
|
+
)
|
|
125
|
+
@click.option(
|
|
126
|
+
"--profile", "-p", default="sensitive", show_default=True, envvar="KDF_PROFILE"
|
|
127
|
+
)
|
|
116
128
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
117
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
118
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
119
|
-
@click.option("--padding", default=0, show_default=True)
|
|
120
|
-
@click.option(
|
|
129
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
130
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
131
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
132
|
+
@click.option(
|
|
133
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
134
|
+
)
|
|
121
135
|
def kdf_cmd(
|
|
122
136
|
password_file: Path,
|
|
123
137
|
encoding: str,
|
|
@@ -141,10 +155,10 @@ def kdf_cmd(
|
|
|
141
155
|
key = kdf(password=pw, profile=prof)
|
|
142
156
|
key = enc.encode(key)
|
|
143
157
|
|
|
144
|
-
|
|
158
|
+
formatted, groups = format_output(
|
|
145
159
|
data=key, encoder=enc, group_len=group_len, line_len=line_len, padding=padding
|
|
146
160
|
)
|
|
147
|
-
write_output(target=output_file, data=
|
|
161
|
+
write_output(target=output_file, data=formatted)
|
|
148
162
|
|
|
149
163
|
if verbose:
|
|
150
164
|
click.echo(f"Groups: {groups}", err=True)
|
|
@@ -154,14 +168,22 @@ def kdf_cmd(
|
|
|
154
168
|
@click.argument("private_key_file", type=in_path)
|
|
155
169
|
@click.argument("public_key_file", type=in_path)
|
|
156
170
|
@click.argument("message_file", type=in_path)
|
|
157
|
-
@click.option(
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
@click.option(
|
|
172
|
+
"--key-encoding", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
173
|
+
)
|
|
174
|
+
@click.option(
|
|
175
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
176
|
+
)
|
|
177
|
+
@click.option(
|
|
178
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
179
|
+
)
|
|
160
180
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
161
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
162
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
163
|
-
@click.option("--padding", default=0, show_default=True)
|
|
164
|
-
@click.option(
|
|
181
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
182
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
183
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
184
|
+
@click.option(
|
|
185
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
186
|
+
)
|
|
165
187
|
def encrypt_public_cmd(
|
|
166
188
|
private_key_file: Path,
|
|
167
189
|
public_key_file: Path,
|
|
@@ -189,36 +211,44 @@ def encrypt_public_cmd(
|
|
|
189
211
|
priv = PrivateKey(private_key=priv)
|
|
190
212
|
pub = read_key_bytes(source=public_key_file, encoder=key_enc)
|
|
191
213
|
pub = PublicKey(public_key=pub)
|
|
192
|
-
|
|
193
|
-
data = archiver(
|
|
214
|
+
plaintext = message_file.read_bytes()
|
|
215
|
+
data = archiver(plaintext)
|
|
194
216
|
data = public.encrypt(private=priv, public=pub, data=data)
|
|
195
|
-
|
|
217
|
+
ciphertext = data_enc.encode(data)
|
|
196
218
|
|
|
197
|
-
|
|
198
|
-
data=
|
|
219
|
+
formatted, groups = format_output(
|
|
220
|
+
data=ciphertext,
|
|
199
221
|
encoder=data_enc,
|
|
200
222
|
group_len=group_len,
|
|
201
223
|
line_len=line_len,
|
|
202
224
|
padding=padding,
|
|
203
225
|
)
|
|
204
|
-
write_output(target=output_file, data=
|
|
226
|
+
write_output(target=output_file, data=formatted)
|
|
205
227
|
|
|
206
228
|
if verbose:
|
|
207
|
-
print_stats(plaintext
|
|
229
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
208
230
|
click.echo(f"Groups: {groups}", err=True)
|
|
209
231
|
|
|
210
232
|
|
|
211
233
|
@cli.command(aliases=["es"]) # pyright: ignore[reportAny]
|
|
212
234
|
@click.argument("key_file", type=in_path)
|
|
213
235
|
@click.argument("message_file", type=in_path)
|
|
214
|
-
@click.option(
|
|
215
|
-
|
|
216
|
-
|
|
236
|
+
@click.option(
|
|
237
|
+
"--key-encoding", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
238
|
+
)
|
|
239
|
+
@click.option(
|
|
240
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
241
|
+
)
|
|
242
|
+
@click.option(
|
|
243
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
244
|
+
)
|
|
217
245
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
218
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
219
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
220
|
-
@click.option("--padding", default=0, show_default=True)
|
|
221
|
-
@click.option(
|
|
246
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
247
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
248
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
249
|
+
@click.option(
|
|
250
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
251
|
+
)
|
|
222
252
|
def encrypt_secret_cmd(
|
|
223
253
|
key_file: Path,
|
|
224
254
|
message_file: Path,
|
|
@@ -242,36 +272,44 @@ def encrypt_secret_cmd(
|
|
|
242
272
|
archiver = ARCHIVERS[compression]
|
|
243
273
|
|
|
244
274
|
key = read_key_bytes(source=key_file, encoder=key_enc)
|
|
245
|
-
|
|
246
|
-
data = archiver(
|
|
275
|
+
plaintext = message_file.read_bytes()
|
|
276
|
+
data = archiver(plaintext)
|
|
247
277
|
data = secret.encrypt(key=key, data=data)
|
|
248
|
-
|
|
278
|
+
ciphertext = data_enc.encode(data)
|
|
249
279
|
|
|
250
|
-
|
|
251
|
-
data=
|
|
280
|
+
formatted, groups = format_output(
|
|
281
|
+
data=ciphertext,
|
|
252
282
|
encoder=data_enc,
|
|
253
283
|
group_len=group_len,
|
|
254
284
|
line_len=line_len,
|
|
255
285
|
padding=padding,
|
|
256
286
|
)
|
|
257
|
-
write_output(target=output_file, data=
|
|
287
|
+
write_output(target=output_file, data=formatted)
|
|
258
288
|
|
|
259
289
|
if verbose:
|
|
260
|
-
print_stats(plaintext
|
|
290
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
261
291
|
click.echo(f"Groups: {groups}", err=True)
|
|
262
292
|
|
|
263
293
|
|
|
264
294
|
@cli.command(aliases=["ep"]) # pyright: ignore[reportAny]
|
|
265
295
|
@click.argument("password_file", type=in_path)
|
|
266
296
|
@click.argument("message_file", type=in_path)
|
|
267
|
-
@click.option(
|
|
268
|
-
|
|
269
|
-
|
|
297
|
+
@click.option(
|
|
298
|
+
"--kdf-profile", "-p", default="sensitive", show_default=True, envvar="KDF_PROFILE"
|
|
299
|
+
)
|
|
300
|
+
@click.option(
|
|
301
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
302
|
+
)
|
|
303
|
+
@click.option(
|
|
304
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
305
|
+
)
|
|
270
306
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
271
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
272
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
273
|
-
@click.option("--padding", default=0, show_default=True)
|
|
274
|
-
@click.option(
|
|
307
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
308
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
309
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
310
|
+
@click.option(
|
|
311
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
312
|
+
)
|
|
275
313
|
def encrypt_password_cmd(
|
|
276
314
|
password_file: Path,
|
|
277
315
|
message_file: Path,
|
|
@@ -298,22 +336,22 @@ def encrypt_password_cmd(
|
|
|
298
336
|
|
|
299
337
|
pw = read_password_bytes(password_file)
|
|
300
338
|
key = kdf(password=pw, profile=prof)
|
|
301
|
-
|
|
302
|
-
data = archiver(
|
|
339
|
+
plaintext = message_file.read_bytes()
|
|
340
|
+
data = archiver(plaintext)
|
|
303
341
|
data = secret.encrypt(key=key, data=data)
|
|
304
|
-
|
|
342
|
+
ciphertext = data_enc.encode(data)
|
|
305
343
|
|
|
306
|
-
|
|
307
|
-
data=
|
|
344
|
+
formatted, groups = format_output(
|
|
345
|
+
data=ciphertext,
|
|
308
346
|
encoder=data_enc,
|
|
309
347
|
group_len=group_len,
|
|
310
348
|
line_len=line_len,
|
|
311
349
|
padding=padding,
|
|
312
350
|
)
|
|
313
|
-
write_output(target=output_file, data=
|
|
351
|
+
write_output(target=output_file, data=formatted)
|
|
314
352
|
|
|
315
353
|
if verbose:
|
|
316
|
-
print_stats(plaintext
|
|
354
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
317
355
|
click.echo(f"Groups: {groups}", err=True)
|
|
318
356
|
|
|
319
357
|
|
|
@@ -321,11 +359,19 @@ def encrypt_password_cmd(
|
|
|
321
359
|
@click.argument("private_key_file", type=in_path)
|
|
322
360
|
@click.argument("public_key_file", type=in_path)
|
|
323
361
|
@click.argument("message_file", type=in_path)
|
|
324
|
-
@click.option(
|
|
325
|
-
|
|
326
|
-
|
|
362
|
+
@click.option(
|
|
363
|
+
"--key-encoding", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
364
|
+
)
|
|
365
|
+
@click.option(
|
|
366
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
367
|
+
)
|
|
368
|
+
@click.option(
|
|
369
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
370
|
+
)
|
|
327
371
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
328
|
-
@click.option(
|
|
372
|
+
@click.option(
|
|
373
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
374
|
+
)
|
|
329
375
|
def decrypt_public_cmd(
|
|
330
376
|
private_key_file: Path,
|
|
331
377
|
public_key_file: Path,
|
|
@@ -350,25 +396,33 @@ def decrypt_public_cmd(
|
|
|
350
396
|
priv = PrivateKey(private_key=priv)
|
|
351
397
|
pub = read_key_bytes(source=public_key_file, encoder=key_enc)
|
|
352
398
|
pub = PublicKey(public_key=pub)
|
|
353
|
-
|
|
354
|
-
data = data_enc.decode(
|
|
399
|
+
ciphertext = read_bytes(source=message_file, encoder=data_enc)
|
|
400
|
+
data = data_enc.decode(ciphertext)
|
|
355
401
|
data = public.decrypt(private=priv, public=pub, data=data)
|
|
356
|
-
|
|
402
|
+
plaintext = unarchiver(data)
|
|
357
403
|
|
|
358
|
-
write_output(target=output_file, data=
|
|
404
|
+
write_output(target=output_file, data=plaintext)
|
|
359
405
|
|
|
360
406
|
if verbose:
|
|
361
|
-
print_stats(plaintext
|
|
407
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
362
408
|
|
|
363
409
|
|
|
364
410
|
@cli.command(aliases=["ds"]) # pyright: ignore[reportAny]
|
|
365
411
|
@click.argument("key_file", type=in_path)
|
|
366
412
|
@click.argument("message_file", type=in_path)
|
|
367
|
-
@click.option(
|
|
368
|
-
|
|
369
|
-
|
|
413
|
+
@click.option(
|
|
414
|
+
"--key-encoding", default="base64", show_default=True, envvar="KEY_ENCODING"
|
|
415
|
+
)
|
|
416
|
+
@click.option(
|
|
417
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
418
|
+
)
|
|
419
|
+
@click.option(
|
|
420
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
421
|
+
)
|
|
370
422
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
371
|
-
@click.option(
|
|
423
|
+
@click.option(
|
|
424
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
425
|
+
)
|
|
372
426
|
def decrypt_secret_cmd(
|
|
373
427
|
key_file: Path,
|
|
374
428
|
message_file: Path,
|
|
@@ -389,25 +443,33 @@ def decrypt_secret_cmd(
|
|
|
389
443
|
unarchiver = UNARCHIVERS[compression]
|
|
390
444
|
|
|
391
445
|
key = read_key_bytes(source=key_file, encoder=key_enc)
|
|
392
|
-
|
|
393
|
-
data = data_enc.decode(
|
|
446
|
+
ciphertext = read_bytes(source=message_file, encoder=data_enc)
|
|
447
|
+
data = data_enc.decode(ciphertext)
|
|
394
448
|
data = secret.decrypt(key=key, data=data)
|
|
395
|
-
|
|
449
|
+
plaintext = unarchiver(data)
|
|
396
450
|
|
|
397
|
-
write_output(target=output_file, data=
|
|
451
|
+
write_output(target=output_file, data=plaintext)
|
|
398
452
|
|
|
399
453
|
if verbose:
|
|
400
|
-
print_stats(plaintext
|
|
454
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
401
455
|
|
|
402
456
|
|
|
403
457
|
@cli.command(aliases=["dp"]) # pyright: ignore[reportAny]
|
|
404
458
|
@click.argument("password_file", type=in_path)
|
|
405
459
|
@click.argument("message_file", type=in_path)
|
|
406
|
-
@click.option(
|
|
407
|
-
|
|
408
|
-
|
|
460
|
+
@click.option(
|
|
461
|
+
"--kdf-profile", "-p", default="sensitive", show_default=True, envvar="KDF_PROFILE"
|
|
462
|
+
)
|
|
463
|
+
@click.option(
|
|
464
|
+
"--data-encoding", "-e", default="base64", show_default=True, envvar="DATA_ENCODING"
|
|
465
|
+
)
|
|
466
|
+
@click.option(
|
|
467
|
+
"--compression", "-c", default="zstd", show_default=True, envvar="COMPRESSION"
|
|
468
|
+
)
|
|
409
469
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
410
|
-
@click.option(
|
|
470
|
+
@click.option(
|
|
471
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
472
|
+
)
|
|
411
473
|
def decrypt_password_cmd(
|
|
412
474
|
password_file: Path,
|
|
413
475
|
message_file: Path,
|
|
@@ -431,15 +493,15 @@ def decrypt_password_cmd(
|
|
|
431
493
|
|
|
432
494
|
pw = read_password_bytes(password_file)
|
|
433
495
|
key = kdf(password=pw, profile=prof)
|
|
434
|
-
|
|
435
|
-
data = data_enc.decode(
|
|
496
|
+
ciphertext = read_bytes(source=message_file, encoder=data_enc)
|
|
497
|
+
data = data_enc.decode(ciphertext)
|
|
436
498
|
data = secret.decrypt(key=key, data=data)
|
|
437
|
-
|
|
499
|
+
plaintext = unarchiver(data)
|
|
438
500
|
|
|
439
|
-
write_output(target=output_file, data=
|
|
501
|
+
write_output(target=output_file, data=plaintext)
|
|
440
502
|
|
|
441
503
|
if verbose:
|
|
442
|
-
print_stats(plaintext
|
|
504
|
+
print_stats(len(plaintext), len(ciphertext))
|
|
443
505
|
|
|
444
506
|
|
|
445
507
|
@cli.command() # pyright: ignore[reportAny]
|
|
@@ -447,10 +509,12 @@ def decrypt_password_cmd(
|
|
|
447
509
|
@click.argument("out_encoding")
|
|
448
510
|
@click.argument("file", type=in_path)
|
|
449
511
|
@click.option("--output-file", "-o", type=out_path, help="Write output to file.")
|
|
450
|
-
@click.option("--group-len", default=0, show_default=True)
|
|
451
|
-
@click.option("--line-len", default=80, show_default=True)
|
|
452
|
-
@click.option("--padding", default=0, show_default=True)
|
|
453
|
-
@click.option(
|
|
512
|
+
@click.option("--group-len", default=0, show_default=True, envvar="GROUP_LEN")
|
|
513
|
+
@click.option("--line-len", default=80, show_default=True, envvar="LINE_LEN")
|
|
514
|
+
@click.option("--padding", default=0, show_default=True, envvar="PADDING")
|
|
515
|
+
@click.option(
|
|
516
|
+
"--verbose", "-v", is_flag=True, envvar="VERBOSE", help="Show verbose output."
|
|
517
|
+
)
|
|
454
518
|
def encode_cmd(
|
|
455
519
|
in_encoding: str,
|
|
456
520
|
out_encoding: str,
|
|
@@ -472,14 +536,14 @@ def encode_cmd(
|
|
|
472
536
|
data = in_enc.decode(data)
|
|
473
537
|
data = out_enc.encode(data)
|
|
474
538
|
|
|
475
|
-
|
|
539
|
+
formatted, groups = format_output(
|
|
476
540
|
data=data,
|
|
477
541
|
encoder=out_enc,
|
|
478
542
|
group_len=group_len,
|
|
479
543
|
line_len=line_len,
|
|
480
544
|
padding=padding,
|
|
481
545
|
)
|
|
482
|
-
write_output(target=output_file, data=
|
|
546
|
+
write_output(target=output_file, data=formatted)
|
|
483
547
|
|
|
484
548
|
if verbose:
|
|
485
549
|
click.echo(f"Groups: {groups}", err=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rtty-soda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A CLI tool for Unix-like environments to encrypt a RTTY session using NaCl
|
|
5
5
|
Keywords: cli,encryption,libsodium,nacl,rtty
|
|
6
6
|
Author: Theo Saveliev
|
|
@@ -57,8 +57,8 @@ A CLI tool for Unix-like environments to encrypt a RTTY session using NaCl.
|
|
|
57
57
|
#### Docker
|
|
58
58
|
|
|
59
59
|
```
|
|
60
|
-
% docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.2.
|
|
61
|
-
% docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.2.
|
|
60
|
+
% docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.2.3
|
|
61
|
+
% docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.2.3-tools
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
|
|
@@ -165,24 +165,6 @@ A telegraph key is a specialized electrical switch used by a trained operator to
|
|
|
165
165
|
transmit text messages in Morse code in a telegraphy system.
|
|
166
166
|
The first telegraph key was invented by Alfred Vail, an associate of Samuel Morse.
|
|
167
167
|
(c) Wikipedia
|
|
168
|
-
|
|
169
|
-
% soda decrypt-public -h
|
|
170
|
-
Usage: soda decrypt-public [OPTIONS] PRIVATE_KEY_FILE PUBLIC_KEY_FILE
|
|
171
|
-
MESSAGE_FILE
|
|
172
|
-
|
|
173
|
-
Decrypt Message (Public).
|
|
174
|
-
|
|
175
|
-
Encoding: base26 | base31 | base36 | base64 | base94 | binary
|
|
176
|
-
|
|
177
|
-
Compression: zstd | zlib | bz2 | lzma | raw
|
|
178
|
-
|
|
179
|
-
Options:
|
|
180
|
-
--key-encoding TEXT [default: base64]
|
|
181
|
-
-e, --data-encoding TEXT [default: base64]
|
|
182
|
-
-c, --compression TEXT [default: zstd]
|
|
183
|
-
-o, --output-file FILE Write output to file.
|
|
184
|
-
-v, --verbose Show verbose output.
|
|
185
|
-
-h, --help Show this message and exit.
|
|
186
168
|
```
|
|
187
169
|
|
|
188
170
|
|
|
@@ -194,26 +176,6 @@ Alice and Bob share a key for symmetric encryption:
|
|
|
194
176
|
% soda genkey > shared
|
|
195
177
|
% soda encrypt-secret shared message -o encrypted
|
|
196
178
|
% soda decrypt-secret shared encrypted -o message
|
|
197
|
-
|
|
198
|
-
% soda encrypt-secret -h
|
|
199
|
-
Usage: soda encrypt-secret [OPTIONS] KEY_FILE MESSAGE_FILE
|
|
200
|
-
|
|
201
|
-
Encrypt Message (Secret).
|
|
202
|
-
|
|
203
|
-
Encoding: base26 | base31 | base36 | base64 | base94 | binary
|
|
204
|
-
|
|
205
|
-
Compression: zstd | zlib | bz2 | lzma | raw
|
|
206
|
-
|
|
207
|
-
Options:
|
|
208
|
-
--key-encoding TEXT [default: base64]
|
|
209
|
-
-e, --data-encoding TEXT [default: base64]
|
|
210
|
-
-c, --compression TEXT [default: zstd]
|
|
211
|
-
-o, --output-file FILE Write output to file.
|
|
212
|
-
--group-len INTEGER [default: 0]
|
|
213
|
-
--line-len INTEGER [default: 80]
|
|
214
|
-
--padding INTEGER [default: 0]
|
|
215
|
-
-v, --verbose Show verbose output.
|
|
216
|
-
-h, --help Show this message and exit.
|
|
217
179
|
```
|
|
218
180
|
|
|
219
181
|
Another day, they share a password:
|
|
@@ -221,28 +183,6 @@ Another day, they share a password:
|
|
|
221
183
|
```
|
|
222
184
|
% echo qwerty | soda encrypt-password - message -p interactive -o encrypted
|
|
223
185
|
% echo qwerty | soda decrypt-password - encrypted -p interactive -o message
|
|
224
|
-
|
|
225
|
-
% soda encrypt-password -h
|
|
226
|
-
Usage: soda encrypt-password [OPTIONS] PASSWORD_FILE MESSAGE_FILE
|
|
227
|
-
|
|
228
|
-
Encrypt Message (Password).
|
|
229
|
-
|
|
230
|
-
KDF profile: interactive | moderate | sensitive
|
|
231
|
-
|
|
232
|
-
Encoding: base26 | base31 | base36 | base64 | base94 | binary
|
|
233
|
-
|
|
234
|
-
Compression: zstd | zlib | bz2 | lzma | raw
|
|
235
|
-
|
|
236
|
-
Options:
|
|
237
|
-
-p, --kdf-profile TEXT [default: sensitive]
|
|
238
|
-
-e, --data-encoding TEXT [default: base64]
|
|
239
|
-
-c, --compression TEXT [default: zstd]
|
|
240
|
-
-o, --output-file FILE Write output to file.
|
|
241
|
-
--group-len INTEGER [default: 0]
|
|
242
|
-
--line-len INTEGER [default: 80]
|
|
243
|
-
--padding INTEGER [default: 0]
|
|
244
|
-
-v, --verbose Show verbose output.
|
|
245
|
-
-h, --help Show this message and exit.
|
|
246
186
|
```
|
|
247
187
|
|
|
248
188
|
|
|
@@ -318,18 +258,58 @@ The rtty-soda supports various encodings:
|
|
|
318
258
|
|
|
319
259
|
```
|
|
320
260
|
% soda encrypt-public alice bob_pub message --data-encoding base36 --group-len 5 --verbose
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
261
|
+
9URCN ARRN8 MSE7G G9980 37D8S 568QP 16AZW TOHAI KYP5W VAK7R VZ6YO GZ38A QOIP7
|
|
262
|
+
60P2E GWWOG DSHDD EG2TZ 7PSZM 7FKBX 50TAD RHS2E VM063 N297Y 753BP TLUX0 9K8BD
|
|
263
|
+
DZF8O 7TPUG MJV4R T2C92 HU1G8 KGJCN URU1F 9COP9 EFLZO BSL2V 171DS 2HKPE JY2GY
|
|
264
|
+
V86IT T0HBR 9B08H M9R2V IEM7A R91IF UWQYM ZV4JN 7YU3K ILPJY E8OMA NWQC5 Q6BG7
|
|
265
|
+
PXM4I 9UU9E J9IRU HSZ41 RPZQG XTDC6 E5NMS B4HBQ 7QRI2 RRUYH HSHGQ 7USN
|
|
326
266
|
Plaintext: 239
|
|
327
|
-
Ciphertext:
|
|
328
|
-
Overhead: 1.
|
|
267
|
+
Ciphertext: 319
|
|
268
|
+
Overhead: 1.335
|
|
329
269
|
Groups: 64
|
|
330
270
|
```
|
|
331
271
|
|
|
332
272
|
|
|
273
|
+
## Environment variables
|
|
274
|
+
|
|
275
|
+
Common options can be set in the environment variables:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
% cat .env
|
|
279
|
+
KEY_ENCODING=base26
|
|
280
|
+
DATA_ENCODING=base26
|
|
281
|
+
COMPRESSION=bz2
|
|
282
|
+
KDF_PROFILE=moderate
|
|
283
|
+
VERBOSE=1
|
|
284
|
+
GROUP_LEN=5
|
|
285
|
+
LINE_LEN=80
|
|
286
|
+
PADDING=1
|
|
287
|
+
|
|
288
|
+
% set -a
|
|
289
|
+
% source .env
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
## Alternative usage
|
|
294
|
+
|
|
295
|
+
- Password source
|
|
296
|
+
```
|
|
297
|
+
% echo 'A line from a book or a poem' | soda kdf - -e base94
|
|
298
|
+
wN/K.@3Q#]Czn4kk3(negX=R|*xvvPQmk'XW$-s
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
- WireGuard keyer
|
|
302
|
+
```
|
|
303
|
+
% echo 'A line from a book or a poem' | soda kdf - -o privkey
|
|
304
|
+
% cat privkey
|
|
305
|
+
thyA4dlQgg93+rQj/evBbBymw82GTwQCh3RJ0I6GOsY=
|
|
306
|
+
% soda pubkey privkey
|
|
307
|
+
ruIUMqbUtyqRVSIBLSGI7AOruE2DLWgTe9o+h7Yktkw=
|
|
308
|
+
% cat privkey | wg pubkey
|
|
309
|
+
ruIUMqbUtyqRVSIBLSGI7AOruE2DLWgTe9o+h7Yktkw=
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
|
|
333
313
|
## Compatibility
|
|
334
314
|
|
|
335
315
|
During the initial development (versions prior to 1.0.0),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
rtty_soda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
rtty_soda/archivers.py,sha256=b-qZ6-MAY1rm1Jsosi2XEfjNjkU7acAedHmnSzthf-A,1343
|
|
3
|
-
rtty_soda/cli_io.py,sha256=
|
|
3
|
+
rtty_soda/cli_io.py,sha256=mkCYMp_Cm9pKvvS7OE2KSeXzRVjoHfTlfqVGjyCnCyY,3040
|
|
4
4
|
rtty_soda/cryptography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
rtty_soda/cryptography/kdf.py,sha256=HymfTiK7BD7lhZu0OdtFW_i-v0r7e8XedT8_Q84ClJc,1529
|
|
6
6
|
rtty_soda/cryptography/public.py,sha256=6gwsT4ilaMDHwtdYPOEYlX8IfwHPew8lMIbxRva1mLs,612
|
|
@@ -14,10 +14,10 @@ rtty_soda/encoders/base94_encoder.py,sha256=Xbt0chbeAIM9_nRHVhRMVfMBUKS9q1gNSpg2
|
|
|
14
14
|
rtty_soda/encoders/encoder.py,sha256=trHunjg0uNEQrQWTpRMY5nQEx5_jBrcvfUAcGIKpgms,220
|
|
15
15
|
rtty_soda/encoders/functions.py,sha256=JxtgbZg3kdbFqAhjm59QwJS6zEXYsR1m02k7cg_rFI4,1385
|
|
16
16
|
rtty_soda/encoders/raw_encoder.py,sha256=eJnUSsxf3jichdQ5LqwvBZAX7-qk67p5FMlfKOOGHp8,259
|
|
17
|
-
rtty_soda/main.py,sha256=
|
|
17
|
+
rtty_soda/main.py,sha256=OEaefD5VxbL6P4NWWtNb9Am9wJegkesg29xzjYy1oxU,17319
|
|
18
18
|
rtty_soda/main.pyi,sha256=SoTM1GXACRafCtwwLOI1X9YhvEo3DPoaPtKSgWacSS0,2242
|
|
19
19
|
rtty_soda/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
rtty_soda-0.2.
|
|
21
|
-
rtty_soda-0.2.
|
|
22
|
-
rtty_soda-0.2.
|
|
23
|
-
rtty_soda-0.2.
|
|
20
|
+
rtty_soda-0.2.3.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
|
|
21
|
+
rtty_soda-0.2.3.dist-info/entry_points.txt,sha256=tFROKkaDoE_p5tM2ko7MoAjWBFurchcw3j-MdObxBU0,45
|
|
22
|
+
rtty_soda-0.2.3.dist-info/METADATA,sha256=BZR-y-ilDaepE0j8RuckR-IHCK1nPeMUCq96ySPxnp0,8603
|
|
23
|
+
rtty_soda-0.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|