b2sdk.encryption.setting
¶
-
class
b2sdk.encryption.setting.
EncryptionKey
(secret: Optional[bytes], key_id: Optional[str])[source]¶ Hold information about encryption key: the key itself, and its id. The id may be None, if it’s not set in encrypted file’s fileInfo. The secret may be None, if encryption metadata is read from the server.
-
SECRET_REPR
= '******'¶
-
-
class
b2sdk.encryption.setting.
EncryptionSetting
(mode: b2sdk.encryption.types.EncryptionMode, algorithm: Optional[b2sdk.encryption.types.EncryptionAlgorithm] = None, key: Optional[b2sdk.encryption.setting.EncryptionKey] = None)[source]¶ Hold information about encryption mode, algorithm and key (for bucket default, file version info or even upload)
-
class
b2sdk.encryption.setting.
EncryptionSettingFactory
[source]¶ -
classmethod
from_file_version_dict
(file_version_dict: dict) → b2sdk.encryption.setting.EncryptionSetting[source]¶ Returns EncryptionSetting for the given file_version_dict retrieved from the api
... "serverSideEncryption": {"algorithm": "AES256", "mode": "SSE-B2"}, "fileInfo": {"sse_c_key_id": "key-identifier"} ...
-
classmethod
from_bucket_dict
(bucket_dict: dict) → Optional[b2sdk.encryption.setting.EncryptionSetting][source]¶ Returns EncryptionSetting for the given bucket dict retrieved from the api, or None if unauthorized
Example inputs:
... "defaultServerSideEncryption": { "isClientAuthorizedToRead" : true, "value": { "algorithm" : "AES256", "mode" : "SSE-B2" } } ...
unset:
... "defaultServerSideEncryption": { "isClientAuthorizedToRead" : true, "value": { "mode" : "none" } } ...
unknown:
... "defaultServerSideEncryption": { "isClientAuthorizedToRead" : false } ...
-
classmethod
-
b2sdk.encryption.setting.
SSE_NONE
= <EncryptionSetting(EncryptionMode.NONE, None, None)>¶ Commonly used “no encryption” setting
-
b2sdk.encryption.setting.
SSE_B2_AES
= <EncryptionSetting(EncryptionMode.SSE_B2, EncryptionAlgorithm.AES256, None)>¶ Commonly used SSE-B2 setting