asp.net - Encryption and decryption without special character -


I want to encrypt the mail id. Encrypted mail id should not contain special characters. I send mail from the console app In the console app, I change the mail ID to encode and attach it to the link which will display my click numbers. I have passed the mail id in the web app. So if the encrypted mail id contains a special character that is disturbing my link.

I am using the following:

  string EncryptedEmailId; String encryption = "MAKV2SPBNI 99212"; Byte [] EmailIdEncrypt = encoding.unicode.getbites (invoices); (AES encryptor = AES.crait ()) {RFC 2898 derivatives pdbencript = new RFC 2898 Dribbles (encryption, new byte [] {0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76}); Encryptor.key = pdb encrypt.getbits (32); Encryptor.vi = pdb encrypt.getbits (16); (Memorystream MS encrypt = new memorystream ()) {(cryptostream CSNcript = new cryptostream (using MS encrypt, encryptor .crypt encryption), cryptostem mod.) {CsEncrypt.Write (EmailIdEncrypt, 0, EmailIdEncrypt.Length); CsEncrypt.Close (); } Encrypted Email ID = Convert ToBase64String (msEncrypt.ToArray ()); }} IndividualContent = individualContent.Replace ("[MailId]", encrypted email ID); I got the answer with the sign given by Nipun.    

a) Convert string to hex

  Public Static String ConvertSthrarthTauhex (String Input, SystemText.excoding Encoding) {Byte [] StringBeets = Encoding.Getbyte (Input); Stringbirders sbBytes = new stringbilders (stringbowets.length 2); Foreign (in Byte B stringbits) {sbBytes.AppendFormat ("{0: X2}", b); } Return sbBytes.ToString (); }   

b) Convert string to hex

  public static string convertext hectust string (string hex input, systemtext. Encoding encoding) {int number charge = hexpress.pdf ; Byte [] bytes = new byte [number charged / 2]; (Bytes [i / 2] = convert to tome (i.i. I = 2; ii = 0; ii; lieu; i + 2] = to convert (heximput. Substrings (i, 2), 16);} return encoding. Bytes);}   

Sample Usage Code

  string testString = "MIKA @?" Amp; ^ "; string hex = convertstringhothex (teststring, systemtext .encoding.unicode); String Normal = Convert Hexostring (hex, systemtext.Nencoding.u Nicode); Debug Asset (teststring.CompareTo (normal) == 0, "they are not the same");   

Take a look at this:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -