I am programmatically creating a DOCX file using OpenXML SDK v2. One of the requirements of the document is it be protected to avoid editing.
This is accomplished using the DocumentProtection object like:
new DocumentProtection
{
Edit = DocumentProtectionValues.ReadOnly,
Enforcement = BooleanValues.One,
CryptographicProviderType = CryptProviderValues.RsaFull,
CryptographicAlgorithmClass = CryptAlgorithmClassValues.Hash,
CryptographicAlgorithmType = CryptAlgorithmValues.TypeAny,
CryptographicAlgorithmSid = 4,
CryptographicSpinCount = 50000,
Hash = hash,
Salt = salt
}
This works beautifully when the document is opened in Word 2007, but when opened in Word 2003 with the compatibility pack the protection can be removed without entering a password.
Reading online this appears 'by design' or at least expected.
Does anyone have any clever ideas on keeping the password protection in-tact when viewed within Word 2003?