Edward Elliott wrote: >You need to find the exact algorithm the DESCryptoServiceProvider uses. >CBC and CTR are common modes with IVs. Besides mode of operation, there's >the issue of how it pads the data (in the cipher, not base64). There could >also be differences in things like the key scheduling routines, but that's >less likely. Until you know exactly what the original code does, your only >option is trial and error. > > > I read some of the C# documentation on DESCryptoServiceProvider, but it was completely useless for my purpose. The documentation basically only tells you how to use the class, not what it does.
I managed to *decrypt* a string encrypted by the C# method using CBC mode, as suggested by Gary (thanks). The python CBC encryption results in a different encrypted string, but decrypting both these strings returns the original plaintext value. As for padding, the C# method uses characters '\x01' to '\x07' for padding. If there are 3 padding characters needed (eg with a password of 5 chars), then three '\x03' chars will be used. Similarly, a 2-char password will be padded with '\x06' * 6 Regards, Andreas Pauley _____________________________________________________________________________________________ This e-mail contains official information from Quality Business Consultants (Pty) Ltd and is intended for use by the addressee only. Important notice: Important restrictions, qualifications and disclaimers ("the Disclaimer") apply to this email. To read this click on the following address: http://www.qbcon.com/disclaimer The Disclaimer forms part of the content of this email in terms of section 11 of the Electronic Communications and Transactions Act, 25 of 2002. If you are unable to access the Disclaimer, send a blank e-mail to [EMAIL PROTECTED] and we will send you a copy of the Disclaimer. -- http://mail.python.org/mailman/listinfo/python-list