/// <summary> /// Decrypts the cipherbytes. Implements <see cref="IAESService.Decrypt(byte[])"/>. /// </summary> /// <param name="cipherbytes">The cipherbytes to be decrypted.</param> /// <returns>The JSON object.</returns> public JObject Decrypt(byte[] cipherbytes) { helperAES = new AESHelper(); algorithm = new Grasshopper(); byte[] plainbytes = new byte[cipherbytes.Length]; using (MemoryStream stream = new MemoryStream(cipherbytes)) { byte[] block = new byte[16]; int count = 0; while (stream.Read(block, 0, blockLength) > 0) { Array.Copy(algorithm.Decrypt(block, Keys.GrasshopperKey), 0, plainbytes, count, blockLength); count += blockLength; } return(helperAES.ParseToJson(plainbytes)); } }