public void MultipleEncrypt() { var aes_cbc_1 = AESUtils.Create(); var aes_cfb_1 = AESUtils.Create(mode: CipherMode.CFB); var aes_cbc_2 = AESUtils.Create(); var value = DateTime.Now.ToString() + " 🔮🎮"; var bytes_1 = AESUtils.EncryptToByteArray(aes_cbc_1, value); var bytes_2 = AESUtils.Encrypt(aes_cfb_1, bytes_1); var bytes_3 = AESUtils.Encrypt(aes_cbc_2, bytes_2); var bytes_4 = bytes_3; var d_bytes_4 = bytes_4; #pragma warning disable CA1416 // 验证平台兼容性 #if !ANDROID && !__ANDROID__ && !__MOBILE__ if (DI.Platform == Platform.Windows) { bytes_4 = ProtectedData.Protect(bytes_3, null, DataProtectionScope.LocalMachine); d_bytes_4 = ProtectedData.Unprotect(bytes_4, null, DataProtectionScope.LocalMachine); } #endif #pragma warning restore CA1416 // 验证平台兼容性 var d_bytes_3 = AESUtils.Decrypt(aes_cbc_2, d_bytes_4); var d_bytes_2 = AESUtils.Decrypt(aes_cfb_1, d_bytes_3); var d_value = AESUtils.DecryptToString(aes_cbc_1, d_bytes_2); TestContext.WriteLine(d_value); }
static byte[] E___(Aes[] aes, byte[] value) { if (value.Length == 0) { return(value); } var len = aes.Length - 1; var data_e = AESUtils.Encrypt(aes[len], value); var data_r = BitConverter.GetBytes(len).Concat(data_e).ToArray(); return(data_r); }
byte[] E___(Aes aes, byte[] value) { var r = AESUtils.Encrypt(aes, value); return(r); }