我有RFC 7468中所述格式的RSA私钥,我使用的库需要SecurityKey
的实例,没有任何构造函数似乎接受字符串在这种格式中,它的构造函数的任何可接受的参数似乎都不接受这种格式。
答案 0 :(得分:3)
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());
// ...
}