DecryptFile ["password",file]
generates a decrypted version of a file, using the specified password.
DecryptFile ["password",source,target]
generates a decrypted version of source, putting the result in target.
DecryptFile [keyspec,source,…]
decrypts using the cryptographic key specification keyspec.
DecryptFile
DecryptFile ["password",file]
generates a decrypted version of a file, using the specified password.
DecryptFile ["password",source,target]
generates a decrypted version of source, putting the result in target.
DecryptFile [keyspec,source,…]
decrypts using the cryptographic key specification keyspec.
Details and Options
- DecryptFile takes a file encrypted by EncryptFile .
- DecryptFile works with both files and cloud objects.
- DecryptFile [key,file] returns the name of the decrypted version of file, or $Failed if the file could not be decrypted with key.
- DecryptFile [key,CloudObject […]] returns a new anonymous cloud object containing the decrypted version of the contents of the original cloud object, or $Failed if the original cloud object could not be decrypted with key.
- DecryptFile [key,File […]] is also supported.
- The cryptographic key specification keyspec for DecryptFile [keyspec,…] has the same form as for Decrypt .
- DecryptFile has the following options:
-
- The setting for Permissions affects only cloud objects newly created by DecryptFile [key,CloudObject […]], not cloud objects explicitly specified as targets.
- With Permissions->Automatic , any permissions set will be given by $Permissions . However, if $Permissions is not "Private", DecryptFile will give a message when it generates a cloud object.
- The setting for OverwriteTarget affects only files to be newly created by DecryptFile [key,file] whose names would collide with existing files.
Examples
open all close allBasic Examples (4)
Write a string to the file tmp.txt:
Close the file:
Encrypt the file tmp.txt using a password:
Delete the original file:
Decrypt the encrypted file:
Read the decrypted file:
Delete the files used in this example:
Encrypt a file containing an image, putting the result in a new file:
Decrypt the encrypted file, again putting the result in a new file:
Import the decrypted file:
Delete the files used in this example:
Create a cloud object:
Encrypt the cloud object, getting back another cloud object:
Decrypt the encrypted cloud object, getting back yet another cloud object:
Get the contents of the decrypted cloud object:
Create an archive file from a directory:
Encrypt the archive file:
Delete the original archive:
Decrypt the encrypted archive:
Extract the archive into the current directory:
Delete the extracted directory and intermediate files used in this example:
Scope (2)
Encrypt a file and put the result in a cloud object:
Decrypt the cloud object and put the result into a local file:
Import the file:
Generate a key:
Encrypt using the key:
Decrypt using the same key:
Options (2)
Permissions (1)
Create a cloud object:
Encrypt the cloud object:
Decrypt the cloud object, creating a new cloud object and setting its permissions to public:
The decrypted cloud object is now publicly readable:
OverwriteTarget (1)
Write a string to the file tmp.txt:
Encrypt the file:
This attempts to write over tmp.txt:
With OverwriteTarget->True , DecryptFile overwrites tmp.txt:
Possible Issues (2)
Write a string to a file:
Close the file:
Encrypt the file using the password "my password":
Delete the original file:
If you use the wrong password, you get a message:
Create a cloud object:
Encrypt the cloud object, getting back another cloud object:
If $Permissions is not "Private", DecryptFile gives a message:
If the Permissions option is explicitly set, no message is issued:
Related Guides
Text
Wolfram Research (2017), DecryptFile, Wolfram Language function, https://reference.wolfram.com/language/ref/DecryptFile.html (updated 2020).
CMS
Wolfram Language. 2017. "DecryptFile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/DecryptFile.html.
APA
Wolfram Language. (2017). DecryptFile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DecryptFile.html
BibTeX
@misc{reference.wolfram_2025_decryptfile, author="Wolfram Research", title="{DecryptFile}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DecryptFile.html}", note=[Accessed: 06-December-2025]}
BibLaTeX
@online{reference.wolfram_2025_decryptfile, organization={Wolfram Research}, title={DecryptFile}, year={2020}, url={https://reference.wolfram.com/language/ref/DecryptFile.html}, note=[Accessed: 06-December-2025]}