Encryption Settings

class b2sdk.v2.EncryptionKey(secret, key_id)[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, or UNKNOWN_KEY_ID when that information is missing. The secret may be None, if encryption metadata is read from the server.

Parameters:
__init__(secret, key_id)[source]
Parameters:
b2sdk.v2.UNKNOWN_KEY_ID

alias of _UnknownKeyId.unknown_key_id

class b2sdk.v2.EncryptionSetting(mode, algorithm=None, key=None)[source]

Hold information about encryption mode, algorithm and key (for bucket default, file version info or even upload)

Parameters:
__init__(mode, algorithm=None, key=None)[source]
Parameters:
as_dict()[source]

Represent the setting as a dict, for example:

{
    'mode': 'SSE-C',
    'algorithm': 'AES256',
    'customerKey': 'U3hWbVlxM3Q2djl5JEImRSlIQE1jUWZUalduWnI0dTc=',
    'customerKeyMd5': 'SWx9GFv5BTT1jdwf48Bx+Q=='
}
{
    'mode': 'SSE-B2',
    'algorithm': 'AES256'
}

or

{
    'mode': 'none'
}
v2.SSE_NONE = <EncryptionSetting(EncryptionMode.NONE, None, None)>

Commonly used “no encryption” setting

v2.SSE_B2_AES = <EncryptionSetting(EncryptionMode.SSE_B2, EncryptionAlgorithm.AES256, None)>

Commonly used SSE-B2 setting