code_junkie

UrlEncoding Plus(+) in URL in ASP.Net

Nov 13th, 2011
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public static String DoDecryption(String Value)
  2. {
  3. Decryptor dec = new Decryptor(EncryptionAlgorithm.TripleDes );
  4. dec.IV = Encoding.ASCII.GetBytes("funky");
  5. byte [] DecValue = Convert.FromBase64String(Value.Replace("+++","=="));
  6. byte [] DecKey = Encoding.ASCII.GetBytes("0123456789012345");
  7. byte [] DecipherValue = dec.Decrypt(DecValue,DecKey);
  8. return Encoding.ASCII.GetString(DecipherValue);
  9. }
  10.  
  11. public static String DoEncryption(String Value)
  12. {
  13. Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes);
  14. byte [] EncValue = Encoding.ASCII.GetBytes(Value);
  15. byte [] EncKey = Encoding.ASCII.GetBytes("0123456789012345");
  16. enc.IV = Encoding.ASCII.GetBytes("funky");
  17. byte [] CipherValue = enc.Encrypt(EncValue,EncKey);
  18. //InitVector = Encoding.ASCII.GetString(enc.IV);
  19. return Convert.ToBase64String(CipherValue).Replace("==","+++");
  20. }
Add Comment
Please, Sign In to add comment