<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.0" />

Org.BouncyCastle.Security.PrivateKeyFactory

public static class PrivateKeyFactory
namespace Org.BouncyCastle.Security { public static class PrivateKeyFactory { public static AsymmetricKeyParameter CreateKey(byte[] privateKeyInfoData); public static AsymmetricKeyParameter CreateKey(Stream inStr); public static AsymmetricKeyParameter CreateKey(PrivateKeyInfo keyInfo); public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, EncryptedPrivateKeyInfo encInfo); public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, byte[] encryptedPrivateKeyInfoData); public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, Stream encryptedPrivateKeyInfoStream); public static byte[] EncryptKey(DerObjectIdentifier algorithm, char[] passPhrase, byte[] salt, int iterationCount, AsymmetricKeyParameter key); public static byte[] EncryptKey(string algorithm, char[] passPhrase, byte[] salt, int iterationCount, AsymmetricKeyParameter key); } }