MacOS – Unable to convert dmg to encrypted dmg on Yosemite

disk-utilitydmgencryptionmacosterminal

When I try to convert a regular (internet downloaded) dmg file to an encrypted dmg (256-bit AES) using Disk Utility on Yosemite it gives me this error message:
Unable to create "CleanMM231.dmg." (Inappropriate ioctl for device)

How do I get this to work on Yosemite? If not via Disk Utility, is there a way to convert it using Terminal commands? I was aways able to do this on Mavericks, but after I upgraded to Yosemite I get the above error message. I'm sure that the dmg isn't corrupted as I downloaded AirSquirel's Reflector trial dmg, tried to convert and I got the same error message. If it helps I'm using a Mid-2013 MacBook Air.

Best Answer

I've figured it out! Though still appears that converting a dmg file to an encrypted one using Disk Utility is still broken as of OS X 10.10 (Yosemite), I've figured out a way to do it via terminal using this:

hdiutil convert /PATH/TO/FILE -format UDZO -encryption AES-256 -o /OUTPUT/FILE

This converts a dmg using AES-256 encryption and uses zlib compression. I hope that Apple fixes this in Yosemite soon though. I got some inspiration/help from this Super User question: Further compressions of disk image files