Beispiel #1
0
        public string ChangeUserPassword(string _userid, string _opwd, string _npwd, string _apnm)
        {
            AuthorizationBll bll    = new AuthorizationBll();
            Hashtable        result = bll.ChangeUserPassword(_userid, UtilSecurity.EncryptPassword(_opwd), UtilSecurity.EncryptPassword(_npwd), _apnm);

            return(result["Message"].ToString());
        }
Beispiel #2
0
        public string UserValidation(string _userid, string _passwd, string _apnm)
        {
            AuthorizationBll bll    = new AuthorizationBll();
            Hashtable        result = bll.GetUserValidation(_userid, UtilSecurity.EncryptPassword(_passwd), _apnm);

            return(result["Message"].ToString());
        }
Beispiel #3
0
        public async Task <int> CadastrarUsuario(Usuario usuario)
        {
            usuario.Senha = UtilSecurity.ConvertMD5(usuario.Senha);
            _context.Add(usuario);
            int status = await _context.SaveChangesAsync();

            return(status);
        }
        public YueGeDencrypt2()
        {
            Dictionary <string, string> cache = null; // GetCache(Md5Key);

            Console.WriteLine("-----------------------------");
            Console.WriteLine("");

            string root = SystemConsole.GetInputStr("输入目标目录:");

            if (Directory.Exists(root))
            {
                var folder = Path.GetFileName(root);
                root += root.EndsWith("\\") ? "" : "\\";
                var files =
                    Directory.GetFiles(root, "*.*", SearchOption.AllDirectories)
                    .Select(p => p.Replace(root, "").Replace("\\", "/"))
                    .Where(p => Path.GetFileNameWithoutExtension(p).Length == 32)
                    .ToList();

                files.ForEach(file =>
                {
                    File.WriteAllBytes(file + ".temp", UtilSecurity.DecryptionBytes(File.ReadAllBytes(root + file)));
                });

                return;

                var dirRoot = root.Replace(folder, "");
                files.ForEach((file, i, count) =>
                {
                    var path    = folder + "/" + file;
                    var newPath = "";
                    if (cache.TryGetValue(path, out newPath))
                    {
                        var outPath = dirRoot + newPath;
                        FileHelper.CreateDirectory(outPath);
                        var p = ((float)i / count).ToString("P") + "\t" + path;
                        if (extensionList.Contains(Path.GetExtension(path)))
                        {
                            Console.WriteLine("路径解码中..." + p);
                            File.Copy(root + file, outPath, true);
                        }
                        else
                        {
                            Console.WriteLine("路径解码并文件解密中..." + p);
                            File.WriteAllBytes(outPath, UtilSecurity.DecryptionBytes(File.ReadAllBytes(root + file)));
                        }
                    }
                    else
                    {
                        Console.WriteLine("不存在的资源文件!");
                    }
                });
            }
        }
Beispiel #5
0
        public static void MakeDecryptor(string path)
        {
            var bytes = File.ReadAllBytes(path);

            try
            {
                bytes = UtilSecurity.EncryptionBytes(bytes, UtilSecurity.MakeEncryptorTransform(Path.GetFileName(path)));
                FileHelper.CreateDirectory(path);
                File.WriteAllBytes(path, bytes);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #6
0
        public YueGeEncrypt()
        {
            var md5Key = "kEfGhnNmeu4YYuhv";

            var root = SystemConsole.GetInputStr("输入目录:");

            if (Directory.Exists(root))
            {
                var folder = Path.GetFileName(root);
                var files  =
                    Directory.GetFiles(root, "*.*", SearchOption.AllDirectories)
                    .Select(p => p.Replace(root, "").Replace("\\", "/"))
                    .ToList();

                var dirRoot = root.Replace(folder, "");
                files.ForEach((file, i, count) =>
                {
                    var path     = folder + file;
                    var dirName  = Path.GetDirectoryName(path).Replace("\\", "/");
                    var fileName = Path.GetFileName(path);
                    var newPath  = dirName.MD5(md5Key) + "/" + fileName.MD5(md5Key);

                    var outPath = dirRoot + "md5/" + newPath;
                    var p       = ((float)i / count).ToString("P") + "\t" + path;
                    FileHelper.CreateDirectory(outPath);
                    if (extensionList.Contains(Path.GetExtension(path)))
                    {
                        Console.WriteLine("路径编码中..." + p);
                        File.Copy(root + file, outPath, true);
                    }
                    else
                    {
                        Console.WriteLine("路径编码并文件加密中..." + p);
                        File.WriteAllBytes(outPath, UtilSecurity.EncryptionBytes(File.ReadAllBytes(root + file)));
                    }
                });
            }
        }