Encryption in C# and Decryption in Android(java) -


i trying encrypt data in c# using code

 public static string encrypt(string cleartext)     {         string encryptionkey = "abc123";         byte[] clearbytes = encoding.unicode.getbytes(cleartext);         using (aes encryptor = aes.create())         {             rfc2898derivebytes pdb = new rfc2898derivebytes(encryptionkey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });             encryptor.key = pdb.getbytes(32);             encryptor.iv = pdb.getbytes(16);             using (memorystream ms = new memorystream())             {                 using (cryptostream cs = new cryptostream(ms, encryptor.createencryptor(), cryptostreammode.write))                 {                     cs.write(clearbytes, 0, clearbytes.length);                     cs.close();                 }                 cleartext = convert.tobase64string(ms.toarray());             }         }         return cleartext;     } 

i want decrypt encrypted string in android programming same key used in c#., tried searching not found solution.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -