Is there a way to give different names to an OpenSSL encrypted tar file on Mac?

Is there any way to give different names to an OpenSSL encrypted tar file. All these has the same name archive.tar.enc or archive.tar


Fortunately I could decrypt them all as I put them in different folders and put the name on those folders, so I could find them easily , But it would be better if there could be some commands so that I can put a decided name on them ,as it is now all ends with the same name tar or tar.enc


I do not know either if I can send these files to another Mac and decrypt them there too ? I do not think so version openssl are not the same .


This is also interesting ,to send openssl encrypted files to another Mac and decrypt them there ,but this I think maybe not that feasible - now I have libre SSL on one Mac and the other and older version - so this will not be so easy .Or for that reason sending these files to some in mail would be nice to - but Macs have different versions of openssl.


What is more important for me is to get some possibilities to differentiate between these tar files - set a name on them - now they have a name on them - in a folder - but this is not the good either .



[Re-Titled by Moderator]

Original Title: ARCHIVE.TAR.ENC

Posted on Sep 10, 2025 4:27 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 10, 2025 4:38 AM

Open Terminal.app, then type:

tar -czvf - your_directory/ | openssl enc -aes-256-cbc -pbkdf2 -salt -out your_encrypted_file_name.enc


  • tar -czvf - your_directory/: This creates a compressed tar archive (using gzip) and sends it to standard output (the pipe |). 
  • openssl enc: This is the OpenSSL command for symmetric encryption. 
  • -aes-256-cbc: Specifies the encryption algorithm (AES-256 in Cipher Block Chaining mode). 
  • -pbkdf2: Uses a strong key derivation function to derive the key from your password. 
  • -salt: Adds a random salt to the encryption process, which is good practice for security. 
  • -out your_encrypted_file_name.enc: This is the crucial part that tells OpenSSL to name the encrypted output file your_encrypted_file_name.enc


25 replies
Question marked as Top-ranking reply

Sep 10, 2025 4:38 AM in response to kacsavirag

Open Terminal.app, then type:

tar -czvf - your_directory/ | openssl enc -aes-256-cbc -pbkdf2 -salt -out your_encrypted_file_name.enc


  • tar -czvf - your_directory/: This creates a compressed tar archive (using gzip) and sends it to standard output (the pipe |). 
  • openssl enc: This is the OpenSSL command for symmetric encryption. 
  • -aes-256-cbc: Specifies the encryption algorithm (AES-256 in Cipher Block Chaining mode). 
  • -pbkdf2: Uses a strong key derivation function to derive the key from your password. 
  • -salt: Adds a random salt to the encryption process, which is good practice for security. 
  • -out your_encrypted_file_name.enc: This is the crucial part that tells OpenSSL to name the encrypted output file your_encrypted_file_name.enc


Sep 10, 2025 6:28 AM in response to kacsavirag

tar is old school UNIX, and not as common for Mac-to-Mac. zip is more common, and does vastly better cross-platform. And on macOS, OpenSSL is a deprecated since OS X 10.7, unless the mainline version has been installed separately.


Usual for Mac to Mac is using Disk Utility (hdoutil, diskutil) and an encrypted disk image (virtual volume), HFS+ or APFS.


That’s hdiutil create and some mount and dismount commands, sometimes diskutil.


Something like this:


hdiutil create -size 1mb -fs apfs -volname SecretKey -encryption AES-128 MyEncryptedVolume.dmg -attach


Related:


https://apple.stackexchange.com/questions/326068/how-do-i-create-an-encrypted-apfs-volume-from-the-command-line



If you don’t want to use hdiutil and diskutil here for, for instance, cross-platform portability, I’d install and use Filippo Valsorda’s age utility (available via Homebrew), as that UI is much simpler than the deprecated-on-macOS OpenSSL utility. age is harder to screw up.

Sep 12, 2025 5:44 PM in response to kacsavirag

openssl enc -e [rest of command]
openssl enc -d [rest of command]


The -e encryption switch is the default, though I usually specify it. The -d decryption switch must be specified.


As for encryption modes, I wouldn’t usually select CBC. Probably GCM.


https://terrazone.io/aes-256-encryption-types/


Command details: https://docs.openssl.org/3.0/man1/openssl-enc/


Whatever instructions you’re following seem most of twenty years old too, between the use of tar and the selected OpenSSL mode. The command syntax is cryptic too, and it is easy to make (grievous) errors. Which is part of why I suggested using age.

Sep 10, 2025 10:15 AM in response to MrHoffman

-fs HFS+J is what I looked for ,yes this is much simpler that openssl - still I like it to use it .


Can you encrypt an external volume with discutil ? say an SD card or similar volumes ?


I do not want to use any external programs - not even those in Appstore - I learned my lessons - Mac has all that I need .


My openSSL is that of 4.1.0 but that is maybe a version of 3.3.6


It is wery fast to use openssl .


But the dmg is more versatile - probably . I also try to find out how to encrypt an SD card with disutility .


The command worked wery well for the .dmg file .

Sep 15, 2025 9:27 AM in response to MrHoffman

I looked at AGE , It is better that Openssl . I installed it on the CLI


I do not know about any proper commands ,although I looked to it on different websites ,all I found is only a short descriptions of commands .


I would need a proper command for encrypting a folder ,it contains many files ,I would need also the decrypting commands .I will test it out before using it on real folders and files .

Sep 15, 2025 11:52 AM in response to kacsavirag

kacsavirag wrote:

I encrypted a small .txt file with it ,on decrypting it I am asked for my passphrase ,then looking at finder I see still the .txt file encrypted .txt.age and also my original file .txt

I tried to encrypt some .jpg or .heic file ,was not possible . It is only made for .txt files ? But then this cannot encrypt a folder ?


“Not possible” is not an age error message I am familiar with. Slightly more seriously, if you want to discuss errors and issues this and similar contexts, you will want to show the command(s) used, and any error messages received. Some sort of a reproducer that is, allowing others to see what you did, and what happened.


From the examples section of the age tool, this showing encryption using an ssh key, an example encrypting and decrypting JPG files:



You may want to use the “armor” switch if you’re going to be mailing the encrypted files around.

Sep 15, 2025 7:06 PM in response to kacsavirag

kacsavirag wrote:

The letters are too small ,unreadable , please use code insertion


The screen shots are from the previously-linked man page for age, as was mentioned in that reply.


You can and should read the man page to learn about the tool, and for this example.


As for learning how to use the rendering features of your particular web browser, that depends on which browser.


You can find more information on the screen zoom feature in Safari here:

Zoom in on webpages in Safari on Mac - Apple Support


The following example of live text is from iPad, but recent macOS has similar features:



Selecting Show Text in the pop-up gets the text, and a Copy All feature, as shown below.



Again, this is from iPad, but recent macOS has similar features.


For more info: Use Live Text to interact with text in a photo on Mac - Apple Support


Is there a way to give different names to an OpenSSL encrypted tar file on Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.