tag:blogger.com,1999:blog-7805972021499203804.post6980954884687224949..comments2023-10-30T06:24:14.411-07:00Comments on ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview: Invalid length for a base-64 char array error during decryption of password using asp.netSuresh Dasarihttp://www.blogger.com/profile/01337689983379917267noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-7805972021499203804.post-74430837989245888192018-05-23T01:11:08.658-07:002018-05-23T01:11:08.658-07:00thanks nandan it's working now..thanks nandan it's working now..Anonymoushttps://www.blogger.com/profile/05527271882129982242noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-22074294859225157602018-05-08T00:21:27.886-07:002018-05-08T00:21:27.886-07:00Please add this code before you convert the string...Please add this code before you convert the string to FromBase64String.<br />int mod4 = cipherText.Length % 4;<br />if (mod4 > 0)<br />{<br />cipherText += new string('=', 4 - mod4);<br />}<br /><br />FromBase64String need string that devide by 4. If string is not devided by 4 then it throw exception.<br /><br />For ex<br /><br />// This string works fine<br />byte[] b1 = Anonymoushttps://www.blogger.com/profile/06115407434653386571noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-15848062962136814822016-09-17T03:31:34.065-07:002016-09-17T03:31:34.065-07:00For vb.net try the following line you will get sol...For vb.net try the following line you will get solution for "string cannot be of zeo length."<br />Dim todecode_byte As Byte() = Convert.FromBase64String(encryptpwd.Replace(" "C, "+"C))Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-60332350817590803992016-05-25T23:57:49.779-07:002016-05-25T23:57:49.779-07:00Invalid length for a base-64 char array error duri...Invalid length for a base-64 char array error during decryption:<br /><br />In my case i changed the encrypt Password column size in database and it works .<br /><br />using this command.<br />byte[] todecode_byte = Convert.FromBase64String(encryptpwd);Anonymoushttps://www.blogger.com/profile/12035155486552507795noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-74687737154739192842016-03-14T02:14:43.447-07:002016-03-14T02:14:43.447-07:00use single Quote with space like Convert.FromBase6...use single Quote with space like Convert.FromBase64String(encryptpwd.Replace(' ','+'));<br />T@M!Lhttps://www.blogger.com/profile/01852349940861903909noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-69576937616477877392016-03-08T21:10:00.328-08:002016-03-08T21:10:00.328-08:00Try using
byte[] todecode_byte = Convert.FromBase...Try using <br />byte[] todecode_byte = Convert.FromBase64String(encryptpwd.Replace(" ","+"));<br /><br /><br />Manojhttps://www.blogger.com/profile/16407923340423391160noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-72363930120207983912016-01-14T12:52:41.728-08:002016-01-14T12:52:41.728-08:00So, it's basically unusable until the author h...So, it's basically unusable until the author helps.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-51563515671310759252014-10-01T02:40:37.579-07:002014-10-01T02:40:37.579-07:00You need to try following:-
Base64 encoding encod...You need to try following:-<br /><br />Base64 encoding encodes 6 bits per character. So the length of the string, multiplied by 6, must be divisible by 8. If it is not then it doesn't have enough bits to fill every byte and you'll get this exception.<br /><br />So good odds that encodedMsg just isn't a properly encoded base64 string. You can append some = characters to bypass the Sachin Sharmanoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-42234809332975984082014-05-27T05:20:39.396-07:002014-05-27T05:20:39.396-07:00Invalid length for a Base-64 char arrayInvalid length for a Base-64 char arrayEssayProgramminghttp://essayprograming.blogspot.com/2014/05/invalid-length-for-base-64-char-array.htmlnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-3226463251475750622014-04-23T06:58:28.461-07:002014-04-23T06:58:28.461-07:00please give space between (" ","+&q...please give space between (" ","+")<br /><br />it will workAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-1975934541225306172014-04-09T09:03:20.743-07:002014-04-09T09:03:20.743-07:001) Encrypt :: string cipherText = CryptorEngine.En...1) Encrypt :: string cipherText = CryptorEngine.Encrypt(FileName.First().ToString(),true);<br /> string FInalFileName= cipherText.Replace("/", "+++");<br /><br />some string to Encrypt prolblem face :: output directory is invalid .so its problem is Encrlypt key mainly special character "/" is not to allow any file rename.so first of change Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-64060232055951115592014-02-18T22:49:39.780-08:002014-02-18T22:49:39.780-08:00It works perfectly fine for me even without the Re...It works perfectly fine for me even without the Replace(",","+") in the code.<br />Try to use Encryptdata instead of Decryptdata in your code.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-13379915415801842672014-01-29T22:32:53.841-08:002014-01-29T22:32:53.841-08:00not yet find any answer for this.not yet find any answer for this.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-23139851467659056052014-01-28T01:35:55.595-08:002014-01-28T01:35:55.595-08:00if getting below type of Error: Put this
byte[] t...if getting below type of Error: Put this<br /> byte[] todecode_byte = Convert.FromBase64String(encryptpwd);<br /><br />protected void gvdecryption_RowDataBound(object sender, GridViewRowEventArgs e)<br /> {<br /> if (e.Row.RowType == DataControlRowType.DataRow)<br /> {<br /> string decryptpassword = e.Row.Cells[2].Text;<br /> e.Row.Cells[2].Text = Panchdevhttps://www.blogger.com/profile/09647827405658797613noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-53892075970393347612013-12-28T05:10:16.100-08:002013-12-28T05:10:16.100-08:00Sir,
I am also getting the same error.Kindly ...Sir,<br /> I am also getting the same error.Kindly give clarify on this error. Thanks in advanceAnonymoushttps://www.blogger.com/profile/17364257354374414054noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-73475260552643448902013-12-27T02:43:04.730-08:002013-12-27T02:43:04.730-08:00Copy following code,this code will work for you . ...Copy following code,this code will work for you . <br />byte[] todecode_byte = Convert.FromBase64String(encryptpwd.Replace(" ", "+"));Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-48452610993189180852013-12-02T23:41:19.069-08:002013-12-02T23:41:19.069-08:00byte[] todecode_byte = Convert.FromBase64String(en...byte[] todecode_byte = Convert.FromBase64String(encryptpwd.Replace("","+"));<br />string cannot be of zeo length<br />parameter name:old oneAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-89183706305477905082013-11-22T23:46:19.425-08:002013-11-22T23:46:19.425-08:00Hello Sir
i have tryied with single and double qo...Hello Sir<br /><br />i have tryied with single and double qoatation (encryptpwd.Replace("","+") and (encryptpwd.Replace(' ','+'))). But couldn't find any solution.<br /><br />could anyone give any solution?<br /><br />Please send me an email here naiemahmad29@gmail.com<br /><br />Thank you.Anonymoushttps://www.blogger.com/profile/01671887614822527750noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-49486575818230591432013-11-07T00:28:30.096-08:002013-11-07T00:28:30.096-08:00My name is Basudev
I am getting the error in this ...My name is Basudev<br />I am getting the error in this code<br />byte[] todecode_byte = Convert.FromBase64String(encryptpwd.Replace("","+")); as<br />Invalid length for a Base-64 char array<br />why this error happen Please help me SirAnonymoushttps://www.blogger.com/profile/15431452868331365891noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-23217563377915198302013-10-25T00:43:45.155-07:002013-10-25T00:43:45.155-07:00still its not working i have changed double quote ...still its not working i have changed double quote to single quote it shows error "Empty Character Literal"<br /><br />please...helpAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-79732503745557854592013-08-14T03:56:40.953-07:002013-08-14T03:56:40.953-07:00Invalid length for a base-64 char array
has been s...Invalid length for a base-64 char array<br />has been solved but a new error has arise<br />String cannot be of zero length.<br />Parameter name: oldValue<br />please provide solutionRamawatar sharmahttps://www.blogger.com/profile/03418364356585439494noreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-3442019841651581712013-07-02T04:42:24.978-07:002013-07-02T04:42:24.978-07:00Hello, This is Abu here.
i have tryied with singl...Hello, This is Abu here.<br /><br />i have tryied with single and double qoatation (encryptpwd.Replace("","+") and (encryptpwd.Replace(' ','+'))). But couldn't find any solution.<br /><br />could anyone give any solution?<br /><br />If its possible, Please send me an email here rossyhaider@yahoo.com<br />Or,<br />Post here.<br /><br />Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-4137823261321030442013-06-11T06:45:13.269-07:002013-06-11T06:45:13.269-07:00suresh garu, pls clarify this
I used this Replace ...suresh garu, pls clarify this<br />I used this Replace method but another error is being generated "String cannot be of zero length", please provide the solution for the same.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-26172947036962034042013-04-15T03:22:44.524-07:002013-04-15T03:22:44.524-07:00This comment has been removed by a blog administrator.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7805972021499203804.post-90786403865705786072013-04-15T03:21:57.116-07:002013-04-15T03:21:57.116-07:00This comment has been removed by a blog administrator.Anonymousnoreply@blogger.com