Deobfuscate fonts in an XPS document

XPS is the new portable format from Microsoft. The file structure consists of several parts, which includes the text (the so called „fixed documents“) and, of course, all resources. Images and fonts are embedded in a specific folder but as a general rule fonts are obfuscated to „protect“ the copyrights of the author.

To extract the text (which is by the way a subset of XAML) all resources have to be extracted, too. But obfuscated fonts cannot be read, therefore a decryption is required.
The encryption is rather simple: The first 32 bytes are XOR with the GUID of the file (it is also documented in the MSDN). To reverse all font files repeat the exclusive disjunction with the GUID (the file name implies the GUID, thank you) and you will receive the original source (for a better understanding see: http://en.wikipedia.org/wiki/XOR).

I attached a little example. Pass the obfuscated font path and streamOut will return the deobfuscated stream. To save the stream to disc, call streamOut.Position = 0 first.

Edit 2008-10-26:
Here you can find my solution:
http://www.bremora.com/index.php/xps-font-deobfuscator

3 Antworten zu „Deobfuscate fonts in an XPS document“

  1. Chakshu Shah sagt:

    Can you please send me the sample code for deobfuscating the XPS fonts? I am facing problems in doing so and I need it urgently. Nowhere I was able to find the code required to do so but here and here also you have removed the sample code. :(

  2. Daniel Grindelid sagt:

    I am very much interested in this issue. Is there a possibility to get the Sample Code or can I pass any questions regardning this matter?

  3. newbie sagt:

    Could you teach me how to create a GlyphTypeface from an obfuscated xps font?

Eine Antwort schreiben