将Google KMS签名从DER-编码格式转换为.NET IEEE 1363格式
我想使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 .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()
andVerifyData()
(similarlySignHash()
andVerifyHash()
).A specification of the format is possible with
DSASignatureFormat
with the valuesIeeeP1363FixedFieldConcatenation
(IEEE P1363) andRfc3279DerSequence
(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).