Well, it turns out to be surprisingly simple to obfuscate/deobfuscate fonts with just with bash and xxd, provided one has the key:
Code:
for line in $(xxd -p -c 20 -l 1040 $file); do
for i in $(seq 0 2 39); do
if [[ ${line:$i:2} == '' ]]; then break; fi
printf "%02x" $(( 0x${line:$i:2} ^ 0x${key:$i:2} ))
done
done | xxd -r -p - $file
That's for the IDPF scheme, the ADE scheme would be similar, I guess.
As for including the code in epub2pdf or similar scripts, I'll probably not distribute it but I don't think there's any (legal or moral) problem in doing so.