ECDiffieHellman.ImportECPrivateKey(ReadOnlySpan<Byte>, Int32) 方法

定义

从 ECPrivateKey 结构中导入公共/私有密钥对,替换此对象的密钥。Imports the public/private keypair from an ECPrivateKey structure, replacing the keys for this object.

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

参数

source
ReadOnlySpan<Byte>

ASN.1-BER 编码中 ECPrivateKey 结构的字节。The bytes of an ECPrivateKey structure in the ASN.1-BER encoding.

bytesRead
Int32

此方法返回时,包含一个指示从 source 中读取的字节数的值。When this method returns, contains a value that indicates the number of bytes read from source. 该参数未经初始化即被处理。This parameter is treated as uninitialized.

例外

source 的内容不表示 ASN.1-BER 编码的 PKCS#8 ECPrivateKey 结构。The contents of source do not represent an ASN.1-BER-encoded PKCS#8 ECPrivateKey structure.

- 或 --or-

密钥导入失败。The key import failed.

注解

此方法仅支持 ECPrivateKey 的 BER/CER/DER) 编码的二进制 (。This method only supports the binary (BER/CER/DER) encoding of ECPrivateKey. 如果值采用 Base64 编码或 PEM 文本格式,则调用方必须在调用此方法之前对内容进行 Base64 编码。If the value is Base64-encoded or in the PEM text format, the caller must Base64-decode the contents before calling this method.

适用于