1

i am using AsymmetricAlgorithm.ImportSubjectPublicKeyInfo(ReadOnlySpan, Int32) Method in .net, what is the equivalent in .net4.61 ?

1 Answers1

0

There isn’t one built in.

BouncyCastle can do it, or you can use the System.Formats.Asn1 library (or any other DER library) to read the key. For RSA, it’s fairly straightforward: https://stackoverflow.com/a/54011211/6535399

For DSA it’s just different, for ECC (ECDSA/ECDH) it’s harder because the key structure is more complicated.

bartonjs
  • 30,352
  • 2
  • 71
  • 111