A user downloads a file from a server. I want to store that file locally on the user's machine so they can view offline. For protection, it should be encrypted while not being viewed.

My theory is that you could generate a key to encrypt with using the user's password as input to a KDF so that the key can be created when the user wants to view the file without needing online access and we won't have to store a key locally somewhere.

I am concerned that this now presents an attacker with a possible offline attack to crack a user's password since they can try to generate keys until it decrypts the file. In a world where user's cannot be expected to use good enough passwords to generate strong keys, I suspect this method won't work well in practice.

Is this logic correct? Is there another way to handle this problem?

1 Answer 1


I think that you are trying to fix a problem that doesn't really exist?

Typically, individual files would be encrypted using either a stand alone tool such as WinZip or an integrated tool such as Bitlocker. In the former case, the encryption key IS based on a passcode but one that the person encrypting sets and then shares. In the later case, the file will be encrypted locally when stored in a filing system controlled by the application. Then the user sets the passcode. Each has benefits and disadvantages. You can, of course, combine both approaches.

There are other, more complex approaches to this problem but they require a degree of cooperation and trust between the originating and the receiving systems. Microsoft Azure Rights Management is a good example of this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .