Muokkaa

Jaa


Pkcs8PrivateKeyInfo.Encrypt Method

Definition

Overloads

Encrypt(ReadOnlySpan<Byte>, PbeParameters)

Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters.

Encrypt(ReadOnlySpan<Char>, PbeParameters)

Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters.

Encrypt(ReadOnlySpan<Byte>, PbeParameters)

Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs

Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters.

public:
 cli::array <System::Byte> ^ Encrypt(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public byte[] Encrypt (ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
member this.Encrypt : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters -> byte[]
Public Function Encrypt (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters) As Byte()

Parameters

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

Byte[]

A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.

Exceptions

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).

See also

Applies to

Encrypt(ReadOnlySpan<Char>, PbeParameters)

Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs

Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters.

public:
 cli::array <System::Byte> ^ Encrypt(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public byte[] Encrypt (ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters);
member this.Encrypt : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters -> byte[]
Public Function Encrypt (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters) As Byte()

Parameters

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

Byte[]

A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.

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.

See also

Applies to