none
SetPasswordEncryptionOptions ... what are the options?

All replies

  • Hi malcolm.

    I found two samples from MSDN:

    Word : Document.SetPasswordEncryptionOptions Method

    Excel : WorkbookBase.PasswordEncryptionAlgorithm Property

    I run the code without issue when I choose Microsoft Strong Cryptographic Provider.

    "Microsoft AES Cryptographic Provider" is not supported in Cryptographic Provider Names.

    I only find "Microsoft Enhanced RSA and AES Cryptographic Provider".

    I run these code in my VM(Windows server 2003 and Office 2010).

    Which version of Office did you install?

    I also run these code successfully on windows 8(Office 2013).


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.




    Thursday, August 29, 2013 5:51 PM
    Moderator
  • Hi George,

    Thanks for the reply, but those samples you mention are the ones I refer to that only show RC4 / and 128 (or 56) bit. And yes, I too can get those to work if I select RC4 and 128 bit. I'm sorry if I wasn't clear in my original request but I need to implement AES encryption, preferably with 256 bit or higher keys so I'm looking for the correct combination of string parameters to do that. I've tried using both the '..Strong...'  and 'Enhanced RSA etc...' provider names, sorry I shortened that to just the 'AES...' I was looking at this page at the time:

    http://msdn.microsoft.com/en-us/library/aa386979(v=vs.85).aspx

    Which clearly does support more than the RC4 algorithm, more than the 'Base Cryptographic Provider', right?

    I am also aware that part of the documentation mentions Word supporting 'stream-encrypted algorithms' which RC4 is, but AES is a 'block encryption algorithm'. I guess I am assuming that this was old 'out-of-date' text since the description for encryption via the UI here:

    http://office.microsoft.com/en-ca/word-help/password-protect-documents-workbooks-and-presentations-HA010148333.aspx

    clearly states that the default is AES 128 bit, so how do I implement that from the .NET API?

    Friday, August 30, 2013 8:07 PM