rtty-soda 0.2.3__py3-none-any.whl → 0.2.4__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 +10 -4
- rtty_soda/main.py +8 -7
- {rtty_soda-0.2.3.dist-info → rtty_soda-0.2.4.dist-info}/METADATA +3 -3
- {rtty_soda-0.2.3.dist-info → rtty_soda-0.2.4.dist-info}/RECORD +6 -6
- {rtty_soda-0.2.3.dist-info → rtty_soda-0.2.4.dist-info}/WHEEL +0 -0
- {rtty_soda-0.2.3.dist-info → rtty_soda-0.2.4.dist-info}/entry_points.txt +0 -0
rtty_soda/cli_io.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import random
|
|
2
2
|
import re
|
|
3
3
|
import string
|
|
4
|
-
from typing import TYPE_CHECKING, TextIO, cast
|
|
4
|
+
from typing import TYPE_CHECKING, BinaryIO, TextIO, cast
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
7
|
from pathlib import Path
|
|
@@ -15,6 +15,7 @@ __all__ = [
|
|
|
15
15
|
"pad_newlines",
|
|
16
16
|
"print_stats",
|
|
17
17
|
"read_bytes",
|
|
18
|
+
"read_ciphertext_bytes",
|
|
18
19
|
"read_encoded_stripped",
|
|
19
20
|
"read_key_bytes",
|
|
20
21
|
"read_password_bytes",
|
|
@@ -31,6 +32,11 @@ def read_str(source: Path) -> str:
|
|
|
31
32
|
return cast("TextIO", fd).read()
|
|
32
33
|
|
|
33
34
|
|
|
35
|
+
def read_bytes(source: Path) -> bytes:
|
|
36
|
+
with click.open_file(source, mode="rb") as fd:
|
|
37
|
+
return cast("BinaryIO", fd).read()
|
|
38
|
+
|
|
39
|
+
|
|
34
40
|
def remove_whitespace(data: str) -> str:
|
|
35
41
|
return re.sub(r"\s", "", data)
|
|
36
42
|
|
|
@@ -41,15 +47,15 @@ def read_encoded_stripped(source: Path) -> bytes:
|
|
|
41
47
|
return encode_str(data)
|
|
42
48
|
|
|
43
49
|
|
|
44
|
-
def
|
|
50
|
+
def read_ciphertext_bytes(source: Path, encoder: Encoder) -> bytes:
|
|
45
51
|
if encoder.is_binary:
|
|
46
|
-
return
|
|
52
|
+
return read_bytes(source)
|
|
47
53
|
|
|
48
54
|
return read_encoded_stripped(source)
|
|
49
55
|
|
|
50
56
|
|
|
51
57
|
def read_key_bytes(source: Path, encoder: Encoder) -> bytes:
|
|
52
|
-
key =
|
|
58
|
+
key = read_ciphertext_bytes(source, encoder)
|
|
53
59
|
return encoder.decode(key)
|
|
54
60
|
|
|
55
61
|
|
rtty_soda/main.py
CHANGED
|
@@ -9,6 +9,7 @@ from rtty_soda.cli_io import (
|
|
|
9
9
|
format_output,
|
|
10
10
|
print_stats,
|
|
11
11
|
read_bytes,
|
|
12
|
+
read_ciphertext_bytes,
|
|
12
13
|
read_key_bytes,
|
|
13
14
|
read_password_bytes,
|
|
14
15
|
write_output,
|
|
@@ -211,7 +212,7 @@ def encrypt_public_cmd(
|
|
|
211
212
|
priv = PrivateKey(private_key=priv)
|
|
212
213
|
pub = read_key_bytes(source=public_key_file, encoder=key_enc)
|
|
213
214
|
pub = PublicKey(public_key=pub)
|
|
214
|
-
plaintext =
|
|
215
|
+
plaintext = read_bytes(message_file)
|
|
215
216
|
data = archiver(plaintext)
|
|
216
217
|
data = public.encrypt(private=priv, public=pub, data=data)
|
|
217
218
|
ciphertext = data_enc.encode(data)
|
|
@@ -272,7 +273,7 @@ def encrypt_secret_cmd(
|
|
|
272
273
|
archiver = ARCHIVERS[compression]
|
|
273
274
|
|
|
274
275
|
key = read_key_bytes(source=key_file, encoder=key_enc)
|
|
275
|
-
plaintext =
|
|
276
|
+
plaintext = read_bytes(message_file)
|
|
276
277
|
data = archiver(plaintext)
|
|
277
278
|
data = secret.encrypt(key=key, data=data)
|
|
278
279
|
ciphertext = data_enc.encode(data)
|
|
@@ -336,7 +337,7 @@ def encrypt_password_cmd(
|
|
|
336
337
|
|
|
337
338
|
pw = read_password_bytes(password_file)
|
|
338
339
|
key = kdf(password=pw, profile=prof)
|
|
339
|
-
plaintext =
|
|
340
|
+
plaintext = read_bytes(message_file)
|
|
340
341
|
data = archiver(plaintext)
|
|
341
342
|
data = secret.encrypt(key=key, data=data)
|
|
342
343
|
ciphertext = data_enc.encode(data)
|
|
@@ -396,7 +397,7 @@ def decrypt_public_cmd(
|
|
|
396
397
|
priv = PrivateKey(private_key=priv)
|
|
397
398
|
pub = read_key_bytes(source=public_key_file, encoder=key_enc)
|
|
398
399
|
pub = PublicKey(public_key=pub)
|
|
399
|
-
ciphertext =
|
|
400
|
+
ciphertext = read_ciphertext_bytes(source=message_file, encoder=data_enc)
|
|
400
401
|
data = data_enc.decode(ciphertext)
|
|
401
402
|
data = public.decrypt(private=priv, public=pub, data=data)
|
|
402
403
|
plaintext = unarchiver(data)
|
|
@@ -443,7 +444,7 @@ def decrypt_secret_cmd(
|
|
|
443
444
|
unarchiver = UNARCHIVERS[compression]
|
|
444
445
|
|
|
445
446
|
key = read_key_bytes(source=key_file, encoder=key_enc)
|
|
446
|
-
ciphertext =
|
|
447
|
+
ciphertext = read_ciphertext_bytes(source=message_file, encoder=data_enc)
|
|
447
448
|
data = data_enc.decode(ciphertext)
|
|
448
449
|
data = secret.decrypt(key=key, data=data)
|
|
449
450
|
plaintext = unarchiver(data)
|
|
@@ -493,7 +494,7 @@ def decrypt_password_cmd(
|
|
|
493
494
|
|
|
494
495
|
pw = read_password_bytes(password_file)
|
|
495
496
|
key = kdf(password=pw, profile=prof)
|
|
496
|
-
ciphertext =
|
|
497
|
+
ciphertext = read_ciphertext_bytes(source=message_file, encoder=data_enc)
|
|
497
498
|
data = data_enc.decode(ciphertext)
|
|
498
499
|
data = secret.decrypt(key=key, data=data)
|
|
499
500
|
plaintext = unarchiver(data)
|
|
@@ -532,7 +533,7 @@ def encode_cmd(
|
|
|
532
533
|
in_enc = ENCODERS[in_encoding]
|
|
533
534
|
out_enc = ENCODERS[out_encoding]
|
|
534
535
|
|
|
535
|
-
data =
|
|
536
|
+
data = read_ciphertext_bytes(source=file, encoder=in_enc)
|
|
536
537
|
data = in_enc.decode(data)
|
|
537
538
|
data = out_enc.encode(data)
|
|
538
539
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rtty-soda
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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.4
|
|
61
|
+
% docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.2.4-tools
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
|
|
@@ -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=d99l3RSXJ5W3H9E-KFJYzAWzW8bn0F3F6o83DtMLfQs,3235
|
|
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=BlyrKtBebzAvZzrJnEt7DII48nIiBfxUnQ-njpFjTU8,17387
|
|
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.4.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
|
|
21
|
+
rtty_soda-0.2.4.dist-info/entry_points.txt,sha256=tFROKkaDoE_p5tM2ko7MoAjWBFurchcw3j-MdObxBU0,45
|
|
22
|
+
rtty_soda-0.2.4.dist-info/METADATA,sha256=kAzdyA6WLijrbBk8TgWGsgnSbAj8PMMA4N4g3Y1IpXU,8603
|
|
23
|
+
rtty_soda-0.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|