English 中文(简体)
鲁比:表面上签字以确保真实性?
原标题:Ruby: Cryptographically sign a string to ensure authenticity?

请允许我说,我拥有一个来源服务器,通过向特定查询显示器,需要向目标服务器提供细节。 然而,我需要确保这些细节只来自我的原服务器。

我还可以确保目标服务器的完整性。 或者具体地说,目标服务器可能会受损,因此任何加密钥匙都可能被恶意方阅读。

我认为,我可以使用某种形式的公共/私人钥匙。 原始服务器使用私人钥匙来签字插座,目标服务器使用公用钥匙来核实它来自我的原服务器,电文塔被篡改。

我距离密码专家或任何东西相距甚远,因此,我这里的任何假设可能是错误的,如果是的话,请更正我:

我基本上在鲁比拉采取(全心全意)简单的方式这样做。

问题回答

值得注意的是,签署询问数据的最容易的形式(就你而言是重新定位的URL)是使用HMAC。 您的原籍和目的地服务器需要分享这方面的共同钥匙,而HMAC不是公私营钥匙加密的一种形式,而是一种关键的洗衣形式。

您回顾的模块是:ruby-hmac,并且你的源和目的地服务器必须做以下事情:

require  hmac-md5 
HMAC::MD5.new("<your shared key>").update("<your URL to check>").hexdigest

比较目的地方面,HMAC在来源方面计算出来的摘要是等值的:因此,双方都做了同样的计算。 单靠从源头到目的地再用电离参数运输HMAC的头顶。





相关问题
Extend Contacts application on Android to provide encryption

I want to encrypt individual contacts stored by the Contacts application on Android based on user s preference. So, I am thinking I ll have to hook/extend the Contacts application before the it stores ...

Make md5 strong

Im making a website that will intergrate with game that only support md5 hashing metod (atm). Which ofc is not especially safe anymore. But how could i make it stronger? Should I just generate long ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

Thread & Queue vs Serial performance

I though it ll be interesting to look at threads and queues, so I ve written 2 scripts, one will break a file up and encrypt each chunk in a thread, the other will do it serially. I m still very new ...

Convert PHP encryption code to C#

I m trying to convert this piece of code from PHP to C#. It s part of a Captive Portal. Could somebody explain what it does? $hexchal = pack ("H32", $challenge); if ($uamsecret) { $newchal = ...

Encryption: how to have 1 iv despite multiple fields

I ve been stuck trying to arrive at a best solution for this for a while. I know that an initialization vector has to be unique for each item being encrypted. So if I m encrypting an address and I ...

热门标签