fcrypter.base package

Submodules

fcrypter.base.custom_exceptions module

exception fcrypter.base.custom_exceptions.WrongKeySizeError[source]

Bases: exceptions.Exception

fcrypter.base.templates module

class fcrypter.base.templates.Cryptor(supported_sizes)[source]

Bases: object

decrypt_file(key, encr_fpath, decr_fpath)[source]

File decryption base method

Needs a key, a file path to decrypt and a resulting file path for the decrypted file to be saved

Parameters:
  • key – a key to use for the file decryption
  • encr_fpath – absolute path for the encrypted file
  • decr_fpath – absolute path for the decrypted file to be saved
encrypt_file(key, f_path, encr_fpath)[source]

File encryption base method

Needs a key, a file path to encrypt and a resulting file path for the encrypted file to be saved

Parameters:
  • key – a key to use for the file encryption
  • f_path – absolute path for the file to be encrypted
  • encr_fpath – absolute path for the encrypted file to be saved
generate_random_password(size=None, chars=None)[source]

Random password generator If size not specified, chooses randomly from the supported sizes If chars are specified, generates password for those chars Else generates random size bytes

Parameters:
  • size (int) – password size
  • chars (iterable) – chars to choose password from
Returns:

random password

Return type:

bytes

verify_supported_key_size(key)[source]

Verifies key size is supported

Parameters:key – key to be used for encryption

Module contents