Protecting documents with OpenXML SDK 2

I am creating a DOCX file programmatically using OpenXML SDK v2. One of the requirements of the document is its protection to avoid editing.

This is done with a DocumentProtection object, for example:

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 fine when the document is opened in Word 2007, but when opened in Word 2003 with the Compatibility Pack, the protection may be removed without entering a password.

Online it looks "by design", or at least expected.

Does anyone have any clever ideas for password protection tactics when viewing in Word 2003?

+2


source to share





All Articles