Click here to Skip to main content
15,923,222 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Member 90677771-Aug-12 5:40
Member 90677771-Aug-12 5:40 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Dave Kreskowiak1-Aug-12 4:45
mveDave Kreskowiak1-Aug-12 4:45 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Member 90677771-Aug-12 5:36
Member 90677771-Aug-12 5:36 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Dave Kreskowiak1-Aug-12 6:46
mveDave Kreskowiak1-Aug-12 6:46 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Member 90677771-Aug-12 7:10
Member 90677771-Aug-12 7:10 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Dave Kreskowiak1-Aug-12 7:16
mveDave Kreskowiak1-Aug-12 7:16 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Dave Kreskowiak1-Aug-12 7:08
mveDave Kreskowiak1-Aug-12 7:08 
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Member 90677771-Aug-12 10:23
Member 90677771-Aug-12 10:23 
Dave Kreskowiak wrote:
He should be giving you a library .DLL that you can use that handles this stuff.


He did it. He sent me a .DLL containing the Decrypt method:

public string Decrypt(strInputString, strKeyString, myIV);

but when i call that function, the program writes a log file showing "Cryptographic Exception: Padding is invalid and cannot be removed". After that, i decompiled the .DLL and asked to the sysadmin if the function i found in the .DLL (what i posted here) was correct, and he said it was. Running the function from the sourcecode, and running it from .DLL added by reference, shows the same error.

Unfortunately, i tried your suggestions, and they doesn't work. I've changed the length assignment, from keySize/0x10 to blockSize/16. I've changed the function which I use to retrieve bytes of Key and IV, using your UnicodeConvertStringToVector(). I had to fix it, because Visual Studio considers characters in "" like a string and '' like a char, so i substituted them. But it shows always the same exception at the same point:

stream2.WriteByte((byte)num5);

in the last while{}.
I'm burning my brains on this from more than 2 weeks. Unfortunately I'm a PHP/C/C++ Guru, and i know C# & RijndaelManaged only a bit.

In the last try i noticed one thing. When debugging, managed.Key and managed.IV don't contain what bytes and rgbIV do. I was thinking that the algorithm doesn't assign correctly the values in the RijndaelManaged object, but if it is true, why can i decrypt all the strings where the key does not need to be padded ?

Thank you so much for your help.
GeneralRe: RijndaelManaged Padding is invalid and cannot be removed Pin
Dave Kreskowiak1-Aug-12 12:19
mveDave Kreskowiak1-Aug-12 12:19 
Questionrecommendation for high quality .NET extension library Pin
Southmountain28-Jul-12 10:23
Southmountain28-Jul-12 10:23 
GeneralRe: recommendation for high quality .NET extension library Pin
Ravi Bhavnani28-Jul-12 10:42
professionalRavi Bhavnani28-Jul-12 10:42 
GeneralRe: recommendation for high quality .NET extension library Pin
Southmountain28-Jul-12 10:48
Southmountain28-Jul-12 10:48 
GeneralRe: recommendation for high quality .NET extension library Pin
Ravi Bhavnani28-Jul-12 10:52
professionalRavi Bhavnani28-Jul-12 10:52 
AnswerRe: recommendation for high quality .NET extension library Pin
Paul Conrad28-Jul-12 11:44
professionalPaul Conrad28-Jul-12 11:44 
GeneralRe: recommendation for high quality .NET extension library Pin
Dave Kreskowiak28-Jul-12 14:13
mveDave Kreskowiak28-Jul-12 14:13 
AnswerRe: recommendation for high quality .NET extension library Pin
Pete O'Hanlon28-Jul-12 20:35
mvePete O'Hanlon28-Jul-12 20:35 
AnswerRe: recommendation for high quality .NET extension library Pin
Florian Rappl28-Jul-12 23:04
professionalFlorian Rappl28-Jul-12 23:04 
GeneralRe: recommendation for high quality .NET extension library Pin
BillWoodruff29-Jul-12 1:38
professionalBillWoodruff29-Jul-12 1:38 
GeneralRe: recommendation for high quality .NET extension library Pin
BillWoodruff29-Jul-12 2:31
professionalBillWoodruff29-Jul-12 2:31 
GeneralRe: recommendation for high quality .NET extension library Pin
Florian Rappl29-Jul-12 3:10
professionalFlorian Rappl29-Jul-12 3:10 
QuestionExecutenonquery: Connection Property Has Not Been Initialized, VS 2008 Pin
Member 931468428-Jul-12 4:46
Member 931468428-Jul-12 4:46 
GeneralRe: Executenonquery: Connection Property Has Not Been Initialized, VS 2008 Pin
Eddy Vluggen28-Jul-12 7:26
professionalEddy Vluggen28-Jul-12 7:26 
RantOpen XML SDK - Word 2007 Uri Issue Pin
Ed Hill _5_27-Jul-12 1:49
Ed Hill _5_27-Jul-12 1:49 
Questionwindow service with taskbar notification Pin
madanbhanu26-Jul-12 22:00
madanbhanu26-Jul-12 22:00 
AnswerRe: window service with taskbar notification Pin
Pete O'Hanlon26-Jul-12 22:15
mvePete O'Hanlon26-Jul-12 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.