如何为S3存储在颤振达特验证码(How to generate Authentication cod

2019-11-08 13:14发布

如何转换生成验证.NET代码TO DART? 我需要生成一个认证密钥。 怎么做? 由于需要对S3斗。

检查我的javascript代码也 如何从S3斗颤振中得到的图像?

 public JsonResult GetAuthenticationKey() {
            string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string key = ";ross@si";
            string code = AccountController.Encrypt(date, key);
            return Json(code, JsonRequestBehavior.AllowGet);
        }

        public static string Encrypt(string toEncrypt, string key)
        {
            byte[] keyArray;
            byte[] keyArray2; 
            byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);

            keyArray = UTF8Encoding.UTF8.GetBytes(key);
            keyArray2 = System.Convert.FromBase64String("pdFdo="); 

            var tdes = new TripleDESCryptoServiceProvider();
            tdes.Key = keyArray;
            tdes.IV = keyArray2;

            ICryptoTransform cTransform = tdes.CreateEncryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0,toEncryptArray.Length);
            return Convert.ToBase64String(resultArray, 0, resultArray.Length);
        }
文章来源: How to generate Authentication code for S3 Bucket in Dart Flutter