AsymmetricAlgorithm.ExportEncryptedPkcs8PrivateKeyPem 方法

定义

重载

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

使用基于字符的密码(PEM 编码)导出 PKCS#8 EncryptedPrivateKeyInfo 格式的当前密钥。

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

使用基于字节的密码(PEM 编码)导出 PKCS#8 EncryptedPrivateKeyInfo 格式的当前密钥。

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

使用基于字符的密码(PEM 编码)导出 PKCS#8 EncryptedPrivateKeyInfo 格式的当前密钥。

public:
 System::String ^ ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem (ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters);
member this.ExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters -> string
Public Function ExportEncryptedPkcs8PrivateKeyPem (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters) As String

参数

password
ReadOnlySpan<Char>

加密密钥材料时使用的密码。

pbeParameters
PbeParameters

加密密钥材料时使用的基于密码加密 (PBE) 参数。

返回

包含 PEM 编码的 PKCS#8 EncryptedPrivateKeyInfo 的字符串。

例外

未能导出密钥。

注解

pbeParameters 指示使用 PBKDF2 (基于密码的密钥派生函数 2) 的算法时,密码将通过 UTF-8 编码转换为字节。

          A PEM-encoded PKCS#8 EncryptedPrivateKeyInfo will begin with
         `-----BEGIN ENCRYPTED PRIVATE KEY-----` and end with
         `-----END ENCRYPTED PRIVATE KEY-----`, with the base64 encoded DER
          contents of the key between the PEM boundaries.

          The PEM is encoded according to the IETF RFC 7468 "strict" encoding rules.

适用于

ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

Source:
AsymmetricAlgorithm.cs
Source:
AsymmetricAlgorithm.cs

使用基于字节的密码(PEM 编码)导出 PKCS#8 EncryptedPrivateKeyInfo 格式的当前密钥。

public:
 System::String ^ ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem (ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters);
member this.ExportEncryptedPkcs8PrivateKeyPem : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters -> string
Public Function ExportEncryptedPkcs8PrivateKeyPem (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters) As String

参数

passwordBytes
ReadOnlySpan<Byte>

加密密钥材料时用作密码的字节。

pbeParameters
PbeParameters

加密密钥材料时使用的基于密码加密 (PBE) 参数。

返回

包含 PEM 编码的 PKCS#8 EncryptedPrivateKeyInfo 的字符串。

例外

未能导出密钥。

注解

PEM 编码的 PKCS#8 EncryptedPrivateKeyInfo 以 开头 -----BEGIN ENCRYPTED PRIVATE KEY----- ,以 -----END ENCRYPTED PRIVATE KEY-----结尾,PEM 边界之间密钥的 base64 编码 DER 内容。

PEM 根据 IETF RFC 7468“严格”编码规则进行编码。

适用于