ECAlgorithm.ImportEncryptedPkcs8PrivateKey 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32) |
使用基于字节的密码解密后,从 PKCS#8 EncryptedPrivateKeyInfo 结构导入公钥/私钥对,替换此对象的密钥。 |
| ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32) |
使用基于字节的密码解密后,从 PKCS#8 EncryptedPrivateKeyInfo 结构导入公钥/私钥对,替换此对象的密钥。 |
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
使用基于字节的密码解密后,从 PKCS#8 EncryptedPrivateKeyInfo 结构导入公钥/私钥对,替换此对象的密钥。
public:
override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<System::Byte> passwordBytes, ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source, out int bytesRead);
override this.ImportEncryptedPkcs8PrivateKey : ReadOnlySpan<byte> * ReadOnlySpan<byte> * int -> unit
Public Overrides Sub ImportEncryptedPkcs8PrivateKey (passwordBytes As ReadOnlySpan(Of Byte), source As ReadOnlySpan(Of Byte), ByRef bytesRead As Integer)
参数
- passwordBytes
- ReadOnlySpan<Byte>
解密密钥材料时用作密码的字节。
- source
- ReadOnlySpan<Byte>
ASN.1-BER 编码中的 PKCS#8 EncryptedPrivateKeyInfo 结构的字节。
- bytesRead
- Int32
此方法返回时,包含一个值,该值指示从 source中读取的字节数。 此参数被视为未初始化。
例外
密码不正确。
-或-
指示要应用的密钥派生函数(KDF)的内容 source 是需要基于密码的旧 PKCS#12 KDF char。
-或-
不表示 ASN.1-BER 编码的 PKCS#8 EncryptedPrivateKeyInfo 结构的内容 source 。
-或-
指示密钥的内容 source 适用于此实例表示的算法以外的算法。
-或-
以不支持的格式表示键的内容 source 。
-或-
特定于算法的密钥导入失败。
派生类尚未为 ImportParameters(ECParameters)该类提供实现。
注解
密码字节将直接传递到 EncryptedPrivateKeyInfo 内容所指示的算法使用的密钥派生函数(KDF)。 这可实现与其他使用 UTF-8 以外的文本编码(使用 PBKDF2 处理密码(Password-Based 密钥派生函数 2)时使用文本编码的其他系统兼容。
This method only supports the binary (BER/CER/DER) encoding of EncryptedPrivateKeyInfo.
If the value is Base64-encoded, the caller must Base64-decode the contents before calling this method.
If the contents are PEM-encoded, <xref:System.Security.Cryptography.ECAlgorithm.ImportFromEncryptedPem(System.ReadOnlySpan{System.Char},System.ReadOnlySpan{System.Byte})>
should be used.
适用于
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
- Source:
- ECAlgorithm.cs
使用基于字节的密码解密后,从 PKCS#8 EncryptedPrivateKeyInfo 结构导入公钥/私钥对,替换此对象的密钥。
public:
override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public override void ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source, out int bytesRead);
override this.ImportEncryptedPkcs8PrivateKey : ReadOnlySpan<char> * ReadOnlySpan<byte> * int -> unit
Public Overrides Sub ImportEncryptedPkcs8PrivateKey (password As ReadOnlySpan(Of Char), source As ReadOnlySpan(Of Byte), ByRef bytesRead As Integer)
参数
- password
- ReadOnlySpan<Char>
解密密钥材料时要使用的密码。
- source
- ReadOnlySpan<Byte>
ASN.1-BER 编码中的 PKCS#8 EncryptedPrivateKeyInfo 结构的字节。
- bytesRead
- Int32
此方法返回时,包含一个值,该值指示从 source中读取的字节数。 此参数被视为未初始化。
例外
不表示 ASN.1-BER 编码的 PKCS#8 EncryptedPrivateKeyInfo 结构的内容 source 。
-或-
指示密钥的内容 source 适用于此实例表示的算法以外的算法。
-或-
以不支持的格式表示键的内容 source 。
-或-
特定于算法的密钥导入失败。
派生类尚未为 ImportParameters(ECParameters)该类提供实现。
注解
当指示使用 PBKDF1(Password-Based 密钥派生函数 1)或 PBKDF2(Password-Based 密钥派生函数 2)的算法的内容 source 时,密码将通过 UTF-8 编码转换为字节。
This method only supports the binary (BER/CER/DER) encoding of EncryptedPrivateKeyInfo.
If the value is Base64-encoded, the caller must Base64-decode the contents before calling this method.
If the contents are PEM-encoded, <xref:System.Security.Cryptography.ECAlgorithm.ImportFromEncryptedPem(System.ReadOnlySpan{System.Char},System.ReadOnlySpan{System.Char})>
should be used.