pycoffer.coffers package

Submodules

pycoffer.coffers.bank module

CofferBank : maximum security

  • Double encryption with Aes and Nacl

  • Compression with pyzstd

Usage :

  • Confidential datas

class pycoffer.coffers.bank.CofferBank(filename=None, mode=None, fileobj=None, auto_flush=True, backup=None, coffer_key=None, secure_key=None, **kwargs)

Bases: Coffer

crypt_open(filename, mode='r', **kwargs)

Return a crypting open function to encrypt esternal files for examples. Use keys of the coffer.

classmethod gen_params()

Generate params for a new store : keys, … as a dict

pycoffer.coffers.bank.open(filename, mode='rb', auto_flush=True, backup=None, secure_key=None, coffer_key=None, **kwargs)

Open a CofferBank file in binary mode.

The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to.

The mode argument can be “r”, “rb”, “w”, “wb”, “x”, “xb”, “a” or “ab” for binary mode.

For binary mode, this function is equivalent to the CofferBank constructor: CofferBank(filename, mode, coffer_key). In this case, the encoding, errors and newline arguments must not be provided.

pycoffer.coffers.market module

MarketStore :

  • File encyption with Nacl

  • Coffer compression with Pyzstd

  • Autoflush disable : close coffer or call flush to write update to coffer file.

Usage:

  • Archiving big files

class pycoffer.coffers.market.CofferMarket(filename=None, mode=None, fileobj=None, auto_flush=False, backup=None, secure_key=None, **kwargs)

Bases: Coffer

crypt_open(filename, mode='r', **kwargs)

Return a crypting open function to encrypt esternal files for examples. Use keys of the coffer.

classmethod gen_params()

Generate params for a new store : keys, … as a dict

pycoffer.coffers.market.open(filename, mode='rb', auto_flush=False, backup=None, secure_key=None, **kwargs)

Open a CofferMarket file in binary mode.

The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to.

The mode argument can be “r”, “rb”, “w”, “wb”, “x”, “xb”, “a” or “ab” for binary mode.

For binary mode, this function is equivalent to the CofferMarket constructor: CofferMarket(filename, mode, secret_key). In this case, the encoding, errors and newline arguments must not be provided.

pycoffer.coffers.null module

NullStore :

  • No encyption at all !!! for testing only

  • Coffer compression with Pyzstd

  • Files use internal open

  • Autoflush disable : close coffer or call flush to write update to coffer file.

class pycoffer.coffers.null.CofferNull(filename=None, mode=None, fileobj=None, auto_flush=False, backup=None, **kwargs)

Bases: Coffer

crypt_open(filename, mode='r', **kwargs)

Return a crypting open function to encrypt esternal files for examples. Use keys of the coffer.

pycoffer.coffers.null.open(filename, mode='rb', auto_flush=False, backup=None, **kwargs)

Open a CofferMarket file in binary mode.

The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to.

The mode argument can be “r”, “rb”, “w”, “wb”, “x”, “xb”, “a” or “ab” for binary mode.

For binary mode, this function is equivalent to the CofferNull constructor: CofferNull(filename, mode). In this case, the encoding, errors and newline arguments must not be provided.

pycoffer.coffers.store module

CofferStore : fast and small

  • Coffer encryption with Nacl

  • File compression with Pyzstd

  • Autoflush disable : close coffer or call flush to write update to coffer file.

  • Files are store in clear in temp directory

Usage:

  • Archiving : can use external zstd dict to maximize data compression

class pycoffer.coffers.store.CofferStore(filename=None, mode=None, fileobj=None, auto_flush=False, backup=None, coffer_key=None, **kwargs)

Bases: Coffer

crypt_open(filename, mode='r', **kwargs)

Return a crypting open function to encrypt esternal files for examples. Use keys of the coffer.

classmethod gen_params()

Generate params for a new store : keys, … as a dict

pycoffer.coffers.store.open(filename, mode='rb', auto_flush=False, backup=None, coffer_key=None, **kwargs)

Open a CofferStore file in binary mode.

The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to.

The mode argument can be “r”, “rb”, “w”, “wb”, “x”, “xb”, “a” or “ab” for binary mode.

For binary mode, this function is equivalent to the CofferStore constructor: CofferStore(filename, mode, aes_key). In this case, the encoding, errors and newline arguments must not be provided.

Module contents