Skip to content

Deobfuscate fonts in an XPS document

10 June 2007

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:

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:

From → .NET, WPF, XPS

  1. Chakshu Shah permalink

    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 permalink

    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 permalink

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

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: