SubtleCrypto API是否支持一种算法加密和一起签名?(Does SubtleCrypto API support in one algorithm encryption and signi

编程入门 行业动态 更新时间:2024-10-18 16:42:39
SubtleCrypto API是否支持一种算法加密和一起签名?(Does SubtleCrypto API support in one algorithm encryption and signing together?)

我整天研究了Mozilla 的SubtleCrypto文档,并且无法使用一个版本的RSA密钥找到同时进行加密和签名的方法。

我很困惑,因为我能够用Java编写代码来完成这项工作 。 Java在这里是疯狂的东西,我找不到正确的方法,还是只是没有在SubtleCrypto中实现?

I study the whole day the documentation of SubtleCrypto at Mozilla and was not able to find a way to do encryption and signing at the same time with one version of an RSA key.

I'am confused because I was able to write code in Java to do this job. Does Java here crazy stuff, does I not find the right way or is it just not implemented in the SubtleCrypto?

最满意答案

一些非对称算法会泄漏有关它们的详细信息,具体取决于它们的使用方式。 出于这个原因,Webcrypto的作者决定通过防止这种情况“帮助防止用户伤害自己”。

并非所有算法都具有此属性,例如,基于EC-Schnorr的算法没有(Curve25519就是这样一个例子),表示这不是Web Crypto目前支持的算法。

可以导出密钥并将其重新导入为另一种类型,这可以解决可导出密钥的这一限制。 也就是说,如果您使用的是secp256r1或其家庭成员,则应使用唯一密钥并以加密方式将它们绑定到同一主题,而不是使用一个密钥。

Some asymmetric algorithms will leak details about them, depending on how they are used. For this reason, the Webcrypto authors decided to "help keep users from hurting themselves" by preventing this.

Not all algorithms have this property, for example, ones based on EC-Schnorr do not (Curve25519 is such an example) that said this is not an algorithm supported by Web Crypto at this time.

It is possible to export a key and re-import it as another type, this does work around this restriction for exportable keys. That said you should use a unique key and cryptographically bind them to the same subject instead of using one key if you are using secp256r1 or its family members.

更多推荐

本文发布于:2023-08-04 12:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1416043.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   API   SubtleCrypto   support   signing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!