らんだむな記憶

blogというものを体験してみようか!的なー

Type 1 フォント (2)

前回の記事のスクリプトは IV を飛ばして文字列にして出力すると、

for isEncrypted, chunk in chunks:
    if isEncrypted:
        decrypted_data, R = eexec.decrypt(chunk, 55665)
        print(decrypted_data[4:570].decode())

から

dup /Private
14 dict dup begin
/-| {string currentfile exch readstring pop} def
/|- {def} def
/| {put} def
/BlueValues [-250 -250 1100 1100] def
/StdHW [58] def
/StdVW [63] def
/StemSnapH [58 65 84] def
/StemSnapV [63 73 89] def
/LanguageGroup 1 def
/RndStemUp false def
/password 5839 def
/MinFeature {16 16} def
/OtherSubrs[{}{}{}{systemdict/internaldict known not{pop 3}{1183615869
systemdict/internaldict get exec dup/startlock known{/startlock get exec}{dup
/strtlck known{/strtlck get exec}{pop 3}ifelse}ifelse}ifelse}executeonly]def
/Subrs 5 array
dup 0 15 -|

となって、なるほど PostScript 的なものが見えるなとなって分かりやすい。ここで Subrs が出てきているようにここからサブルーチンの定義が始まるので、7.3 Charstring Encryption の通りに今度は Charstring Encryption を解かないとならない。ので、このまま decode() でこの先のバイト列をデコードすると文字列にできないよという例外が飛んでしまうのだ。