Click here to Skip to main content
15,867,756 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
Eddy Vluggen6-Jan-20 1:38
professionalEddy Vluggen6-Jan-20 1:38 
AnswerRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
Afzaal Ahmad Zeeshan6-Jan-20 3:23
professionalAfzaal Ahmad Zeeshan6-Jan-20 3:23 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
engsooncheah6-Jan-20 14:14
engsooncheah6-Jan-20 14:14 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
Afzaal Ahmad Zeeshan6-Jan-20 23:09
professionalAfzaal Ahmad Zeeshan6-Jan-20 23:09 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
engsooncheah7-Jan-20 21:23
engsooncheah7-Jan-20 21:23 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
Afzaal Ahmad Zeeshan7-Jan-20 22:03
professionalAfzaal Ahmad Zeeshan7-Jan-20 22:03 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
engsooncheah9-Jan-20 14:34
engsooncheah9-Jan-20 14:34 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
Afzaal Ahmad Zeeshan9-Jan-20 22:26
professionalAfzaal Ahmad Zeeshan9-Jan-20 22:26 
GeneralRe: ChatBot retrieve data from SharePoint On Premise Issue Pin
engsooncheah21-Jan-20 19:37
engsooncheah21-Jan-20 19:37 
Questionpush notification from android c# Pin
Member 477398728-Dec-19 11:51
Member 477398728-Dec-19 11:51 
AnswerRe: push notification from android c# Pin
OriginalGriff28-Dec-19 19:55
mveOriginalGriff28-Dec-19 19:55 
GeneralRe: push notification from android c# Pin
Member 477398728-Dec-19 20:45
Member 477398728-Dec-19 20:45 
AnswerRe: push notification from android c# Pin
Richard MacCutchan28-Dec-19 21:53
mveRichard MacCutchan28-Dec-19 21:53 

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.