• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: When is a disk image file encrypted?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When is a disk image file encrypted?


  • Subject: Re: When is a disk image file encrypted?
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 17 May 2008 15:14:04 -0500

Long, long ago, On Mon, 27 Nov 2006 15:07:28 -0600 I wrote ...

My script is designed to compress (UDZO) [and optionally encrypt] a read-write (UDRW) or an uncompressed read-only (UDRO) disk image file. It should ignore other disk image files. It should ignore any encrypted disk image file. Here is the script to test that ...

try
	"hdiutil imageinfo " & sourceImage & " -format"
	set dmgInfo to (do shell script the result)
on error -- notify user that format is not available
	return
end try
if dmgInfo is not in {"UDRW", "UDRO"} then
	-- notify user that input file is not right format
	return
end if


If the dmg file is encrypted, the 'do shell script ...' shows a dialog asking for the password. I see the illogic of this and simply click Cancel. My users will probably be confused by this dialog. To avoid the dialog, I need to be able to determine if the file is encrypted WITHOUT reading the file. Or I need to be able to supress the password dialog, if possible.

The 'hdiutil imageinfo ...' command, without '-format', does return encryption status, but not until you enter the password via the dialog.

I've looked at the DiskImageMounter application. It's scriptable, but no commands to handle encryption.

Any ideas? ... or am I screwed?
It got no reply and I had forgotten all about it until it came up again yesterday. Once you've tried everything that does not work, the next thing you try has to work ... and it did! Here's a handler that will do the trick ...

on isEncrypted(imageAlias)
	quoted form of (POSIX path of imageAlias)
	try
		do shell script " hdiutil imageinfo " & the result & " -stdinpass"
	on error
		return true
	end try
	return false
end isEncrypted

The password dialog DOES NOT appear!

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: When is a disk image file encrypted?
      • From: Luther Fuller <email@hidden>
  • Prev by Date: address book problem...
  • Next by Date: Re: address book problem...
  • Previous by thread: Re: Re: address book problem...
  • Next by thread: Re: When is a disk image file encrypted?
  • Index(es):
    • Date
    • Thread