CN113078999A - 一种密码安全加密保存方式 - Google Patents

一种密码安全加密保存方式 Download PDF

Info

Publication number
CN113078999A
CN113078999A CN202110392169.6A CN202110392169A CN113078999A CN 113078999 A CN113078999 A CN 113078999A CN 202110392169 A CN202110392169 A CN 202110392169A CN 113078999 A CN113078999 A CN 113078999A
Authority
CN
China
Prior art keywords
key
user
password
encodepwd
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110392169.6A
Other languages
English (en)
Inventor
尚德华
邱为楷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aopu Shanghai New Energy Co Ltd
Original Assignee
Aopu Shanghai New Energy Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aopu Shanghai New Energy Co Ltd filed Critical Aopu Shanghai New Energy Co Ltd
Priority to CN202110392169.6A priority Critical patent/CN113078999A/zh
Publication of CN113078999A publication Critical patent/CN113078999A/zh
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0819Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
    • H04L9/0822Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using key encryption key
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3226Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN

Abstract

本发明属于软件技术领域,具体公开了一种密码安全加密保存方式,包括如下具体步骤:S1:在数据库中,提前预留出encodePwd和key作为密码存储字段;S2:后台程序获取到用户在账号注册时输入的密码后,随机生成任意位复杂的字符串作为key,生成后存储到数据库对应的key字段中;S3:获取到随机key后,将用户输入的密码与key进行拼接;S4:将拼接后的密码进行MD5加密,加密后存储到encodePwd字段;S5:用户请求登录时,后台程序获取到用户输入的账号密码后,通过用户的username查询到该用户的key;S6:将登录输入的密码与key进行拼接,再将拼接后的密码进行MD5加密;S7:将加密后的字符串与数据库中encodePwd进行对比。保证用户的key足够复杂,无法轻易反推出来原始密码,提高安全性。

Description

一种密码安全加密保存方式
技术领域
本发明涉及软件技术领域,具体为一种密码安全加密保存方式。
背景技术
在当前大发展背景下,中国系统软件行业日趋繁荣,越来越多的行业进入互联网+时代,几乎所有的行业都离不开互联网的支持。其中,各类企业管理系统、网络应用软件都离不开账号、密码、登录,其中涉及到的密码安全一向是软件开发者最头疼的问题。首先要保障数据库安全,无法被轻易拖库,即整个数据库表、数据被攻击者获取,其次,即便是被拖库,需要保证攻击者无法从中直接获取到用户的账号密码,无法通过账号密码伪造请求通过系统验证,也无法破解出用户密码,因此对系统密码加密存储方式设计要求非常严格。
目前,许多公司一般不会直接明文存储用户输入的密码,而是采用MD5对密码进行加密,MD5加密属于不可逆加密,理论上非常安全,但MD5的缺陷在于,加密后的字符串是固定的,例如123456通过MD5加密后是e10adc3949ba59abbe56e057f20f883e,那么可以通过穷举各种常见的密码,来得到MD5数据,进而反推出密码,大量长度不够、简单的密码可以通过反推获得。因此,只对密码进行MD5加密是肯定不够的。每年基于帐户安全的攻击多之又多,所以保护用户帐号密码和资料是至关重要的。渗透用户帐户是黑客最常用的攻击方式之一,一旦黑客获取到受害者的帐户密码,那么将会发生一系列不可想象的后果。
发明内容
本发明的目的在于提供一种密码安全加密保存方式,以解决上述背景技术中提出的问题。
为实现上述目的,本发明提供如下技术方案:一种密码安全加密保存方式,包括如下具体步骤:
S1:在数据库中,提前预留出encodePwd和key作为密码存储字段;
S2:后台程序获取到用户在账号注册时输入的密码后,由系统随机生成任意位复杂的字符串作为key,生成后存储到数据库对应的key字段中;
S3:获取到随机key后,将用户输入的密码与key进行拼接;
S4:将拼接后的密码进行MD5加密,加密后存储到encodePwd字段;
S5:当用户在请求登录时,后台程序获取到用户输入的账号密码后,通过用户的username查询到该用户的key;
S6:将登录输入的密码与key进行拼接,再将拼接后的密码进行MD5加密;
S7:将加密后的字符串与数据库中encodePwd进行对比,如两者相等,则密码正确。
优选的,步骤S2中,随机生成的字符串格式为大写字母+小写字母+数字,长度随机。
优选的,步骤S4中,用户username、encodePwd、key存放在同一条数据中。
与现有技术相比,本发明的有益效果是:
本发明通过随机生成复杂数作为key,再与用户输入的密码拼接后进行MD5加密,得到加密后的字符串,保证用户的key足够复杂,并且每个用户的key不相同,通过MD5无法轻易反推出来原始密码,即便是拖库也无法直接通过密码登录,提高安全性。
附图说明
图1为本发明的整体流程示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
请参阅图1,本发明提供一种技术方案:一种密码安全加密保存方式,以一个WEB页面用户注册登录的场景为例,具体步骤如下:
S1:在数据库中,提前预留出encodePwd和key作为密码存储字段;
S2:在WEB界面填写账号密码注册,后台程序获取到用户在账号注册时输入的密码后,由系统随机生成任意位复杂的字符串作为key,通常为大写字母+小写字母+数字,长度随机,生成后存储到数据库对应的key字段中;
S3:获取到随机key后,将用户输入的密码与key进行拼接;例如用户输入123456随机生成key为djfaSDFSodfaw324,拼接为:
123456djfaSDFSodfaw324;
S4:将拼接后的密码进行MD5加密,加密后存储到encodePwd字段;其中用户username、encodePwd、key存放在同一条数据中;
S5:当用户在WEB页面请求登录时,后台程序获取到用户输入的账号密码后,通过用户的username查询到该用户的key;
S6:将登录输入的密码与key进行拼接,再将拼接后的密码进行MD5加密;
S7:将加密后的字符串与数据库中encodePwd进行对比,如两者相等,则密码正确。
本发明的密码加密存储方案可以在用户完全不知情的情况下,提升了整体的安全性。
尽管已经示出和描述了本发明的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本发明的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由所附权利要求及其等同物限定。

Claims (2)

1.一种密码安全加密保存方式,其特征在于,包括如下具体步骤:
S1:在数据库中,提前预留出encodePwd和key作为密码存储字段;
S2:后台程序获取到用户在账号注册时输入的密码后,由系统随机生成任意位复杂的字符串作为key,生成后存储到数据库对应的key字段中;
S3:获取到随机key后,将用户输入的密码与key进行拼接;
S4:将拼接后的密码进行MD5加密,加密后存储到encodePwd字段,且用户username、encodePwd、key存放在同一条数据中;
S5:当用户在请求登录时,后台程序获取到用户输入的账号密码后,通过用户的username查询到该用户的key;
S6:将登录输入的密码与key进行拼接,再将拼接后的密码进行MD5加密;
S7:将加密后的字符串与数据库中encodePwd进行对比,如两者相等,则密码正确。
2.根据权利要求1所述的一种密码安全加密保存方式,其特征在于:步骤S2中,随机生成的字符串格式为大写字母+小写字母+数字,长度随机。
CN202110392169.6A 2021-04-13 2021-04-13 一种密码安全加密保存方式 Pending CN113078999A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110392169.6A CN113078999A (zh) 2021-04-13 2021-04-13 一种密码安全加密保存方式

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110392169.6A CN113078999A (zh) 2021-04-13 2021-04-13 一种密码安全加密保存方式

Publications (1)

Publication Number Publication Date
CN113078999A true CN113078999A (zh) 2021-07-06

Family

ID=76617389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110392169.6A Pending CN113078999A (zh) 2021-04-13 2021-04-13 一种密码安全加密保存方式

Country Status (1)

Country Link
CN (1) CN113078999A (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114567430A (zh) * 2022-01-26 2022-05-31 银盛通信有限公司 一种移动转售系统给用户密码增加私钥的方法

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104348609A (zh) * 2014-09-18 2015-02-11 成都西山居互动娱乐科技有限公司 一种非存储的密码管理算法
WO2017039156A1 (ko) * 2015-08-28 2017-03-09 주식회사 엔터소프트 솔티드 패스워드 인증방법
CN106656476A (zh) * 2017-01-18 2017-05-10 腾讯科技(深圳)有限公司 一种密码保护方法及装置
CN107911343A (zh) * 2017-10-27 2018-04-13 深圳英飞拓科技股份有限公司 安全的密码存储验证方法和装置
CN107948155A (zh) * 2017-11-24 2018-04-20 重庆金融资产交易所有限责任公司 密码校验方法、装置、计算机设备和计算机可读存储介质
CN108462574A (zh) * 2018-02-12 2018-08-28 广东睿江云计算股份有限公司 一种轻量级密码加密方法和系统
CN109040148A (zh) * 2018-11-01 2018-12-18 四川长虹电器股份有限公司 一种移动端向服务器发送登录请求的安全认证方法
CN109714365A (zh) * 2019-02-25 2019-05-03 南京金信通信息服务有限公司 基于多重散列计算的密码管理方法和系统
CN109740339A (zh) * 2018-12-28 2019-05-10 深圳竹云科技有限公司 一种提高用户密码安全性的方法

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104348609A (zh) * 2014-09-18 2015-02-11 成都西山居互动娱乐科技有限公司 一种非存储的密码管理算法
WO2017039156A1 (ko) * 2015-08-28 2017-03-09 주식회사 엔터소프트 솔티드 패스워드 인증방법
CN106656476A (zh) * 2017-01-18 2017-05-10 腾讯科技(深圳)有限公司 一种密码保护方法及装置
CN107911343A (zh) * 2017-10-27 2018-04-13 深圳英飞拓科技股份有限公司 安全的密码存储验证方法和装置
CN107948155A (zh) * 2017-11-24 2018-04-20 重庆金融资产交易所有限责任公司 密码校验方法、装置、计算机设备和计算机可读存储介质
CN108462574A (zh) * 2018-02-12 2018-08-28 广东睿江云计算股份有限公司 一种轻量级密码加密方法和系统
CN109040148A (zh) * 2018-11-01 2018-12-18 四川长虹电器股份有限公司 一种移动端向服务器发送登录请求的安全认证方法
CN109740339A (zh) * 2018-12-28 2019-05-10 深圳竹云科技有限公司 一种提高用户密码安全性的方法
CN109714365A (zh) * 2019-02-25 2019-05-03 南京金信通信息服务有限公司 基于多重散列计算的密码管理方法和系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114567430A (zh) * 2022-01-26 2022-05-31 银盛通信有限公司 一种移动转售系统给用户密码增加私钥的方法

Similar Documents

Publication Publication Date Title
US10790976B1 (en) System and method of blockchain wallet recovery
US11757641B2 (en) Decentralized data authentication
CN109274652B (zh) 身份信息验证系统、方法及装置及计算机存储介质
US8533469B2 (en) Method and apparatus for sharing documents
US20110276490A1 (en) Security service level agreements with publicly verifiable proofs of compliance
CN112671720B (zh) 一种云平台资源访问控制的令牌构造方法、装置及设备
KR20160138063A (ko) 머신 생성 인증 토큰으로써 서비스를 동작시키는 기법
Vegesna Methodologies for Enhancing Data Integrity and Security in Distributed Cloud Computing with Techniques to Implement Security Solutions
US10397207B1 (en) Automatic credential rotation
US20150128254A1 (en) Offline authentication with embedded authorization attributes
CN107563176A (zh) 基于u盘的登录认证方法、系统、可读存储介质和计算机
CN112801663A (zh) 区块链存证方法、装置、系统、设备和介质
CN109462602A (zh) 登录信息存储方法、登录验证方法、装置、设备及介质
US20210399897A1 (en) Protection of online applications and webpages using a blockchain
CN105516066B (zh) 一种对中间人的存在进行辨识的方法及装置
CN110071937A (zh) 基于区块链的登录方法、系统及存储介质
WO2015062441A1 (zh) CGI web界面下的多会话验证码的产生及验证方法
CN113078999A (zh) 一种密码安全加密保存方式
CN111090616B (zh) 一种文件管理方法、对应装置、设备及存储介质
Olanrewaju et al. RFDA: Reliable framework for data administration based on split-merge policy
CN110890979B (zh) 堡垒机自动部署方法、装置、设备及介质
CN104202164A (zh) 一种采用数字证书保护云服务信息的方法及云服务器
CN113901507B (zh) 一种多参与方的资源处理方法及隐私计算系统
CN114553557A (zh) 密钥调用方法、装置、计算机设备和存储介质
Kumar et al. Hash based approach for providing privacy and integrity in cloud data storage using digital signatures

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210706