Encrypt and Password Protect a .zip on a Mac using Automator Service

I recently needed to provide some sensitive documents to someone and the quickest method was email. However, I wanted to secure the contents (even just a little) before sending.

I was able to quickly complete the task using the Terminal and entering the following command string thanks to an article I found on imore.com. First change your directory in the terminal as this will eliminate the user path file structure being included in the saved zip.

zip -er FILENAME.zip FILESorFOLDERStoCOMPRESS

Later, I thought this might be something I’d need to do again and I wondered if there might be a way to turn this into a service or app. There are are several options out there, but this method from Macworld has seemed to work great. I included the instructions below…

OpenAutomator and choose “Service” (the gear). Change “Service receives selected” to Files or folders in “Finder.app”

Add the “Run Applescript” step and then copy the code below and replace all the code in the “Run Applescript” command with this code. 

Choose save, naming it something like “Make Protected Zip”, then test it by going to the finder and selecting one or more files/folders. Scroll down to the “Services” Menu and select the service with the name you just saved as.

on run {input, parameters}
	set dialogResults to display dialog "Name for zipped file (no extension)" default answer "Archive" buttons {"OK", "Cancel"} default button "OK"
	if button returned of dialogResults is "OK" then
		
		set passwd to "x"
		set passwd_2 to "y"
		repeat while passwd ≠ passwd_2
			tell application "System Events"
				activate
				set passwd to text returned of (display dialog "password for zipped file" default answer "" buttons {"OK", "Cancel"} default button "OK" with hidden answer)
				set passwd_2 to text returned of (display dialog "Please reenter your password" default answer "" buttons {"OK", "Cancel"} default button "OK" with hidden answer)
			end tell
			
		end repeat
		
		set archiveName to text returned of dialogResults
		
		tell application "Finder"
			set archiveFileName to archiveName & ".zip"
			-- Append on a number if file exists.
			set suffix to 1
			set theFileExists to true
			repeat while theFileExists
				try
					set archiveFile to ((container of (item 1 of input) as Unicode text) & archiveFileName)
					if exists file archiveFile then
						set archiveFileName to archiveName & suffix & ".zip"
						set suffix to suffix + 1
					else
						set theFileExists to false
					end if
				end try
			end repeat
		end tell
		set itemStr to ""
		repeat with thisItem in input
			set itemPath to quoted form of (POSIX path of thisItem)
			tell application "Finder"
				set parentFolder to POSIX path of (container of thisItem as alias)
			end tell
			set itemStr to itemStr & " " & itemPath
		end repeat
		set zipFile to quoted form of (parentFolder & archiveFileName)
		set cmd to "zip -P " & passwd & " -rj " & zipFile & " " & itemStr & " -x *.DS_Store"
		do shell script cmd
	end if
	return
end run

Posted in technology | Tagged , , , | Leave a comment

Testing on VPS

Propagated?

Posted in technology | Leave a comment

SecurityNow covers BitCoin CryptoCurrency

Steve Gibson first covered this back in February of 2011. Amazing how significant this has become.

List to the episode: https://media.grc.com/SN/sn-287-lq.mp3

Show notes: https://www.grc.com/sn/sn-287.htm

It was rebroadcast recently on TWIT.TV as the Story of Bitcoin. Really helps to better understand how it all works.

Posted in technology | Tagged , , | Leave a comment

Drafts looks like a handy productivity app

So often I just want to jot down some text and then decide where to put it. Drafts for iOS looks like the app that fits the need. Capture and Share!

Posted in technology | Tagged , | Leave a comment

WordPress Slider Plugin

In need of a slider plugin for a business website and a friend recommended RoyalSlider. Looks great. Anyone else using this? Is it worth the $20? The templates look nice.

Posted in technology | Tagged | Leave a comment

Moving your iTunes library to a new computer

I recently helped a friend with a new computer. I found this handy guide from Apple to help with moving his iTunes library from his old PC to his new Mac.

Posted in technology | Tagged | Leave a comment

CheatSheet for Mac

I’ve been using a Mac for years and I still find this CheatSheet helpful.

Posted in technology | Tagged , , | Leave a comment

Dashing – The exceptionally handsome dashboard framework.

Dashing – The exceptionally handsome dashboard framework..

Looks like a powerful framework for building data dashboards. Will need to investigate further when I have some time.

Posted in technology | Tagged , , , | Leave a comment

iStat Pro Widget for OS X 10.8 Mountain Lion

iStat Pro Widget for OS X 10.8 Mountain Lion.

Seems to also be working with 10.9 Mavericks. Just wanted the free widget for now, but may upgrade to the full iStat Menus app some day.

Posted in technology | Tagged , , | Leave a comment

PopClip for Mac

PopClip

PopClip

This looks like a very handy tool for Mac users. PopClip from Pilotmoon.com provides more than just copy & paste when you select text. With more than 90 extensions you can translate, share on social networks or add to various note and todo applications. This handy little utility may just increase your productivity for only $4.99.

Posted in technology | Tagged , , | Leave a comment