RSA.ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) 方法


解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。Imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object.

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



以 ASN.1-BER 編碼的 PKCS#8 PrivateKeyInfo 結構位元組。The bytes of a PKCS#8 PrivateKeyInfo structure in the ASN.1-BER encoding.


當此方法傳回時,會包含一個值,指出讀取自 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 PrivateKeyInfo 結構。The contents of source do not represent an ASN.1-BER-encoded PKCS#8 PrivateKeyInfo structure.


source 的內容指出金鑰適用於這個執行個體所表示演算法以外的演算法。The contents of source indicate the key is for an algorithm other than the algorithm represented by this instance.


source 的內容表示金鑰的格式不受支援。The contents of source represent the key in a format that is not supported.


演算法專屬金鑰匯入失敗。The algorithm-specific key import failed.


這個方法只支援 PrivateKeyInfo) 編碼的 binary (BER/CER/DER 編碼。This method only supports the binary (BER/CER/DER) encoding of PrivateKeyInfo. 如果值是 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.