基于共识的信息披露
问题描述
我对以下问题的解决方案感兴趣:
有一些秘密信息 一群n人想要 锁定直到达到最低数量 其中 1<=m<=n 人同意发布它。例如,说所有的名字 小组中的参与者。
我们如何加密这些信息 并向其分发n个“密钥” 该信息保密 永远,除非至少在某个时刻 m提交密钥来解锁信息?
约束
至关重要的是,对于任何k<m(甚至m-1),应该有一个仅使用 k 个密钥成功检索信息的概率极低。同样重要的是,对于任何k>=m,成功的概率应该非常高。
最佳情况下(但不一定),我想要一个具有以下属性的解决方案:
- 功能可扩展(解决任何m,*n*的问题)。
- 速度/内存可扩展(需要合理的时间来加密/解密)。
最初,我认为一个好的解决方案可能只是简单地对信息进行加密并分段分发(私钥)密钥,但我找不到分割密钥的好方法。
特别是,当 m 和 n 都变得非常大时,问题似乎变得更加困难,因为拥有和不拥有之间的界线 >=m > 自愿的小组成员变得越来越瘦(可以这么说)。
如果您知道解决方案,那么向正确的方向推动比完整的答案更好。
Problem description
I am interested in a solution to the following problem:
There is some secret information that
a group of n people would like to
lock away until some minimum number
1<=m<=n of them agrees to release it. For example, say, the names of all
participants in the group.How can we encrypt this information
and distribute n 'keys' to it so
that the information remains private
forever, unless at some point at least
m submit their keys to unlock the information?
Constraints
It is crucial that for any k<m (even m-1), there should be an extremely low probability of successfully retrieving the information with only k keys. Equally crucially, for any k>=m, the probability of success should be extremely high.
And optimally (but not necessarily), I would like a solution that has these properties:
- is functionally scalable (solves problem for any m,*n*).
- is speed/memory scalable (takes a reasonable amount of time to encrypt/decrypt).
Initially, I thought that a good solution might involve simply encrypting the information and giving away the (private) key in pieces, but I can't figure out a good way to split up the key.
In particular, the problem seems to get harder when both m and n become really large, since the line between having and not having >=m willing group member becomes thinner and thinner (so to speak).
If you know a solution, a nudge in the right direction would be preferable to a complete answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于密钥分割,请查找Shamir 的秘密共享。这是一种经典方法(1979 年发表)。
For key splitting, look up Shamir's Secret Sharing. This is a classical method (published in 1979).
您可以使用基于 XOR 的拆分,其工作原理如下:
您提供所需的碎片数 - n 和密钥 - K。要生成 n 个密钥,您需要创建 (n – 1) 个随机数:R1、R2、R3、。 。 。 ,Rn−1。为此,您可以使用 SecureRandom 数字生成器,这将防止我们重复。然后您对这些 Rn-1 件和您的密钥 - K 进行 XOR 函数:
Rn = R1 ⊕ R2 ⊕ R3 ⊕ 。 。 。 ⊕ Rn−1 ⊕ K
现在你有了 n 个碎片:R1、R2、R3、…、Rn-1、Rn,你可以销毁 K。这些碎片可以在你的代码中传播或发送给用户。
为了重新组装密钥,我们对 Rn 块使用 XOR 运算:
K = R1 ⊕ R2 ⊕ R3 ⊕ 。 。 。 ⊕ Rn−1 ⊕ Rn
使用 XOR 函数 (⊕),每个片段在密钥重建中本质上都很重要,如果任何片段中的任何位发生更改,则密钥将无法恢复。
有关更多信息,您可以查看我为此目的编写的 Android 实用程序:
GitHub 项目: https://github.com/aivarsda/Secret-Key-Split -Util
此外,您还可以尝试使用该实用程序的 Secret Key Splitter 演示应用程序:
GooglePlay:https://play.google.com/商店/应用/详细信息?id=com.aivarsda.keysplitter
You could use the XOR based splitting, here is how it works:
You provide the required number of pieces - n, and the secret key – K. To generate n pieces of your key, you need to create (n – 1) random numbers: R1, R2, R3, . . . , Rn−1. For that you can use a SecureRandom number generator, which will prevent us from duplicates.Then you operate XOR function on these Rn-1 pieces and your key - K:
Rn = R1 ⊕ R2 ⊕ R3 ⊕ . . . ⊕ Rn−1 ⊕ K
Now you have your n pieces: R1, R2, R3, …, Rn-1, Rn and you may destroy the K. Those pieces can be spread in your code or sent to users.
To reassemble the key, we use XOR operation on our Rn pieces:
K = R1 ⊕ R2 ⊕ R3 ⊕ . . . ⊕ Rn−1 ⊕ Rn
With the XOR function (⊕) each piece is inherently important in the reconstruction of the key, if any bits in any of the pieces are changed, then the key is not recoverable.
For more Info you can take a look at the Android Utility I wrote for that purpose:
GitHub Project: https://github.com/aivarsda/Secret-Key-Split-Util
Also you can try the Secret Key Splitter demo app which uses that Utility :
GooglePlay: https://play.google.com/store/apps/details?id=com.aivarsda.keysplitter