I need to use this method from C# code (in Word and Excel) and it seems the only sample code uses RC4 and 128 key length. I can see a list of possible providers here:
And some indication of many algorithm options:
But no guide to valid string inputs and combinations thereof for the above method... I understand that not all providers will be available on older systems, but I'm developing or Win8 Pro so I'm assuming that AES is there.
I've tried just "AES" as algorithm with various key lengths (128, 256, 1024) using either "Microsoft Strong Cryptographic Provider" or "Microsoft AES Cryptographic Provider" but just get a singularly uninformative "insufficient memory" COM exception.
Would it kill you guys to provide an AES sample? Or at least some links from this page:
to wherever the info I haven't found is?
I found two samples from MSDN:
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>
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.
- Edited by George Hua -MSFTModerator Friday, August 30, 2013 3:07 AM
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:
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:
clearly states that the default is AES 128 bit, so how do I implement that from the .NET API?