Pkcs12SafeContents.AddShroudedKey Method

Definition

Overloads

AddShroudedKey(AsymmetricAlgorithm, String, 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.

AddShroudedKey(AsymmetricAlgorithm, ReadOnlySpan<Char>, PbeParameters)

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.

AddShroudedKey(AsymmetricAlgorithm, Byte[], 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.

AddShroudedKey(AsymmetricAlgorithm, ReadOnlySpan<Byte>, 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.

AddShroudedKey(AsymmetricAlgorithm, String, PbeParameters)

Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs

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.

C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, string? password, System.Security.Cryptography.PbeParameters pbeParameters);
C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, string password, System.Security.Cryptography.PbeParameters pbeParameters);

Parameters

key
AsymmetricAlgorithm

The asymmetric private key to add.

password
String

The password to use when encrypting the key material.

pbeParameters
PbeParameters

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

Returns

The bag instance which was added to the SafeContents.

Exceptions

The key parameter is null.

This instance is read-only.

The key export failed.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddShroudedKey(AsymmetricAlgorithm, ReadOnlySpan<Char>, PbeParameters)

Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs

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.

C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters);

Parameters

key
AsymmetricAlgorithm

The asymmetric private key to add.

password
ReadOnlySpan<Char>

The password to use when encrypting the key material.

pbeParameters
PbeParameters

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

Returns

The bag instance which was added to the SafeContents.

Exceptions

The key parameter is null.

This instance is read-only.

The key export failed.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddShroudedKey(AsymmetricAlgorithm, Byte[], PbeParameters)

Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs

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.

C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, byte[]? passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, byte[] passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);

Parameters

key
AsymmetricAlgorithm

The asymmetric private key to add.

passwordBytes
Byte[]

The bytes to use as a password when encrypting the key material.

pbeParameters
PbeParameters

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

Returns

The bag instance which was added to the SafeContents.

Exceptions

The key parameter is null.

This instance is read-only.

The key export failed.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddShroudedKey(AsymmetricAlgorithm, ReadOnlySpan<Byte>, PbeParameters)

Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs
Source:
Pkcs12SafeContents.cs

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.

C#
public System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag AddShroudedKey(System.Security.Cryptography.AsymmetricAlgorithm key, ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);

Parameters

key
AsymmetricAlgorithm

The asymmetric private key to add.

passwordBytes
ReadOnlySpan<Byte>

The bytes to use as a password when encrypting the key material.

pbeParameters
PbeParameters

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

Returns

The bag instance which was added to the SafeContents.

Exceptions

The key parameter is null.

This instance is read-only.

The key export failed.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10