AsymmetricAlgorithm.ImportSubjectPublicKeyInfo 方法

定义

在派生的类中替代时,解密后从 X.509 SubjectPublicKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。

public:
 virtual void ImportSubjectPublicKeyInfo(ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public virtual void ImportSubjectPublicKeyInfo (ReadOnlySpan<byte> source, out int bytesRead);
abstract member ImportSubjectPublicKeyInfo : ReadOnlySpan<byte> * int -> unit
override this.ImportSubjectPublicKeyInfo : ReadOnlySpan<byte> * int -> unit
Public Overridable Sub ImportSubjectPublicKeyInfo (source As ReadOnlySpan(Of Byte), ByRef bytesRead As Integer)

参数

source
ReadOnlySpan<Byte>

ASN.1-DER 编码中的 X.509 SubjectPublicKeyInfo 结构的字节。

bytesRead
Int32

此方法返回时,包含一个指示从 source 中读取的字节数的值。 该参数未经初始化即被处理。

例外

source 的内容不表示 ASN.1-DER 编码的 X.509 SubjectPublicKeyInfo 结构。

- 或 -

source 的内容指示密钥用于此实例表示的算法以外的算法。

- 或 -

source 的内容表示密钥采用的格式不受支持。

- 或 -

特定于算法的密钥导入失败。

派生的类型未替代此成员。

注解

此方法仅支持 SubjectPublicKeyInfo 的二进制 (DER) 编码。 如果值为 Base64 编码或 PEM 文本格式,则调用方在调用此方法之前必须对内容进行 Base64 解码。

由于解释此数据格式的内容需要特定于算法的支持, ImportSubjectPublicKeyInfo 因此默认情况下会引发 NotImplementedException

适用于