簡體   English   中英

如何從SSL密鑰文件創建RsaSecurityKey實例

[英]How do you create an instance of RsaSecurityKey from a SSL key file

我有一個RSA私鑰,其格式如RFC 7468所述,我正在使用的庫需要一個SecurityKey實例,沒有一個構造函數似乎接受這種格式的字符串,也沒有任何接受的參數為它的構造函數似乎接受這種格式。

找到一個在.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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM