在网页上显示解密的数据,但网页无法读取或保存它

发布于 2025-01-13 09:29:13 字数 192 浏览 4 评论 0原文

我正在尝试解决以下问题:

用户有公钥-私钥对。公钥是已知的,而私钥由用户保密。

网络服务器具有使用用户的公钥加密的数据。

我希望用户能够使用他们的私钥(使用存储私钥的 MetaMask 等浏览器扩展)解密网络服务器数据,然后在网页中向用户显示该数据,同时还阻止网页能够存储该数据。

关于如何做到这一点有什么建议吗?

I'm trying to solve the following problem:

The user has a public-private keypair. The public key is known, while the private key is kept secret by the user.

The webserver has data that was encrypted using the user's public key.

I want the user to be able to decrypt the webserver data using their private key (using a browser extension like MetaMask that has their private key stored), and then display that data to the user in a web page, while also PREVENTING the web page from being able to store that data.

Any suggestions on how this might be done?

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

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

发布评论

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

评论(1

童话 2025-01-20 09:29:13

更新;你确实可以使用 iframe 来做到这一点。事实上,iframe 的安全性令人惊讶。浏览器有效地将 iframe 与其父级分开,反之亦然,即使对于用户来说它们看起来像是同一页面。您可以将私人信息注入网页上受保护的 iframe 中,而无需授予该网页访问数据的权限。这是 Stripe 将信用卡输入字段直接嵌入网站的方法。

Update; you can indeed do this with an iframe. Iframes are surprisingly secure actually. The browser effectively partitions the iframe from its parent, and vice-versa, even though to the user they look like they're the same page to the user. You can inject private information into a protected iframe on a webpage without giving that webpage access to the data. This is the method Stripe uses to embed credit-card entry fields directly into websites.

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