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

Org.BouncyCastle.Pkcs.PrivateKeyInfoFactory

public static class PrivateKeyInfoFactory
A factory to produce PrivateKeyInfo (PKCS#8) objects from Bouncy Castle private key parameters.

Create a PrivateKeyInfo representation of a private key.

public static PrivateKeyInfo CreatePrivateKeyInfo(AsymmetricKeyParameter privateKey, Asn1Set attributes)

Create a PrivateKeyInfo representation of a private key with attributes.

public static PrivateKeyInfo CreatePrivateKeyInfo(char[] passPhrase, EncryptedPrivateKeyInfo encInfo)

Create a PrivateKeyInfo from an encrypted representation using a passphrase.

public static PrivateKeyInfo CreatePrivateKeyInfo(char[] passPhrase, bool wrongPkcs12Zero, EncryptedPrivateKeyInfo encInfo)

Create a PrivateKeyInfo from an encrypted representation using a passphrase.