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

System.Security.Cryptography.Pkcs.Pkcs12SafeContents

public sealed class Pkcs12SafeContents
Represents a PKCS#12 SafeContents value. This class cannot be inherited.

Gets a value that indicates the type of encryption applied to the contents.

public bool IsReadOnly { get; }

Gets a value that indicates whether this instance in a read-only state.

Initializes a new instance of the Pkcs12SafeContents class.

Adds a certificate to the SafeContents via a new Pkcs12CertBag and returns the newly created bag instance.

Adds an asymmetric private key to the SafeContents via a new Pkcs12KeyBag and returns the newly created bag instance.

Adds a nested SafeContents to the SafeContents via a new Pkcs12SafeContentsBag and returns the newly created bag instance.

public void AddSafeBag(Pkcs12SafeBag safeBag)

Adds a SafeBag to the SafeContents.

public Pkcs12SecretBag AddSecret(Oid secretType, ReadOnlyMemory<byte> secretValue)

Adds an ASN.1 BER-encoded value with a specified type identifier to the SafeContents via a new Pkcs12SecretBag and returns the newly created bag instance.

public Pkcs12ShroudedKeyBag AddShroudedKey(AsymmetricAlgorithm key, byte[] passwordBytes, PbeParameters pbeParameters)

Adds an encrypted asymmetric private key to the SafeContents via a new Pkcs12ShroudedKeyBag from a byte-based password in an array and returns the newly created bag instance.

public Pkcs12ShroudedKeyBag AddShroudedKey(AsymmetricAlgorithm key, ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)

Adds an encrypted asymmetric private key to the SafeContents via a new Pkcs12ShroudedKeyBag from a byte-based password in a span and returns the newly created bag instance.

public Pkcs12ShroudedKeyBag AddShroudedKey(AsymmetricAlgorithm key, string password, PbeParameters pbeParameters)

Adds an encrypted asymmetric private key to the SafeContents via a new Pkcs12ShroudedKeyBag from a character-based password in a string and returns the newly created bag instance.

Adds an encrypted asymmetric private key to the SafeContents via a new Pkcs12ShroudedKeyBag from a character-based password in a span and returns the newly created bag instance.

public void Decrypt(byte[] passwordBytes)

Decrypts the contents of this SafeContents value using a byte-based password from an array.

public void Decrypt(ReadOnlySpan<byte> passwordBytes)

Decrypts the contents of this SafeContents value using a byte-based password from a span.

public void Decrypt(string password)

Decrypts the contents of this SafeContents value using a character-based password from a string.

public void Decrypt(ReadOnlySpan<char> password)

Decrypts the contents of this SafeContents value using a character-based password from a span.

Gets an enumerable representation of the SafeBag values contained within the SafeContents.