Cryptography Reference
Details on the reverse-engineered AES-256 and RSA-1024 encryption layer used to communicate securely with Shad edge gateways.
Payload Encryption & Decryption
-
aioshad.crypto.encrypt_payload(key: bytes, plaintext: bytes, iv: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') → str[source]
Encrypts plaintext bytes and returns base64 ciphertext string.
-
aioshad.crypto.decrypt_payload(key: bytes, data_enc: str, iv: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') → bytes[source]
Decrypts base64-encoded encrypted payload into plaintext bytes.
AES Primitives
-
aioshad.crypto.aes_encrypt(key: bytes, plaintext: bytes, iv: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') → bytes[source]
Encrypts plaintext bytes using AES CBC mode with PKCS7 padding.
-
aioshad.crypto.aes_decrypt(key: bytes, ciphertext: bytes, iv: bytes = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') → bytes[source]
Decrypts ciphertext bytes using AES CBC mode and unpads PKCS7.
RSA Key Exchange
-
aioshad.crypto.create_rsa_keys() → Tuple[str, str][source]
Generates a 1024-bit RSA key pair.
Returns (public_key_str, private_key_pem).
-
aioshad.crypto.generate_tmp_session() → str[source]
Generates random 32-character lowercase string for tmp_session.