Here is the example of how you can encrypt/decrypt large files in Python using Virgil Python Crypto Library. 

from virgil_crypto import VirgilCrypto, VirgilSeqCipher

CHUNK_SIZE = 1024

def read_in_chunks(file_obj, chunk_size=CHUNK_SIZE):
    while True:
        data = file_obj.read(chunk_size)
        if not data:
            break
        yield data

if __name__ == '__main__':
    crypto = VirgilCrypto()
    large_file = open("/PATH/TO/YOU/FILE", "rb")

    chunk_list = []

    for chunk in read_in_chunks(large_file):    chunk_list.append(bytearray(chunk))

    large_file.close()

    key_pair1 = crypto.generate_keys()

    # Encrypt
    encrypt_seq_cipher = VirgilSeqCipher()
    encrypt_seq_cipher.addKeyRecipient(key_pair1.public_key.identifier, key_pair1.public_key.raw_key)

    encrypted_chunks = list()
    encrypted_chunks.append(encrypt_seq_cipher.startEncryption())

    for index, chunk in enumerate(chunk_list):
        encrypted_chunks.append(encrypt_seq_cipher.process(chunk))
        if index == len(chunk_list) - 1:
            try:
                last_piece = encrypt_seq_cipher.finish()
                if last_piece:
                    encrypted_chunks.append(last_piece)
            except Exception as e:
                print(e)

    # Decrypt
    decrypt_seq_cipher = VirgilSeqCipher()    decrypt_seq_cipher.startDecryptionWithKey(key_pair1.private_key.identifier, key_pair1.private_key.raw_key)

    decrypted_chunks = list()
    for index, chunk in enumerate(encrypted_chunks):
        decrypted_chunks.append(decrypt_seq_cipher.process(chunk))        if index == len(encrypted_chunks) - 1:            print("Last index", index)            try:
                last_piece = decrypt_seq_cipher.finish()
                if last_piece:
                    decrypted_chunks.append(last_piece)
            except Exception as e:
                print(e)

    new_large_file = open("/PATH/TO/YOU/DECRYPTED/FILE", "wb")

    for chunk in decrypted_chunks:
        new_large_file.write(bytearray(chunk))
    new_large_file.close()

Also you can use this code to decrypt large files on the server-side in Python if you use the JavaScript library for encryption on the client-side (JS encryption example can be found here).

Did this answer your question?