unix shell encryption routine
unix shell encryption routine
- Subject: unix shell encryption routine
- From: Hudson Barton <email@hidden>
- Date: Tue, 19 Nov 2002 10:25:46 -0500
The following script appears to be producing something that looks
like a valid encryption, but of course it's impossible to tell for
sure until you can decrypt the result back to the original text. So
far I've been unsuccessful, and this stuff is not documented to my
knowledge.
I'm quite sure that part of the answer lies in the padding bytes of
the result. The Blowfish algorithm and others work in 8 byte
segments, so the result is supposed to be a string whose length is a
multiple of 8, and so it is. Blowfish appears to be padding out the
result at the end of the string to get to a multiple of 8. However,
there are 8 bytes at the beginning of the result labeled "Salted__"
which also look suspiciously like padding. I don't think the leading
8 bytes are part of the encryption itself, so I plan to strip them
off to get to the actual result.
Finally, once I understand what the result of the encryption is
supposed to be, then I need to figure out the syntax for decryption.
So far no luck. It apparently requires the prefix "d" or "-d" in the
command, but I haven't played around with it enough to see what
actually works. Suggestions?
Here's the basic encryption routine:
set s to text returned of (display dialog "Phrase" default answer
"Some String")
set fin to "/private/tmp/in.txt"
set fout to "/private/tmp/out.txt"
set finmac to POSIX file fin
set foutmac to POSIX file fout
open for access finmac with write permission
set eof finmac to 0
write s to finmac
close access finmac
set thePass to text returned of (display dialog "Enter a password."
default answer "somepassword")
do shell script "openssl bf -salt -pass pass:" & thePass & " -in " &
fin & " -out " & fout
set CryptString to read foutmac
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.