java - URL special character Code conversion with blowfish encryption? -


i working on problem client sending email thru url in encrypted format. have use blowfish encryption @ client end , decryption @ out end.

blowfish code below---

//encrypted   jaottv22bfktkvrhtn/rhq==    public string encrypt(string username,string code) throws exception {      try {     byte[] keydata = (username).getbytes();     secretkeyspec secretkeyspec = new secretkeyspec(keydata, "blowfish");     cipher cipher = cipher.getinstance("blowfish");     cipher.init(cipher.encrypt_mode, secretkeyspec);     byte[] hasil1 = cipher.dofinal(username.getbytes()); byte[] hasil2 = cipher.dofinal(code.getbytes()); return new base64encoder().encode(hasil1);     } catch (exception e) { system.out.println(e);     return null; } }  //decrypt  --doug@gmail.com public string decrypt(string email,string code) throws exception {     try {     byte[] keydata = (code).getbytes();     secretkeyspec secretkeyspec = new secretkeyspec(keydata, "blowfish");     cipher cipher = cipher.getinstance("blowfish");     cipher.init(cipher.decrypt_mode, secretkeyspec);     byte[] hasil = cipher.dofinal(new base64decoder().decodebuffer(email));     return new string(hasil);     } catch (exception e) {  system.out.println("exaception ="+e);     return null; } } 

we need decrypt , mask before showing on web page. problem special character coding coming url. how handle decrypting @ our side??? example getting -

  http://localhost/demo/controller?email=jaottv22bfktkvrhtn/rhq%3d%3d  blowfish encryption - jaottv22bfktkvrhtn/rhq== 

works fine no special character code involved

e.g - wk6dtqkguftd0%2bepxqlb9borwufm39ed 

character code in url ---

 http://perishablepress.com/url-character-codes/ 

thanks suggestion or in advance.

if understand right, have problems url specific character masking "=".

if so, can use

java.net.urldecoder.decode(text, encoding) 

to decode base64 string.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -