如何证明某些数据来自我的应用程序? [英] How can I prove that some data came from my app?

查看:110
本文介绍了如何证明某些数据来自我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个分布式应用程序,可以从Internet上的特定服务发送和接收数据.当节点接收到数据时,有时需要验证该数据是否与它或先前发送的另一个节点的数据相关.该值还必须足够唯一,以便我几乎可以期望在24小时内不会生成相同的值.

I have a distributed application that sends and receives data from a specific service on the Internet. When a node receives data, sometimes it needs to validate that that data is correlated with data it or another node previously sent. The value also needs to be unique enough so that I can practically expect never to generate identical values within 24 hours.

在当前实现中,我一直在使用包含值uuid.uuid1()的自定义标头.通过将接收到的uuid与uuid.getnode()进行比较,我可以轻松地验证该值来自运行的单个节点,但是在我们要求此应用程序应为多节点之前编写了此实现.

In the current implementation I have been using a custom header containing a value of uuid.uuid1(). I can easily validate that that value comes from the one single node running by comparing the received uuid to uuid.getnode(), but this implementation was written before we had a requirement that this app should be multi-node.

我仍然认为某些uuid版本是正确的答案,但是我似乎无法弄清楚如何验证传入的uuid值.

I still think that some uuid version is the right answer, but I can't seem to figure out how to validate an incoming uuid value.

>>> received = uuid.uuid5(uuid.NAMESPACE_URL, 'http://example.org')
>>> received
UUID('c57c6902-3774-5f11-80e5-cf09f92b03ac')

是否有某种方法可以验证received是由'http://example.org'生成的?

Is there some way to validate that received was generated with 'http://example.org'?

  1. uuid完全是正确的方法吗?如果没有,那是什么?
  2. 如果是这样,我什至应该在这里使用uuid5吗?

推荐答案

如果目标仅仅是在节点上创建唯一值,那么您不能给每个节点一个唯一的名称,并将其附加到要生成的uuid上?

If the goal is purely to create a unique value across your nodes couldn't you just give each node a unique name and append that to the uuid you are generating?

如果出于安全原因而尝试这样做,或者只是希望在节点上保证唯一值,对我来说还是不清楚的.

Wasn't clear to me if you are trying to do this for security reasons or you simply just want a guaranteed unique value across the nodes.

这篇关于如何证明某些数据来自我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆