I have a RSA private key in the format as stated in RFC 7468 and a library I'm using requires an instance of SecurityKey none of the constructor's seem to accept strings in this format, nor any of the accepted arguments for it's constructor seem to accept this format.
Found a Library that handles PEM Keys in .Net, If you include both DerConverter and PemUtils you can simply read the file:
RsaSecurityKey key;
using (var stream = File.OpenRead(path))
using (var reader = new PemReader(stream))
{
key = new RsaSecurityKey(reader.ReadRsaKey());
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With