How can I prove that some data came from my app?

白昼怎懂夜的黑 提交于 2019-12-22 12:23:25

问题


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.

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.

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')

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

  1. Is uuid the right approach at all? If not, what is?
  2. If so, should I even be using uuid5 here?

回答1:


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.



来源:https://stackoverflow.com/questions/11568324/how-can-i-prove-that-some-data-came-from-my-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!