CN107493286A - 一种基于安全鉴权的rpc远程过程调用方法 - Google Patents
一种基于安全鉴权的rpc远程过程调用方法 Download PDFInfo
- Publication number
- CN107493286A CN107493286A CN201710731614.0A CN201710731614A CN107493286A CN 107493286 A CN107493286 A CN 107493286A CN 201710731614 A CN201710731614 A CN 201710731614A CN 107493286 A CN107493286 A CN 107493286A
- Authority
- CN
- China
- Prior art keywords
- service end
- digital signature
- timestamp
- caller client
- request
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/133—Protocols for remote procedure calls [RPC]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic 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/3226—Cryptographic 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic 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/3247—Cryptographic 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 involving digital signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic 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/3297—Cryptographic 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 involving time stamps, e.g. generation of time stamps
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
- Storage Device Security (AREA)
Abstract
本发明涉及RPC远程调用服务领域,旨在提供一种基于安全鉴权的RPC远程过程调用方法。该基于安全鉴权的RPC远程过程调用方法包括步骤:服务端为调用者客户端提供一个8位的密钥,每个调用者客户端调用时向服务端传时间戳、8位随机数和数字签名CS,服务端在接收到请求时,首先根据时间戳判断请求时间是否合法;然后,服务端获取调用者客户端送过来的参数,重组得到数字签名SS,服务端通过比较数字签名CS和数字签名SS,实现调用权限的认证。本发明处理了非法请求带来的安全隐患,通过令牌加密的安全鉴定方法对调用者客户端的入口参数进行验证,通过MD5算法能防止非法的请求带来的安全风险,从而为RPC远程过程调用带来安全。
Description
技术领域
本发明是关于RPC远程调用服务领域,特别涉及一种基于安全鉴权的RPC远程过程调用方法。
背景技术
RPC是Remote Procedure Calling,远程过程调用的缩写。随着分布式技术的发展,软件的结构体系发生了较大的变化,特别是银行、金融、互联网等一些大流量、高并发的网站架构中,为了支持海量的访问,可以采用分布式,将客户端和服务端分离,多台服务器支撑业务***水平扩展,负载均衡比如Nginx进行流量分发,这样即便某些服务挂了,也不会影响整个网站。由此可见分布式的重要性,然而随着分布式的发展,以及不同站点之间需要进行通信和共享,这样RPC就显得非常的重要,常见的RPC比如:DUBBO、Hessian、webservice等。
RPC远程过程调用,就需要服务端暴露自己的相应的业务接口方法,让客户端去调用,这个过程中服务端相应的业务接口方法是需要暴露出来的,比如:
webservice的wsdl:
<?xml version="1.0"encoding="UTF8"?>
<definitions targetNamespace="http://localhost:8080/dbapp/HelloService">
<message name="sayHelloRequest">…</message>
<message name="sayHelloResponse">…</message>
<portType name="HelloServiceImpl"></portType>
<binding name="helloServiceSoapBinding"
type="impl:HelloServiceImpl"></binding>
<service name="HelloServiceImplService"
type="impl:HelloServiceImpl"></service>
</definitions>
dubbo暴露的服务接口:
<bean id="helloService"
class="cn.com.dbapp.hello.impl.HelloServiceImpl"/>
<dubbo:service interface="cn.com.dbapp.hello.HelloService"
ref="helloService">
<dubbo:method name="sayHello"/>
</dubbo:service>
那么就存在一个问题,只要相应的主机防火墙端口开通并且拿到服务端暴露的接口方法的接口的相关文档,就可以实现远程RPC的调用。这样对于“非正式”(未授权的)客户端也可以调用。一旦服务端没有对客户端进行调用权限的认证,那么匿名的也可以调用相应的业务方法,从而得到相关的信息。这样对于信息泄露存在安全隐患的。从而降低了RPC的安全。
发明内容
本发明的主要目的在于克服现有技术中的不足,提供一种基于RPC远程调用服务,通过服务端对客户端发送过来的3个必填参数进行安全鉴权来实现的安全鉴权方法。为解决上述技术问题,本发明的解决方案是:
提供一种基于安全鉴权的RPC远程过程调用方法,用于服务端对于调用者客户端进行调用权限的认证,所述基于安全鉴权的RPC远程过程调用方法具体包括下述步骤:
(1)服务端为每一个调用者客户端提供一个8位的密钥;
(2)当调用者客户端需要对服务端进行调用时,每个调用者客户端都需要向服务端传3个参数:时间戳(timestamp,GMT和当前的时间毫秒差,java即为System.currentTimeMillis())、8位随机数(randomNum)、数字签名CS(signature);
数字签名采用消息摘要算法第五版(即MD5,为计算机安全领域广泛使用的一种散列函数,用以提供消息的完整性保护),所述数字签名CS(客户端数字签名)=MD5(时间戳+8位随机数+约定的密钥);
(3)服务端在接收到调用者客户端的请求时,首先根据时间戳判断请求时间是否合法,发生在N(N根据需要配置)分钟之前的请求视为非法请求;
(4)时间戳验证通过后,服务端获取调用者客户端送过来的时间戳、8位随机数、约定的密钥,进行数字签名的重组,即数字签名SS(服务端数字签名)=MD5(时间戳+8位随机数+约定密钥);
其中,服务端根据不同的调用者客户端,获取对应的密钥(每个调用者客户端与密钥的对应关系可以存储在数据库中,也可以在服务端应用启动的时候加载到内存里直接使用);
(5)服务端对数字签名CS和数字签名SS进行比较:若数字签名CS和数字签名SS的MD5字符串一致,则请求合法,服务端能对后续的业务逻辑进行受理并且返回给调用者客户端;否则视为非法请求并返回非法请求给调用者客户端。
在本发明中,所述服务端和调用者客户端约定的8位密钥能够自行定义(比如:1234qwer);数字签名则是根据时间戳、8位随机数、约定密钥通过MD5算法生成,实时在变。
与现有技术相比,本发明的有益效果是:
本发明处理了非法请求带来的安全隐患,通过令牌加密的安全鉴定方法对调用者客户端的入口参数进行验证,通过MD5算法能防止非法的请求带来的安全风险,从而为RPC远程过程调用带来安全。
附图说明
图1为本发明的工作流程图。
具体实施方式
首先需要说明的是,本发明涉及RPC远程过程调用的技术的应用,是计算机技术在分布式软件中的一种应用。在本发明的实现过程中,会涉及到多个软件功能模块的应用。申请人认为,如在仔细阅读申请文件、准确理解本发明的实现原理和发明目的以后,在结合现有公知技术的情况下,本领域技术人员完全可以运用其掌握的软件编程技能实现本发明。凡本发明申请文件提及的均属此范畴,申请人不再一一列举。
下面结合附图与具体实施方式对本发明作进一步详细描述:
如图1所示,基于安全鉴权的RPC远程过程调用方法具体包括下述步骤:
步骤A:RPC客户端发送请求;
步骤B:参数的组装,包括时间戳,8位随机数,约定的8位密钥,数字签名(MD5(时间戳+8位随机数+约定的8位密钥),业务参数);
步骤C:建立连接,长连接/短连接;
步骤D:RPC服务端中密钥管理:密钥根据不同的调用者客户端获取对应的密钥,每个调用者客户端与密钥的对应关系可以存储在数据库中,也可以在服务端应用启动的时候加载到内存里直接使用;
步骤E:RPC服务端对RPC客户端请求合法性验证,即服务端数字签名MD5(时间戳+8位随机数+约定的8位密钥)与客户端发送过来的数字签名(MD5(时间戳+8位随机数+约定的8位密钥)是否相等;
步骤F:根据步骤E的判断结果,如果相同就继续进入相应的业务逻辑处理并且返回给RPC客户端,如果不同就返回非法请求给RPC客户端。
实施过程中,会涉及到双方的约定,这种约定比如要约定8位的安全密钥,此密钥不能对第三者公开。否则无安全性。程序开发人员完全可以通过这种方法,防止非法请求带来的困惑。此方法可以用于常用的RPC远程过程调用,比如dubbo,webservice等的服务端开发。
下面的实施例可以使本专业的专业技术人员更全面地理解本发明,但不以任何方式限制本发明。下面以webservice,对服务端和客户端具体说明。
客户端具体包括下述步骤:
步骤a:根据wsdl相关信息建立与服务器建立连接;
步骤b:调用者客户端的参数组装,时间戳,8位随机数,8位约定好的密钥,数字签名,以及业务参数;
步骤c:将步骤b中封装好的参数发送到服务端。
服务端具体包括下述步骤:
步骤d:取的步骤c传递过来的参数;
步骤e:根据安全鉴定的规则即客户端生成的MD5数字签名与服务端生成的MD5数字签名进行比较,其中数字签名规则为MD5(时间戳+8位随机数+约定的密钥);
步骤f:通过了步骤e就视为安全请求,否则就返回给调用者客户端该请求不合法。
数字签名的验证在服务端进行,可以有效的防止非法请求带来的安全风险。
最后,需要注意的是,以上列举的仅是本发明的具体实施例。显然,本发明不限于以上实施例,还可以有很多变形。本领域的普通技术人员能从本发明公开的内容中直接导出或联想到的所有变形,均应认为是本发明的保护范围。
Claims (2)
1.一种基于安全鉴权的RPC远程过程调用方法,用于服务端对于调用者客户端进行调用权限的认证,其特征在于,所述基于安全鉴权的RPC远程过程调用方法具体包括下述步骤:
(1)服务端为每一个调用者客户端提供一个8位的密钥;
(2)当调用者客户端需要对服务端进行调用时,每个调用者客户端都需要向服务端传3个参数:时间戳、8位随机数、数字签名CS;
数字签名采用消息摘要算法第五版,所述数字签名CS=MD5(时间戳+8位随机数+约定的密钥);
(3)服务端在接收到调用者客户端的请求时,首先根据时间戳判断请求时间是否合法,发生在N分钟之前的请求视为非法请求;
(4)时间戳验证通过后,服务端获取调用者客户端送过来的时间戳、8位随机数、约定的密钥,进行数字签名的重组,即数字签名SS=MD5(时间戳+8位随机数+约定密钥);
其中,服务端根据不同的调用者客户端,获取对应的密钥;
(5)服务端对数字签名CS和数字签名SS进行比较:若数字签名CS和数字签名SS的MD5字符串一致,则请求合法,服务端能对后续的业务逻辑进行受理并且返回给调用者客户端;否则视为非法请求并返回非法请求给调用者客户端。
2.根据权利要求1所述的一种基于安全鉴权的RPC远程过程调用方法,其特征在于,所述服务端和调用者客户端约定的8位密钥能够自行定义;数字签名则是根据时间戳、8位随机数、约定密钥通过MD5算法生成,实时在变。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710731614.0A CN107493286A (zh) | 2017-08-23 | 2017-08-23 | 一种基于安全鉴权的rpc远程过程调用方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710731614.0A CN107493286A (zh) | 2017-08-23 | 2017-08-23 | 一种基于安全鉴权的rpc远程过程调用方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107493286A true CN107493286A (zh) | 2017-12-19 |
Family
ID=60650911
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710731614.0A Pending CN107493286A (zh) | 2017-08-23 | 2017-08-23 | 一种基于安全鉴权的rpc远程过程调用方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107493286A (zh) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108418814A (zh) * | 2018-02-12 | 2018-08-17 | 广州市贝聊信息科技有限公司 | 基于dubbo框架的接口认证方法、装置及计算机可读存储介质 |
WO2019166001A1 (zh) * | 2018-03-01 | 2019-09-06 | 捷开通讯(深圳)有限公司 | 令牌生成和校验方法及智能终端 |
CN111125667A (zh) * | 2019-12-09 | 2020-05-08 | 北京握奇智能科技有限公司 | 漫游密钥调用方法、装置和*** |
CN111901124A (zh) * | 2020-07-29 | 2020-11-06 | 北京天融信网络安全技术有限公司 | 一种通信安全防护方法、装置及电子设备 |
CN111984679A (zh) * | 2020-07-02 | 2020-11-24 | 中科驭数(北京)科技有限公司 | 硬件加速数据库的访问方法、装置、主机、***及介质 |
CN112016082A (zh) * | 2020-10-26 | 2020-12-01 | 成都掌控者网络科技有限公司 | 一种权限清单安全控制方法 |
CN112506678A (zh) * | 2020-12-08 | 2021-03-16 | 平安国际智慧城市科技股份有限公司 | 基于认证和鉴权的rpc远程调用方法、***以及存储介质 |
CN112788036A (zh) * | 2021-01-13 | 2021-05-11 | 中国人民财产保险股份有限公司 | 身份验证方法及装置 |
CN113296751A (zh) * | 2021-05-17 | 2021-08-24 | 国电南瑞科技股份有限公司 | 一种基于json-rpc实现跨语言通讯的方法及*** |
CN113541953A (zh) * | 2020-04-21 | 2021-10-22 | 上海大众祥云运输管理有限公司 | 一种用于交通客运信息管理***的鉴权方法 |
CN115618396A (zh) * | 2022-11-28 | 2023-01-17 | 云账户技术(天津)有限公司 | 一种数据的加密方法及装置 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103701761A (zh) * | 2012-09-28 | 2014-04-02 | 中国电信股份有限公司 | 开放接口调用的认证方法与*** |
CN104717192A (zh) * | 2013-12-16 | 2015-06-17 | 腾讯科技(深圳)有限公司 | 合法性验证方法及中间服务器 |
CN104780176A (zh) * | 2015-04-28 | 2015-07-15 | 中国科学院微电子研究所 | 安全调用表述性状态转移应用编程接口的方法和*** |
CN104935568A (zh) * | 2015-04-20 | 2015-09-23 | 成都康赛信息技术有限公司 | 一种面向云平台接口鉴权签名方法 |
CN106302346A (zh) * | 2015-05-27 | 2017-01-04 | 阿里巴巴集团控股有限公司 | Api调用的安全认证方法、装置、*** |
-
2017
- 2017-08-23 CN CN201710731614.0A patent/CN107493286A/zh active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103701761A (zh) * | 2012-09-28 | 2014-04-02 | 中国电信股份有限公司 | 开放接口调用的认证方法与*** |
CN104717192A (zh) * | 2013-12-16 | 2015-06-17 | 腾讯科技(深圳)有限公司 | 合法性验证方法及中间服务器 |
CN104935568A (zh) * | 2015-04-20 | 2015-09-23 | 成都康赛信息技术有限公司 | 一种面向云平台接口鉴权签名方法 |
CN104780176A (zh) * | 2015-04-28 | 2015-07-15 | 中国科学院微电子研究所 | 安全调用表述性状态转移应用编程接口的方法和*** |
CN106302346A (zh) * | 2015-05-27 | 2017-01-04 | 阿里巴巴集团控股有限公司 | Api调用的安全认证方法、装置、*** |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108418814A (zh) * | 2018-02-12 | 2018-08-17 | 广州市贝聊信息科技有限公司 | 基于dubbo框架的接口认证方法、装置及计算机可读存储介质 |
WO2019166001A1 (zh) * | 2018-03-01 | 2019-09-06 | 捷开通讯(深圳)有限公司 | 令牌生成和校验方法及智能终端 |
CN111125667A (zh) * | 2019-12-09 | 2020-05-08 | 北京握奇智能科技有限公司 | 漫游密钥调用方法、装置和*** |
CN113541953A (zh) * | 2020-04-21 | 2021-10-22 | 上海大众祥云运输管理有限公司 | 一种用于交通客运信息管理***的鉴权方法 |
CN111984679B (zh) * | 2020-07-02 | 2021-06-04 | 中科驭数(北京)科技有限公司 | 硬件加速数据库的访问方法、装置、主机、***及介质 |
CN111984679A (zh) * | 2020-07-02 | 2020-11-24 | 中科驭数(北京)科技有限公司 | 硬件加速数据库的访问方法、装置、主机、***及介质 |
CN111901124A (zh) * | 2020-07-29 | 2020-11-06 | 北京天融信网络安全技术有限公司 | 一种通信安全防护方法、装置及电子设备 |
CN112016082A (zh) * | 2020-10-26 | 2020-12-01 | 成都掌控者网络科技有限公司 | 一种权限清单安全控制方法 |
CN112506678A (zh) * | 2020-12-08 | 2021-03-16 | 平安国际智慧城市科技股份有限公司 | 基于认证和鉴权的rpc远程调用方法、***以及存储介质 |
CN112506678B (zh) * | 2020-12-08 | 2024-06-11 | 平安国际智慧城市科技股份有限公司 | 基于认证和鉴权的rpc远程调用方法、***以及存储介质 |
CN112788036A (zh) * | 2021-01-13 | 2021-05-11 | 中国人民财产保险股份有限公司 | 身份验证方法及装置 |
CN112788036B (zh) * | 2021-01-13 | 2022-12-27 | 中国人民财产保险股份有限公司 | 身份验证方法及装置 |
CN113296751A (zh) * | 2021-05-17 | 2021-08-24 | 国电南瑞科技股份有限公司 | 一种基于json-rpc实现跨语言通讯的方法及*** |
CN113296751B (zh) * | 2021-05-17 | 2023-09-29 | 国电南瑞科技股份有限公司 | 一种基于json-rpc实现跨语言通讯的方法及*** |
CN115618396A (zh) * | 2022-11-28 | 2023-01-17 | 云账户技术(天津)有限公司 | 一种数据的加密方法及装置 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107493286A (zh) | 一种基于安全鉴权的rpc远程过程调用方法 | |
CN111213350B (zh) | 用于创建去中心化标识的***和方法 | |
US11025435B2 (en) | System and method for blockchain-based cross-entity authentication | |
US11038670B2 (en) | System and method for blockchain-based cross-entity authentication | |
EP3788522B1 (en) | System and method for mapping decentralized identifiers to real-world entities | |
JP7141193B2 (ja) | ブロックチェーン・ネットワークに対するドキュメント・アクセス | |
US11165579B2 (en) | Decentralized data authentication | |
CN109995776A (zh) | 一种互联网数据验证方法及*** | |
Rankothge et al. | Identification and mitigation tool for cross-site request forgery (CSRF) | |
US11310044B2 (en) | Authenticate transactions of secured file in blockchain | |
WO2023134282A1 (zh) | 基于区块链的数据处理方法、装置、设备、存储介质及程序产品 | |
CN114978681B (zh) | 基于区块链的服务应用授权方法及装置、处理器 | |
Ilchev et al. | Modular data hiding for improved web-portal security | |
CN116961937A (zh) | 区块链程序的访问方法、相关设备及存储介质 | |
Vijay et al. | RAICB: Robust Authentication Immunity Cloud Bucket for Secure Cloud Storage System | |
Kim et al. | A Study on the ebXML Business Transation Models Exploiting XML Security Technologies | |
Nadalin | WS-I Security Scenarios |
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 |
Application publication date: 20171219 |
|
RJ01 | Rejection of invention patent application after publication |