0

i will pass the string like "1ijga8ZMQsjlN//74b+D9g==" to the method for decryption than performed but when i will store that string into String variable and than pass the variable to the method than below error encounters:

Invalid length for a Base-64 char array.

Problematic Code:

String hdDec = Dispatch.call(c10, "Decrypt",hd, passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize).toString();
tm1
  • 97
  • 1
  • 3
  • 14
  • 2
    Please show your actual code. – Simon Nickerson Mar 28 '12 at 07:12
  • String hdDec = Dispatch.call(c10, "Decrypt","1ijga8ZMQsjlN//74b+D9g==", passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize).toString(); – tm1 Mar 28 '12 at 07:15
  • when i am use variable like String hd="1ijga8ZMQsjlN//74b+D9g==" and then pass that string variable hd to method String hdDec = Dispatch.call(c10, "Decrypt",hd, passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize).toString(); – tm1 Mar 28 '12 at 07:17
  • 1
    That base64 string is valid in itself. We've no idea what `Dispatch.call` is though, or what the myriad arguments are meant to mean... – Jon Skeet Mar 28 '12 at 07:19
  • Than above error encountered.all other variables like passPhrase,saltValue are initialized.so error is occurred only in string variable. – tm1 Mar 28 '12 at 07:19
  • Dispatch.call is used to call from java to .net dll – tm1 Mar 28 '12 at 07:20

2 Answers2

0

To solve your problem you need to first Encode and then Decode the all ready encode-base64 string, depend from where you using it.

Please look to the following link

Community
  • 1
  • 1
Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392
0

The code you share does not provide enough information to solve this issue, because you only shared the code that calls the method that does all the work. However since the error message is

Invalid length for a Base-64 char array.

the problem may be that you send a string and the method expects a char[], so you could try "1ijga8ZMQsjlN//74b+D9g==".ToCharArray() instead. Otherwise all we can do is guess.

C.Evenhuis
  • 25,996
  • 2
  • 58
  • 72
  • No.method accepts only strings and i have same 2 methods also but they run successfully only problem with this string,i dont no why??actually i am fetch the these string from address bar and stored in String variable and then i am pass that String variable to the webservice.and webservice call above code. – tm1 Mar 28 '12 at 07:43
  • when webservice access these varible than that variable i want to pass in the method but above error occurred. – tm1 Mar 28 '12 at 07:44
  • We don't know why either, but as the string is a valid base64 string, the problem is either one in of the other parameters (passPhrase, saltValue, etc) or in the code - you haven't provided those (don't copy/paste passwords from live websites!). – C.Evenhuis Mar 28 '12 at 08:12
  • i find something.string above mentioned is actually original and when i am accessed that string through address bar than variable that stored that string is missed + sign in that so error is occurred because 1 character + missing. – tm1 Mar 28 '12 at 08:30
  • i accessed that string in my website's address bar that i am actually working. – tm1 Mar 28 '12 at 08:31