Пример #1
0
 public void OnGet()
 {
     Number = Utils.Number(15);
     RsaKey = RSACrypt.GetKey();
     //获得公钥和私钥
     MemoryCacheService.Default.SetCache("LOGINKEY_" + Number, RsaKey, 5);
 }
Пример #2
0
        public void OnGet()
        {
            RsaKey = RSACrypt.GetKey();
            var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            //auth.Result.Succeeded;
            if (auth.Status.ToString() != "Faulted")
            {
                RedirectToPage("Index");
            }
        }
Пример #3
0
        public ApiResult LoadLoginInfo()
        {
            var rsaKey = RSACrypt.GetKey();
            var number = Guid.NewGuid().ToString();

            if (rsaKey.Count <= 0 || rsaKey == null)
            {
                throw new ArgumentNullException("获取登录的公钥和私钥为空");
            }
            //获得公钥和私钥
            _cache.Set("LOGINKEY" + number, rsaKey);
            return(new ApiResult(data: new { RsaKey = rsaKey, Number = number }));
        }
Пример #4
0
        public void OnGet()
        {
            var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            //auth.Result.Succeeded;
            if (auth.Status.ToString() != "Faulted")
            {
                RedirectToPage("Index");
            }
            RsaKey = RSACrypt.GetKey();
            //获得公钥和私钥
            MemoryCacheService.Default.SetCache("LOGINKEY", RsaKey);
        }
Пример #5
0
        public ActionResult Login()
        {
            var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            //auth.Result.Succeeded;
            if (auth.Status.ToString() != "Faulted")
            {
                RedirectToPage("Index");
            }
            List <string> RsaKey = RSACrypt.GetKey();

            return(View(RsaKey));
        }
Пример #6
0
        private void LoadKey()
        {
            var rsaKey = RSACrypt.GetKey();
            var number = Guid.NewGuid().ToString();

            if (rsaKey.Count <= 0 || rsaKey == null)
            {
                throw new ArgumentNullException("»ñÈ¡µÇ¼µÄ¹«Ô¿ºÍ˽ԿΪ¿Õ");
            }
            RsaKey = rsaKey;
            Number = number;
            //»ñµÃ¹«Ô¿ºÍ˽Կ
            _cache.Set(LoginKey + number, rsaKey);
        }
Пример #7
0
        public async Task OnGetAsync()
        {
            var auth = HttpContext.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);

            if (auth.Status.ToString() != "Faulted")
            {
                RedirectToPage("Index");
            }

            RsaKey = RSACrypt.GetKey();
            lid    = Guid.NewGuid();

            //获得公钥和私钥
            await _cache.SetAsync($"LOGINKEY:{lid}", RsaKey, expirationMinute : 30);
        }