<PackageReference Include="System.Security.Cryptography.Pkcs" Version="11.0.0-preview.6.26359.118" />

System.Security.Cryptography.Pkcs.Pkcs12Builder

public sealed class Pkcs12Builder
Enables the creation of PKCS#12 PFX data values. This class cannot be inherited.
public bool IsSealed { get; }

Gets a value that indicates whether the PFX data has been sealed.

public Pkcs12Builder()

Initializes a new value of the Pkcs12Builder class.

public void AddSafeContentsEncrypted(Pkcs12SafeContents safeContents, byte[] passwordBytes, PbeParameters pbeParameters)

Add contents to the PFX in an bundle encrypted with a byte-based password from a byte array.

public void AddSafeContentsEncrypted(Pkcs12SafeContents safeContents, ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)

Add contents to the PFX in an bundle encrypted with a byte-based password from a span.

public void AddSafeContentsEncrypted(Pkcs12SafeContents safeContents, string password, PbeParameters pbeParameters)

Add contents to the PFX in an bundle encrypted with a char-based password from a string.

public void AddSafeContentsEncrypted(Pkcs12SafeContents safeContents, ReadOnlySpan<char> password, PbeParameters pbeParameters)

Add contents to the PFX in an bundle encrypted with a char-based password from a span.

Add contents to the PFX without encrypting them.

public byte[] Encode()

Encodes the contents of a sealed PFX and returns it as a byte array.

public void SealWithMac(string password, HashAlgorithmName hashAlgorithm, int iterationCount)

Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a string.

public void SealWithMac(ReadOnlySpan<char> password, HashAlgorithmName hashAlgorithm, int iterationCount)

Seals the PFX against further changes by applying a password-based Message Authentication Code (MAC) over the contents with a password from a span.

public void SealWithoutIntegrity()

Seals the PFX from further changes without applying tamper-protection.

public bool TryEncode(Span<byte> destination, out int bytesWritten)

Attempts to encode the contents of a sealed PFX into a provided buffer.