Click here to Skip to main content
15,908,909 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to configure LED8 customer pole display? Pin
Dave Kreskowiak10-Jan-20 4:19
mveDave Kreskowiak10-Jan-20 4:19 
AnswerRe: how to configure LED8 customer pole display? Pin
User 1106097910-Jan-20 8:11
User 1106097910-Jan-20 8:11 
QuestionHow can I accomplish this little project of mine. Pin
Mmm-Geralt9-Jan-20 7:37
Mmm-Geralt9-Jan-20 7:37 
AnswerRe: How can I accomplish this little project of mine. Pin
OriginalGriff9-Jan-20 8:06
mveOriginalGriff9-Jan-20 8:06 
GeneralRe: How can I accomplish this little project of mine. Pin
ZurdoDev9-Jan-20 8:51
professionalZurdoDev9-Jan-20 8:51 
GeneralRe: How can I accomplish this little project of mine. Pin
OriginalGriff9-Jan-20 9:33
mveOriginalGriff9-Jan-20 9:33 
AnswerRe: How can I accomplish this little project of mine. Pin
Dave Kreskowiak9-Jan-20 10:19
mveDave Kreskowiak9-Jan-20 10:19 
GeneralRe: How can I accomplish this little project of mine. Pin
OriginalGriff9-Jan-20 10:31
mveOriginalGriff9-Jan-20 10:31 
GeneralRe: How can I accomplish this little project of mine. Pin
Mmm-Geralt20-Jan-20 13:47
Mmm-Geralt20-Jan-20 13:47 
Questionhow to open an application using button in C# Pin
Hernany Bondoc9-Jan-20 5:14
Hernany Bondoc9-Jan-20 5:14 
AnswerRe: how to open an application using button in C# Pin
Richard Deeming9-Jan-20 5:36
mveRichard Deeming9-Jan-20 5:36 
QuestionHow to generate pdf files on C#?? Pin
hgsingla8-Jan-20 5:57
hgsingla8-Jan-20 5:57 
AnswerRe: How to generate pdf files on C#?? Pin
Richard MacCutchan8-Jan-20 6:40
mveRichard MacCutchan8-Jan-20 6:40 
GeneralRe: How to generate pdf files on C#?? Pin
OriginalGriff8-Jan-20 11:22
mveOriginalGriff8-Jan-20 11:22 
QuestionHistory of compiler optimization: function inlining Pin
Bernhard Hiller7-Jan-20 22:35
Bernhard Hiller7-Jan-20 22:35 
AnswerRe: History of compiler optimization: function inlining Pin
F-ES Sitecore7-Jan-20 22:44
professionalF-ES Sitecore7-Jan-20 22:44 
AnswerRe: History of compiler optimization: function inlining Pin
OriginalGriff7-Jan-20 22:51
mveOriginalGriff7-Jan-20 22:51 
AnswerRe: History of compiler optimization: function inlining Pin
Peter_in_27808-Jan-20 1:20
professionalPeter_in_27808-Jan-20 1:20 
AnswerRe: History of compiler optimization: function inlining Pin
Gerry Schmitz8-Jan-20 6:08
mveGerry Schmitz8-Jan-20 6:08 
AnswerRe: History of compiler optimization: function inlining Pin
kalberts23-Jan-20 0:52
kalberts23-Jan-20 0:52 
QuestionAES Decryption error "The input data is not a complete block" Pin
Member 132610847-Jan-20 0:14
Member 132610847-Jan-20 0:14 
Hi I have the following code:
C#
public static string Decrypt(string encrypted)
       {
           byte[] encryptedbytes = Convert.FromBase64String(encrypted);
           AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
           aes.BlockSize = 128;
           aes.KeySize = 256;
           aes.Key = System.Text.ASCIIEncoding.ASCII.GetBytes(Key);
           aes.IV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV);
           aes.Padding = PaddingMode.PKCS7;
           aes.Mode = CipherMode.CBC;
           ICryptoTransform crypto = aes.CreateDecryptor(aes.Key, aes.IV);
           byte[] secret = crypto.TransformFinalBlock(encryptedbytes, 0, encryptedbytes.Length);

           crypto.Dispose();
           return System.Text.ASCIIEncoding.ASCII.GetString(secret);
       }


When it decrypts the first string decrypts fine but the second string gives the error "The input data is not a complete block" if the second string is in quick procession. Example decrypting a column on a datagridview, Searching online the error brings up forums where people say that padding is needed or that Dispose closes to early. However as you can see padding is set to PKCS7 and the call for dispose is as late as it can be. So I really don't understand why it is giving the error.

Thanks in advance for any help

modified 7-Jan-20 6:34am.

AnswerRe: AES Decryption error "The input data is not a complete block" Pin
OriginalGriff7-Jan-20 0:36
mveOriginalGriff7-Jan-20 0:36 
GeneralRe: AES Decryption error "The input data is not a complete block" Pin
Member 132610847-Jan-20 1:38
Member 132610847-Jan-20 1:38 
GeneralRe: AES Decryption error "The input data is not a complete block" Pin
OriginalGriff7-Jan-20 1:52
mveOriginalGriff7-Jan-20 1:52 
QuestionChatBot retrieve data from SharePoint On Premise Issue Pin
engsooncheah5-Jan-20 14:43
engsooncheah5-Jan-20 14:43 

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.