Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encryption and chunk file read #2

Open
salvatorenitopi opened this issue Jul 24, 2018 · 7 comments
Open

Encryption and chunk file read #2

salvatorenitopi opened this issue Jul 24, 2018 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@salvatorenitopi
Copy link

salvatorenitopi commented Jul 24, 2018

Hi, i think that this is a very smart idea, I have some possible enhancements for you:

  1. reading and computing file in chunks
  2. adding AES encryption (in CBC mode)

To be more specific I would read the file in blocks long as the size of a page, then I would encrypt the block and upload it on Google documents (as a page)

A very simple example:

with open(path, 'rb') as f:
    for chunk in iter(lambda: f.read(4096), b''):
        enc = encrypt_fx (chunk)
        upload_page_fx (enc)

Let me know what you think.

@salvatorenitopi
Copy link
Author

salvatorenitopi commented Jul 24, 2018

Sorry for bad indentation in my example code. And by the way I meant "encryption" in the title.

@stewartmcgown
Copy link
Owner

@salvatorenitopi Good idea! I reckon it will allow us to process larger files without the enormous memory footprint needed currently :-)

@stewartmcgown stewartmcgown added the enhancement New feature or request label Jul 24, 2018
@stewartmcgown stewartmcgown self-assigned this Jul 24, 2018
@stewartmcgown stewartmcgown changed the title Emcryption and chunk file read Encryption and chunk file read Jul 24, 2018
@stewartmcgown
Copy link
Owner

Multithreading added with 13079d5. Encryption will be next!

@salvatorenitopi
Copy link
Author

salvatorenitopi commented Jul 25, 2018

Nice, I would use AES - CBC as encryption method (example: https://gist.github.com/forkd/168c9d74b988391e702aac5f4aa69e41 to edit according below)

I would encrypt a page in this way (CFB example):

Block0 -> random IV
Block1 -> AES ( xor (x1, Block0) , key)
Block2 -> AES ( xor (x2, Block1) , key)
BlockN -> AES ( xor (xN, BlockN-1) , key)

(Where x is the plaintext)

Multithreading may not be possible using this method.

@stewartmcgown
Copy link
Owner

Multithreading should be possible with this :-)

@jarmo
Copy link

jarmo commented May 17, 2019

Why not create a possibility for piping data into uds so that you could encrypt with any tool, which reads file in and prints encrypted output to stdout? In that way you would eliminate the need to have encryption built into the uds itself and everyone could use whatever encryption they like.

@Fuco1
Copy link

Fuco1 commented May 19, 2019

Using uds as a backend for git-annex would be also a pretty easy way to achieve this. But it comes with all the complexity of that tool attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants