braviaproapi.bravia.Encryption

class braviaproapi.bravia.Encryption(bravia_client, http_client)

Bases: object

Provides functionality for encrypted communication with the target device.

Parameters:
  • bravia_client – The parent BraviaClient instance.
  • http_client – The Http instance associated with the parent client.
aes_decrypt_b64(message)

Decrypts AES messages sent from the target device.

Parameters:message (str) – The message to decrypt.
Raises:TypeError – One or more arguments is the incorrect type.
Returns:The decrypted string.
Return type:str
aes_encrypt_b64(message)

Encrypts AES messages to be sent to the target device.

Parameters:message (str) – The message to encrypt.
Raises:TypeError – One or more arguments is the incorrect type.
Returns:The encrypted string.
Return type:str
get_public_key()

Gets the target device’s public encryption key.

Raises:ApiError – The request to the target device failed.
Returns:The device’s public key, base64-encoded. If the device does not have a public key, returns None.
Return type:str or None
get_rsa_encrypted_common_key()

Returns a common key to be used in encrypted communication with the target device.

This common key is generated when the Bravia client is initialized and used throghout the life of the application.

Returns:
An AES common key, encrypted with RSA, to be sent to the target device. If no encryption
capability is available on the target device, returns None.
Return type:str