แก้ไข

แชร์ผ่าน


RSA.ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) Method

Definition

Imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object.

public:
 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)

Parameters

source
ReadOnlySpan<Byte>

The bytes of a PKCS#8 PrivateKeyInfo structure in the ASN.1-BER encoding.

bytesRead
Int32

When this method returns, contains a value that indicates the number of bytes read from source. This parameter is treated as uninitialized.

Exceptions

The contents of source do not represent an ASN.1-BER-encoded PKCS#8 PrivateKeyInfo structure.

-or-

The contents of source indicate the key is for an algorithm other than the algorithm represented by this instance.

-or-

The contents of source represent the key in a format that is not supported.

-or-

The algorithm-specific key import failed.

Remarks

This method only supports the binary (BER/CER/DER) encoding of PrivateKeyInfo. If the value is Base64-encoded or in the PEM text format, the caller must Base64-decode the contents before calling this method.

Applies to