有没有可以演示非对称加密原理的物理锁?

发布于 2024-08-20 13:19:21 字数 108 浏览 6 评论 0原文

我希望使用现实世界的锁来演示非对称加密。例如,我想在一张纸上写下一个秘密,并将其存放在一个上锁的盒子里。我可以购买一把带有两把钥匙的锁,一把只能锁,另一把解锁锁吗?

I wish to demonstrate asymmetric encryption using real-world locks. For example, I want to write a secret on a piece of paper and deposit it in a locked box. Is there a lock I can buy that comes with two keys, one that only locks the lock and another that only unlocks the lock?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

空名 2024-08-27 13:19:21

通常的例子是一把挂锁和一把钥匙。

鲍勃给了爱丽丝一把挂锁(他的“公钥”),他保留了该挂锁的钥匙(他的“私钥”)。

爱丽丝将一条消息放入一个盒子中,然后将挂锁锁在盒子上。然后她把盒子寄给鲍勃。

鲍勃可以用他的钥匙解锁它。

其扩展版本在 https://web.archive.org/web/20130708131404/http://www.economicexpert.com/a/Ametry:key:algorithm.html

The usual example is a padlock and a key for it.

Bob gives Alice a padlock (his "public key") and he keeps the key for that padlock (his "private key").

Alice puts a message in a box, and snaps the padlock on to it. She then sends the box to Bob.

Bob can unlock it with his key.

An extended version of this is described at https://web.archive.org/web/20130708131404/http://www.economicexpert.com/a/Asymmetric:key:algorithm.html

情释 2024-08-27 13:19:21

我喜欢大卫的回答,但我想我应该提到我已经看到这被证明是一个安全示例 - 原因是没有办法确保爱丽丝收到了鲍勃的挂锁已发送(夏娃可以在运输过程中将其交换为不同的挂锁)

然后演示转向一个带有一个盒子和两个挂锁的示例,该示例显然是安全的...

爱丽丝将消息放入盒子内并用她的挂锁(公钥)将其锁定挂锁)
将盒子发送给收件人(鲍勃)

鲍勃添加了另一个挂锁(私钥挂锁)
将盒子发送回 Alice,

Alice 移除了公钥挂锁(用她的钥匙),这意味着该包现在仅受私钥保护。

爱丽丝将盒子归还给鲍勃,鲍勃现在可以使用私钥解锁。

为了增加效果,你可以让夏娃来回传递盒子,并表明夏娃在任何时候都不能进入盒子。这是一个很好的物理示例,并且易于理解,可以显示包裹在所有方面都是安全的。

I like David's answer, but just thought I'd mention that I've seen that demonstrated as a bad example of security - the reasoning was that there was no way to ensure that Alice received the padlock that Bob sent (Eve could swap it for a different padlock in transit)

The demonstration then moved on to an example with one box and two padlocks, which was demonstratively secure...

Alice puts message inside the box and locks it with her padlock (public key padlock)
Sends box to recipient (Bob)

Bob adds another padlock (private key padlock)
Sends box back to Alice

Alice removes the public key padlock (with her key), meaning the package is now protected only by the private key.

Alice returns box to Bob who can now unlock with the private key.

For added effect you can have an Eve passing the boxes back and forth and showing that at no point can Eve get into the box. Its a great physical example, and easily understandable to showing the package is secure at all points.

巴黎夜雨 2024-08-27 13:19:21

使用带有两扇门和两把不同锁的盒子。安排盒子的内部结构,使其以一种方式工作,类似于街角邮箱。

或者,查看盒子加挂锁的组合作为加密密钥。您可以通过 1) 一个盒子,2) 挂锁,3) 在盒子里放入一些东西并锁定它来构造一条消息。该挂锁的物理密钥就是解密密钥,这符合该模型,因为加密密钥无法解锁消息。

Use a box with two doors and two different locks. Arrange the internals of the box so it works one way, similar to a street corner mailbox.

Alternatively, view the box plus padlock combination as the encryption key. You construct a message by getting 1) a box, 2) padlock, 3) putting something in the box and locking it. The physical key for that padlock is then the decryption key, which fits the model since the encryptoin key can't unlock the message.

那请放手 2024-08-27 13:19:21

魔法锁应该有两把钥匙(假设它们是 key1 和 key2)。

如果您使用 key1 锁定它,那么您无法使用 key1 解锁它。

如果您使用 key2 锁定它,那么您无法使用 key2 解锁它。

如果您使用 key1 锁定它,那么您必须使用 key2 解锁它。

如果您使用 key2 锁定它,那么您必须使用 key1 解锁它。

所以,如果我用 key1 锁,那么其他人也会用 key2 锁。然后他可以用key2锁上它,我就可以用key1打开它。

让我们更进一步。让我们制作 1000 个 key2 副本并公开分发。现在任何人都可以拿着钥匙2(包括小偷和骗子)并锁上盒子,只有我用钥匙1才能打开它。这将为我们保密。

现在,如果我用 key1 锁定一条消息,那么 1000 个(包括小偷和骗子)人可以用 key2 打开它。因此,保密性就被抛之脑后了。那么为什么有人想要这样做呢?嗯,它给了我们真实性。我的意思是,如果你能用 key2 打开盒子,那么里面的信息肯定是我写的,因为只有我有 key1。

在加密世界中,我们将 key1 称为私钥,将 key2 称为公钥
这些密钥在数学上是相互关联的。更准确地说,这两个密钥都是用一个有很多解的方程创建的。只有找到答案才能解锁。现在,key1有足够的提示来获得key2的解,而key2也有足够的提示来获得key1的解。

简而言之,这就是非对称加密。

The magical lock should have two keys (let's assume they are key1 and key2).

If you lock it with key1 then you can not unlock it with key1.

If you lock it with key2 then you can not unlock it with key2.

If you lock it with key1 then you have to unlock it with key2.

If you lock it with key2 then you have to unlock it with key1.

So, if i lock with key1, then the other person will lock with key2. Then he can lock it with key2, and i will be able to open it with key1.

Let's take one step further. Let us make 1000 copy of key2 and distribute it publicly. Now anyone can take key2 (including thieves and cheats) and lock the box and only me with key1 can open it. This will give us confidentiality.

Now, if i lock a message with key1 then 1000 (including thieves and cheats) people can open it with key2. So, confidentiality goes out the window. Then why would anyone want to do that? Well, it gives us authenticity. I mean, If you were able to open the box with key2, then the message inside was definitely by me as only I have key1.

In encryption world we call key1 private key and key2 public key.
The keys are mathematically linked to each other. To be a little more precise, both keys are created with a equation which has lots of solutions. You can only unlock if you can get the solution. Now, key1 has enough hints to get the solution of key2, and key2 has enough hints to get the solution of key1.

That is Asymmetric Encryption in a nutshell.

月依秋水 2024-08-27 13:19:21

如果您想更进一步,请查看CoreStreet 的智能卡锁产品。这是他们的事。

If you want to take it a step further, check out CoreStreet's smart card lock products. This is their business.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文