Muokkaa

Jaa


Pkcs12Builder.AddSafeContentsEncrypted Method

Definition

Overloads

AddSafeContentsEncrypted(Pkcs12SafeContents, Byte[], PbeParameters)

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

AddSafeContentsEncrypted(Pkcs12SafeContents, ReadOnlySpan<Byte>, PbeParameters)

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

AddSafeContentsEncrypted(Pkcs12SafeContents, ReadOnlySpan<Char>, PbeParameters)

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

AddSafeContentsEncrypted(Pkcs12SafeContents, String, PbeParameters)

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

AddSafeContentsEncrypted(Pkcs12SafeContents, Byte[], PbeParameters)

Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs

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

public:
 void AddSafeContentsEncrypted(System::Security::Cryptography::Pkcs::Pkcs12SafeContents ^ safeContents, cli::array <System::Byte> ^ passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, byte[]? passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, byte[] passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
member this.AddSafeContentsEncrypted : System.Security.Cryptography.Pkcs.Pkcs12SafeContents * byte[] * System.Security.Cryptography.PbeParameters -> unit
Public Sub AddSafeContentsEncrypted (safeContents As Pkcs12SafeContents, passwordBytes As Byte(), pbeParameters As PbeParameters)

Parameters

safeContents
Pkcs12SafeContents

The contents to add to the PFX.

passwordBytes
Byte[]

The byte array to use as a password when encrypting the contents.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the contents.

Exceptions

The safeContents or pbeParameters parameter is null.

The safeContents parameter value is already encrypted.

The PFX is already sealed (IsSealed is true).

pbeParameters indicates that TripleDes3KeyPkcs12 should be used, which requires Char-based passwords.

Remarks

The password bytes are passed directly into the Key Derivation Function (KDF) used by the algorithm indicated by pbeParameters. This enables compatibility with other systems which use a text encoding other than UTF-8 when processing passwords with PBKDF2 (Password-Based Key Derivation Function 2).

The contents of safeContents are read during the call to this method, encrypted, and stored internally as encrypted content. Any changes to the Pkcs12SafeContents or any Pkcs12SafeBag it references made after this method call are not reflected in the final output.

Applies to

AddSafeContentsEncrypted(Pkcs12SafeContents, ReadOnlySpan<Byte>, PbeParameters)

Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs

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

public:
 void AddSafeContentsEncrypted(System::Security::Cryptography::Pkcs::Pkcs12SafeContents ^ safeContents, ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
member this.AddSafeContentsEncrypted : System.Security.Cryptography.Pkcs.Pkcs12SafeContents * ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters -> unit
Public Sub AddSafeContentsEncrypted (safeContents As Pkcs12SafeContents, passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters)

Parameters

safeContents
Pkcs12SafeContents

The contents to add to the PFX.

passwordBytes
ReadOnlySpan<Byte>

The byte span to use as a password when encrypting the contents.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the contents.

Exceptions

The safeContents or pbeParameters parameter is null.

The safeContents parameter value is already encrypted.

The PFX is already sealed (IsSealed is true).

pbeParameters indicates that TripleDes3KeyPkcs12 should be used, which requires Char-based passwords.

Remarks

The password bytes are passed directly into the Key Derivation Function (KDF) used by the algorithm indicated by pbeParameters. This enables compatibility with other systems which use a text encoding other than UTF-8 when processing passwords with PBKDF2 (Password-Based Key Derivation Function 2).

The contents of safeContents are read during the call to this method, encrypted, and stored internally as encrypted content. Any changes to the Pkcs12SafeContents or any Pkcs12SafeBag it references made after this method call are not reflected in the final output.

Applies to

AddSafeContentsEncrypted(Pkcs12SafeContents, ReadOnlySpan<Char>, PbeParameters)

Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs

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

public:
 void AddSafeContentsEncrypted(System::Security::Cryptography::Pkcs::Pkcs12SafeContents ^ safeContents, ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters);
member this.AddSafeContentsEncrypted : System.Security.Cryptography.Pkcs.Pkcs12SafeContents * ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters -> unit
Public Sub AddSafeContentsEncrypted (safeContents As Pkcs12SafeContents, password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters)

Parameters

safeContents
Pkcs12SafeContents

The contents to add to the PFX.

password
ReadOnlySpan<Char>

The span to use as a password when encrypting the contents.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the contents.

Exceptions

The safeContents or pbeParameters parameter is null.

The safeContents parameter value is already encrypted.

The PFX is already sealed (IsSealed is true).

Remarks

When pbeParameters indicates an algorithm that uses PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.

The contents of safeContents are read during the call to this method, encrypted, and stored internally as encrypted content. Any changes to the Pkcs12SafeContents or any Pkcs12SafeBag it references made after this method call are not reflected in the final output.

Applies to

AddSafeContentsEncrypted(Pkcs12SafeContents, String, PbeParameters)

Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs
Source:
Pkcs12Builder.cs

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

public:
 void AddSafeContentsEncrypted(System::Security::Cryptography::Pkcs::Pkcs12SafeContents ^ safeContents, System::String ^ password, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, string? password, System.Security.Cryptography.PbeParameters pbeParameters);
public void AddSafeContentsEncrypted (System.Security.Cryptography.Pkcs.Pkcs12SafeContents safeContents, string password, System.Security.Cryptography.PbeParameters pbeParameters);
member this.AddSafeContentsEncrypted : System.Security.Cryptography.Pkcs.Pkcs12SafeContents * string * System.Security.Cryptography.PbeParameters -> unit
Public Sub AddSafeContentsEncrypted (safeContents As Pkcs12SafeContents, password As String, pbeParameters As PbeParameters)

Parameters

safeContents
Pkcs12SafeContents

The contents to add to the PFX.

password
String

The string to use as a password when encrypting the contents.

pbeParameters
PbeParameters

The password-based encryption (PBE) parameters to use when encrypting the contents.

Exceptions

The safeContents or pbeParameters parameter is null.

The safeContents parameter value is already encrypted.

The PFX is already sealed (IsSealed is true).

Remarks

When pbeParameters indicates an algorithm that uses PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.

The contents of safeContents are read during the call to this method, encrypted, and stored internally as encrypted content. Any changes to the Pkcs12SafeContents or any Pkcs12SafeBag it references made after this method call are not reflected in the final output.

Applies to