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

Org.BouncyCastle.Pkcs.Pkcs12StoreBuilder

public class Pkcs12StoreBuilder
Fluent builder for Pkcs12Store instances, configuring PBE algorithms and encoding options used when saving PKCS#12 files (RFC 7292).

Creates a builder with library-default PBE algorithms and options.

public Pkcs12Store Build()

Builds a new Pkcs12Store using the configured algorithms and options.

Sets the PBE algorithm used to encrypt certificate bags when saving (PKCS#12 scheme 1).

Sets the PBES2 algorithm and PRF used to encrypt certificate bags when saving (PKCS#12 scheme 2).

public Pkcs12StoreBuilder SetEnableOracleTrustedKeyUsage(bool enableOracleTrustedKeyUsage)

Whether to include Oracle's TrustedKeyUsage attribute in CertBag attributes. Defaults to true.

Sets the PBE algorithm used to encrypt private-key bags when saving (PKCS#12 scheme 1).

Sets the PBES2 algorithm and PRF used to encrypt private-key bags when saving (PKCS#12 scheme 2).

public Pkcs12StoreBuilder SetOverwriteFriendlyName(bool overwriteFriendlyName)

Controls whether SetFriendlyName may replace an existing friendly name. Defaults to true.

public Pkcs12StoreBuilder SetReverseCertificates(bool reverseCertificates)

When true, certificate and key bags are written in reverse insertion order when saving.

public Pkcs12StoreBuilder SetUseDerEncoding(bool useDerEncoding)

When true, saved PKCS#12 structures use DER encoding instead of BER for inner content.