Decrypting files from PGP Mac users (MacBinary files)

Claus Soerensen
Fri Jul 27 17:22:02 2001

I had a problem as the above and could't find any solutions on the=20
Internet - but I found it my self so here it goes (for the record):

The PGP Freeware for Mac suggest the user to use a specific method when=20
encrypting files so the format is some kind of MacBinary (should be=20
easier to open the files under Windows then).=20

You can test the filetype with the file command:

$ file decrypted_file.txt
decrypted_file.txt: Macintosh MacBinary data, type "TEXT" (ASCII),=20
creator "TBB6"

If you look at the file the first lines are a lots of escape characters=20
and the last lines aswell. And the middle section is pure ascii. You=20
can convert it with command macsave which has to have the input from=20
standard input. You use the option -d to get the file's data:

$ macsave -d < decrypted_file.txt

And now you have a file named something with a data extension in the=20
current directory (the filname may differ more than just the extension):

Now it is in the right format so the final step is to move it to the=20
right filename (and extension):

$ mv secure_firewall_setup.txt

You can also do the decryption and converting in a oneliner:

$ gpg --decryption file.pgp | macsave -d

Maybe it could be an option for gpg to actualle decrypt and convert on=20
the fly - but that is for me to wish and for the developers to code...

The most enjoyable greetings
Claus S=F8rensen        Electromagnetic Systems    Phone:  +45 45 88 14 4=
Systemadministrator        =D8rsted * DTU          Fax:    +45 45 93 16 3=
4        =D8rsted Plads 348        Web:     www.emi.dtu.d=
+45 45 25 38 44       DK-2800 Lyngby, Denmark