# How to encrypt a file?

## ressia

Good day! I am Ressia. I am new to this forum. I just want to ask if do you have any knowledge on how to encrypt a file so that it wouldn't be copied? Is there a way how to do it?

----------

## PhoenixStarEclipse

Use zip.

----------

## desultory

 *ressia wrote:*   

> Good day! I am Ressia. I am new to this forum. I just want to ask if do you have any knowledge on how to encrypt a file so that it wouldn't be copied? Is there a way how to do it?

 That is not what encryption does. You can copy encrypted files without limitation; the encryption just renders the contents, effectively, unreadable, without the decryption key(s), despite being freely copyable. You could use a device which does not allow files stored on it to be read from it directly, at least via interfaces which it provides, but those are typically used for encryption keys, as opposed to general file storage given the inability to read the file(s) stored therein.

This leaves the question of what your actual use case is: what are you trying to secure, and what are you trying to secure it from?

Also, gpg (app-crypt/gnupg) or a frontend for it would be the more or less canonical recommendation for introductory file encryption software.

Moved from Documentation, Tips & Tricks to Networking & Security.

----------

## szatox

 *Quote:*   

>  I just want to ask if do you have any knowledge on how to encrypt a file so that it wouldn't be copied?

 In "classic" (e.g. not quantum) computing, every single use of any data creates a copy.

Copy from disk to RAM, from RAM to CPU registers, copy over the internet to display in user's browser, copy into GPU buffer to display on screen.... Every single action you can take.

You technically could embed your file in hardware. This is actually implemented for public key cryptography with SmartCard. A SmartCard has some memory (with private key) and its own CPU used for encrypting small chunks of data (e.g. hashes for signing or symmetric keys used for data encryption ), so all the copies are contained in a package difficult to disassemble without destroying the data stored inside card's memory.

Obviously, you can't do that with any significant amount of data - cards are small and slow - or with any data you want to use directly.

Now, what is your particular use case?

If you want to create some web service that allows users to browse your data online but without storing it on disk (your initial message sounds like something along those lines), it's not gonna work because #1 described above. Your user already has a usable copy. You can refuse to provide an interface with a big, shiny "save" button, but you can't stop him from using an "alternative" approach like e.x. copying browser's temporary files to another location.

----------

