将Google KMS签名从DER-编码格式转换为.NET IEEE 1363格式

发布于 2025-01-19 01:22:32 字数 98 浏览 2 评论 0原文

我想使用 C# 将 DER 编码格式的签名(我从 google KMS 服务获得)转换为 IEEE 1363 格式(为了验证签名) 在 C#、.Net Core 5 中是如何完成的?

I would like to convert signature in DER-encoded format (which I get from google KMS service) to IEEE 1363 format using C# (in order to validate the signature)
How it is done in C#, .Net Core 5 ?

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

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

发布评论

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

评论(1

总攻大人 2025-01-26 01:22:32

从 .NET 5 开始,ECDSA 签名支持 ASN.1/DER 和 IEEE P1363 格式,请参见例如 SignData()VerifyData() (类似SignHash()VerifyHash())。

格式规范可以通过 DSASignatureFormat 其值为 IeeeP1363FixedFieldConcatenation (IEEE P1363) 和Rfc3279DerSequence (ASN.1/DER)。默认为 IEEE P1363。

对于其他版本,可以应用 C#/BouncyCastle。

如果您想直接转换签名,最简单的方法是使用 ASN.1 解析器(例如来自 C#/BouncyCastle)。

Since .NET 5, both the ASN.1/DER and the IEEE P1363 formats are supported for ECDSA signatures, see e.g. SignData() and VerifyData() (similarly SignHash() and VerifyHash()).

A specification of the format is possible with DSASignatureFormat with the values IeeeP1363FixedFieldConcatenation (IEEE P1363) and Rfc3279DerSequence (ASN.1/DER). Default is IEEE P1363.

For other versions C#/BouncyCastle can be applied.

If you want to convert the signatures directly, the easiest way is to use an ASN.1 parser (e.g. from C#/BouncyCastle).

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