private void simpleButton1_Click(object sender, EventArgs e) { ISecurity md5 = new MD5Security(); ISecurity sec = FT.Commons.Security.SecurityFactory.GetSecurity(); if (this.txtCompany.Text.Trim().Length == 0) { MessageBoxHelper.Show("必须输入授权用户!"); return; } if (this.txtKeyCode.Text.Trim().Length > 0) { if (this.txtKeyCode.Text.Trim() != md5.Encrypt(sec.Encrypt(this.txtMachineCode.Text + this.txtCompany.Text.Trim() + this.txtMachineCode.Text))) { this.txtKeyCode.Focus(); MessageBoxHelper.Show("注册码错误,请重新输入!"); return; } } else { MessageBoxHelper.Show("没有注册码,将使用试用版!"); this.DialogResult = DialogResult.OK; } ProgramRegConfig config = StaticCacheManager.GetConfig <ProgramRegConfig>(); config.RegDate = System.DateTime.Now; loader.SaveConfig(); MessageBoxHelper.Show("保存成功!"); this.DialogResult = DialogResult.OK; }
public async Task <ServiceResult <string> > updatepassword([FromForm] string password) { var result = new ServiceResult <string>() { Result = string.Empty }; var mobile = base.UserMobile; bool bl = await this.iuser.UpdatePassWordAsync(mobile, MD5Security.Encrypt(password)); if (!bl) { result.IsFailed("保存失败"); return(result); } return(result); }
async void RegisterButton_Clicked(object sender, EventArgs e) { Loading(true); var item = (CustomerDTO)this.BindingContext; if (item.Id > 0) { await StoreWebApiClient.Instance.PutItem <CustomerDTO>("Customers", item, item.Id); } else { item.Password = MD5Security.ToMD5Hash("abc"); await StoreWebApiClient.Instance.PostItem <CustomerDTO>("Customers", item); } Loading(false); await DisplayAlert("Success", "Item registered!", "OK"); await Navigation.PopAsync(); }
public UserLoginDtoValidator(IUser user) { this.user = user; CascadeMode = CascadeMode.Stop; RuleFor(user => user.mobile) .NotNull().WithMessage("{PropertyName}没有传递或者空") .NotEmpty().WithMessage("{PropertyName}为空") .MinimumLength(6).WithMessage("{PropertyName}最小长度6位") // 判断手机号码是否存在 .Must((item, mobile) => { //返回true 就是验证成功 return(this.user.IsExistUser(mobile)); }).WithMessage(item => string.Format("{0}{1}不存在", "{PropertyName}", item.mobile)) .WithName("手机号码"); RuleFor(user => user.password) .NotNull().WithMessage("{PropertyName}没有传递或者空") .NotEmpty().WithMessage("{PropertyName}为空") .Must((item, password) => { users usermodel = this.user.GetUser(item.mobile); if (usermodel != null && !string.IsNullOrWhiteSpace(usermodel.password) && usermodel.password.Equals(MD5Security.Encrypt(password))) { return(true); } return(false); }).When(item => !string.IsNullOrWhiteSpace(item.mobile)).WithMessage("密码错误") .WithName("密码"); }
private static void GetProgramState() { //log4net.LogManager.ResetConfiguration(); log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("log.xml")); ProgramRegConfig config = StaticCacheManager.GetConfig <ProgramRegConfig>(); if (config.KeyCode != null && config.KeyCode.Length > 0) { ISecurity md5 = new MD5Security(); ISecurity sec = FT.Commons.Security.SecurityFactory.GetSecurity(); string[] macs = FT.Commons.Tools.HardwareManager.GetMacArray(); string hardwarecode = string.Empty; for (int i = 0; i < macs.Length; i++) { hardwarecode = md5.Encrypt(macs[i]); if (config.KeyCode == md5.Encrypt(sec.Encrypt(hardwarecode + config.Company + hardwarecode))) { productState = ProgramState.Registed; break; } else if (i == macs.Length - 1) { productState = ProgramState.None; } } } else if (config.RightCode.Length != 0) { productState = ProgramState.Trial; } else { productState = ProgramState.None; } }
static void Main(string[] args) { for (int i = 0; i < 10; i++) { Console.WriteLine("随机产生6位随机码:" + HiPiaoInterface.RandomSmsHelper.GenerateNumberCode(6)); } //HiPiaoInterface.HipiaoTcpHelper.GetTicket(); HiPiaoCache.GetDingXinTicket(); // DingXinResponseObject.Parse(""); Console.ReadLine(); /* * 拼装字符串=MEMBERID26c52c2e-69ae-102e-8c3d-001a4beef7e4fromclientHPMACHINEmobile13911139181normal2planIdb8695e80-065b-11e2-a9dc-001bb97ef1a4seatids4b45e880-f01f-11e0-98ca-001bb97ef1a4,4b711730-f01f-11e0-98ca-001bb97ef1a4 * 密码+卡号加密=f56174a3de82dd6016bd5dff2d770682 * 最终加密md5(r2+r1)=53d1205f9fddc1a3a1fc21f3880a4c84 */ string rr1 = "f56174a3de82dd6016bd5dff2d770682"; string rr2 = "MEMBERID26c52c2e-69ae-102e-8c3d-001a4beef7e4fromclientHPMACHINEmobile13911139181normal2planIdb8695e80-065b-11e2-a9dc-001bb97ef1a4seatids4b45e880-f01f-11e0-98ca-001bb97ef1a4,4b711730-f01f-11e0-98ca-001bb97ef1a4"; // string rr2 = "MEMBERID26c52c2e-69ae-102e-8c3d-001a4beef7e4fromclientHPMACHINEmobile13911139181normal2planidb8695e80-065b-11e2-a9dc-001bb97ef1a4seatids4b45e880-f01f-11e0-98ca-001bb97ef1a4,4b711730-f01f-11e0-98ca-001bb97ef1a4"; //MEMBERID26c52c2e-69ae-102e-8c3d-001a4beef7e4fromclientHPMACHINEmobile13911139181normal2planIdb8695e80-065b-11e2-a9dc-001bb97ef1a4seatids4b45e880-f01f-11e0-98ca-001bb97ef1a4,4b711730-f01f-11e0-98ca-001bb97ef1a4 Console.WriteLine("最终加密结果rr1+rr2为:" + Encrypt(rr2 + rr1)); ISecurity md5 = new MD5Security(); //1b8dc01720fc2b67ad19a3c526c7bca2 Console.WriteLine("最终加密结果为:" + Encrypt("789001")); string menberid = "26c52c2e-69ae-102e-8c3d-001a4beef7e4"; string mobile = "18618237773"; string count = "4"; string planid = "c81f8af0-fb63-11e1-a9dc-001bb97ef1a4@@6"; string seatv = "9be8e070-8acb-11e1-b245-001bb97ef1a4,9be81d20-8acb-11e1-b245-001bb97ef1a4,9be86b40-8acb-11e1-b245-001bb97ef1a4,9be9cad0-8acb-11e1-b245-001bb97ef1a4"; string fromclient = "ANDROID"; string pwd = "789001"; string hipiaocard = "26c52c2e69"; String r1 = "MEMBERID" + menberid + "fromclient" + fromclient + "mobile" + mobile + "normal" + count + "planId" + planid + "seatids" + seatv ; //String r2 = md5.Encrypt(md5.Encrypt(md5.Encrypt(pwd)) +hipiaocard); //String r3 = md5.Encrypt(r1 + r2); Console.WriteLine("r1==" + r1); String r2 = Encrypt(Encrypt(Encrypt(pwd)) + hipiaocard); Console.WriteLine("r2==" + r2); String tmp = r1 + r2; Console.WriteLine("tmp==" + tmp); //MD5Tester tester = new MD5Tester(); // Console.WriteLine("临时加密结果为:" + MD5Tester.Encrypt(tmp,32)); Console.WriteLine("临时加密结果为:" + md5One(tmp)); String r3 = Encrypt(r1 + r2); Console.WriteLine("r3==" + r3); String r4 = "MEMBERID=" + menberid + "&mobile=" + mobile + "&normal=" + count + "&planId=" + planid + "&seatids=" + seatv + "&fromclient" + fromclient; //String query = r4 + "&pass="******"&pass="******"yyyy-MM-dd HH:mm:ss") + "发送购票内容为:" + query); #endif //9457ea0b240e8dfaa85622d371330f89 //MEMBERID=&mobile=18618237773&normal=4&planId=&seatids=&fromclient&pass= // TestConnection2(10000); /* * 3D3514F23F37E13A 丰大驾校 * 4D64496ADCEF53E0 安泰驾校 * 13EE4553EEF0DF7E 市驾培中心 * A59B773F9C3AA159 惠东平安 * C4FA4E8E43E6A92F 惠东怡辉 * 70C1D30CC159B03B 博罗鸿信 * A60793889949C6F6 光大驾校 * 23762878906B059C 亮丽驾校 * AD8045BF9592308E 博罗鸿信 * 3D00BF143CC95448 环球驾校 * F1844D78F2236926 宏达驾校 * 50B4238104DABA1C * E48EF54511ED7D4F 市驾培中心 * 7D66505102C8DB25 隆辉驾校 * 84A883D2309E661D 隆辉驾校 * DCA698218706CA2B 博罗鸿信 * C3F979CF15706C39 金峰驾校 * * * * * ComputerMonitorHelper helper = new ComputerMonitorHelper(); * helper.CheckIsOpenPort(3389); * helper.CheckIsOpenPort("192.168.1.10",3389); * //FT.Commons.WindowsService.BaseWindowService serv = new FT.Commons.WindowsService.ExDiskPluginMonitorService("CDEF", 1000); * //FT.Commons.WindowsService.BaseWindowService serv = new FT.Commons.WindowsService.NetworkMonitorService( 1000); * // FT.Commons.WindowsService.BaseWindowService serv = new FT.Commons.WindowsService.SystemServiceMonitorService(30000); * // FT.Commons.WindowsService.BaseWindowService serv = new FT.Commons.WindowsService.ProcessMonitorService(30000); * * // serv.DoTask(); * //ComputerInitHelper.InitFolderMd5("Windows Xp","Sp3","D:\\自助终端","D:\\自助终端"); * // ComputerInitHelper.InitSystemServices(); * //ComputerInitHelper.InitSystemNetworkCard(); * Console.ReadLine(); */ //ISecurity md5 = new MD5Security(); ISecurity sec = FT.Commons.Security.SecurityFactory.GetSecurity(); //string hardwarecode=FT.Commons.Tools.HardwareManager.GetMachineCode(); // string hardwarecode = "C3F979CF15706C39"; Console.WriteLine("请输入机器码并回车:"); string hardwarecode = Console.ReadLine(); //一友驾校 //E7A7CA598DDDAFA6 // string company = "金峰驾校"; Console.WriteLine("请输入授权用户名称并回车:"); string company = Console.ReadLine(); Console.WriteLine("注册码生成结果为->" + md5.Encrypt(sec.Encrypt(hardwarecode + company + hardwarecode))); /* string path = Environment.CurrentDirectory + "//success.wav"; * SystemDefine.PlaySound(path, 0, SystemDefine.SND_ASYNC | SystemDefine.SND_FILENAME);//播放音乐 * //FT.Commons.Tools.WindowsPrinterHelper.LoopPrinter(); * string printer = @"\\192.168.1.150\Brother DCP-7030 Printer"; * // Console.WriteLine("打印机状态为:"+FT.Commons.Tools.WindowsPrinterHelper.GetPrinterStat(printer).ToString()); * * string cmd = ""+(char)(27)+(char)(33)+(char)(10)+"模"; * byte[] mybyte = System.Text.Encoding.Default.GetBytes(cmd); * for (int i = 0; i < mybyte.Length; i++) * { * Console.WriteLine(i+"="+mybyte[i]); * } * Console.ReadLine(); * */ Console.ReadLine(); }
public UserProfile() { CreateMap <UserAddDto, users>() .ForMember(destination => destination.password, opt => opt.MapFrom(src => MD5Security.Encrypt(src.password))) .AfterMap((src, dest) => { DateTime now = DateTime.Now; dest.lastlogindate = null; dest.logintimes = 0; dest.adddate = now; dest.updatedate = null; dest.deletedate = null; dest.delmark = Constant.N; dest.rolename = userrole.user.ToString(); }); CreateMap <users, UserDto>(); }