pygeek_stellar/utils/file.py
def load_encrypted_file(filename, password, read_as_binary=False):
    """
    Loads the specified file to memory and decrypts it with the specified password.
    :param str filename: File to be loaded.
    :param str password: Password to decrypt the file.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    """
    if not _is_valid_password(password):
        print('A valid password must be given to decrypt the file')
        return None

    file_content = load_file(filename, read_as_binary=True)  # Encrypted files are stored as binary
    if file_content is None:
        return None

    decrypted_content = decrypt(file_content, password)
    if decrypted_content is None:
        return None

    return decrypted_content if read_as_binary else decrypted_content.decode()

    Loads the specified file to memory and decrypts it with the specified password.
    :param str filename: File to be loaded.
    :param str password: Password to decrypt the file.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    
Loads the specified file to memory and decrypts it with the specified password.
Loads the specified file to memory and decrypts it with the specified password .
def load_encrypted_file(filename, password, read_as_binary=False):
    if not _is_valid_password(password):
        print('A valid password must be given to decrypt the file')
        return None
    file_content = load_file(filename, read_as_binary=True)  
    if file_content is None:
        return None
    decrypted_content = decrypt(file_content, password)
    if decrypted_content is None:
        return None
    return decrypted_content if read_as_binary else decrypted_content.decode()
def load_encrypted_file ( filename , password , read_as_binary = False ) : if not _is_valid_password ( password ) : print ( 'A valid password must be given to decrypt the file' ) return None file_content = load_file ( filename , read_as_binary = True ) if file_content is None : return None decrypted_content = decrypt ( file_content , password ) if decrypted_content is None : return None return decrypted_content if read_as_binary else decrypted_content . decode ( )
Loads the specified file to memory and decrypts it with the specified password.
Loads the specified file to memory and decrypts it with the specified password .
"""
    Loads the specified file to memory and decrypts it with the specified password.
    :param str filename: File to be loaded.
    :param str password: Password to decrypt the file.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    """ # Encrypted files are stored as binary
Returns the content of the file or None if the file could not be read.
Returns the content of the file or None if the file could not be read .
str or bytearray or None
filename
File to be loaded.
File to be loaded .
password
Password to decrypt the file.
Password to decrypt the file .
read_as_binary
Flag that specifies if the file must be loaded in binary form or not.
This parameter is optional and by default files are not loaded is binary form.
Flag that specifies if the file must be loaded in binary form or not . This parameter is optional and by default files are not loaded is binary form .