java - Decryption of a String in VB.NET which was encrypted in Android Studio -


i'm trying find solution decrypting string in vb.net encrypted in android studio. encoded string base64. want paste encrypted string in vb.net program decrypt it says length of string short.

i started vb.net because boss told me so!

any more appreciated! :)

here's code of android studio , vb.net.

android studio encrypt:

 public static string encryptit(string value) {     try {         deskeyspec keyspec = new deskeyspec(cryptopass.getbytes("utf8"));         secretkeyfactory keyfactory = secretkeyfactory.getinstance("des");         secretkey key = keyfactory.generatesecret(keyspec);          byte[] cleartext = value.getbytes("utf8");         // cipher not thread safe         cipher cipher = cipher.getinstance("des");         cipher.init(cipher.encrypt_mode, key);          string encrypedvalue = base64.encodetostring(cipher.dofinal(cleartext), base64.default);         return encrypedvalue;      } catch (invalidkeyexception e) {         e.printstacktrace();     } catch (unsupportedencodingexception e) {         e.printstacktrace();     } catch (invalidkeyspecexception e) {         e.printstacktrace();     } catch (nosuchalgorithmexception e) {         e.printstacktrace();     } catch (badpaddingexception e) {         e.printstacktrace();     } catch (nosuchpaddingexception e) {         e.printstacktrace();     } catch (illegalblocksizeexception e) {         e.printstacktrace();     } catch (exception e) {         e.printstacktrace();     }     return "false"; } 

vb.net decrypt:

 private sub button2_click(sender system.object, e system.eventargs) handles button2.click     dim rd new rijndaelmanaged     dim rijndaelivlength integer = 16     dim md5 new md5cryptoserviceprovider     dim key() byte = md5.computehash(encoding.utf8.getbytes(textbox2.text))      md5.clear()      dim encdata() byte = convert.frombase64string(textbox3.text)     dim ms new memorystream(encdata)     dim iv(15) byte      ms.read(iv, 0, rijndaelivlength)     rd.iv = iv     rd.key = key      dim cs new cryptostream(ms, rd.createdecryptor, cryptostreammode.read)      dim data(ms.length - rijndaelivlength) byte     dim integer = cs.read(data, 0, data.length)      textbox1.text = system.text.encoding.utf8.getstring(data, 0, i)     cs.close()     rd.clear() end sub 

i hope wanted ask!

thanks in advance!


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -