gpt4 book ai didi

c# - 如何从 SSL key 文件创建 RsaSecurityKey 实例

转载 作者:行者123 更新时间:2023-11-30 15:57:47 28 4
gpt4 key购买 nike

我有一个 RSA 私钥,其格式如 RFC 7468 中所述我正在使用的库需要 SecurityKey 的实例,但似乎没有一个构造函数接受这种格式的字符串,它的构造函数接受的任何参数似乎也不接受这种格式。

最佳答案

Found a Library that handles PEM Keys in .Net , 如果您同时包含 DerConverter 和 PemUtils,您可以简单地读取文件:

RsaSecurityKey key;
using (var stream = File.OpenRead(path))
using (var reader = new PemReader(stream))
{
key = new RsaSecurityKey(reader.ReadRsaKey());
// ...
}

关于c# - 如何从 SSL key 文件创建 RsaSecurityKey 实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44585859/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com