[英]How do you create an instance of RsaSecurityKey from a SSL key file
我有一个RSA私钥,其格式如RFC 7468所述,我正在使用的库需要一个SecurityKey
实例,没有一个构造函数似乎接受这种格式的字符串,也没有任何接受的参数为它的构造函数似乎接受这种格式。
Found a Library that handles PEM Keys in .Net , If you include both DerConverter and PemUtils you can simply read the file: 找到一个在.Net中处理PEM密钥的库 ,如果同时包含DerConverter和PemUtils,您只需读取该文件:
RsaSecurityKey key;
using (var stream = File.OpenRead(path))
using (var reader = new PemReader(stream))
{
key = new RsaSecurityKey(reader.ReadRsaKey());
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.