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

Definition

Imports the public key from a PKCS#1 RSAPublicKey structure after decryption, replacing the keys for this object.

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

Parameters

source
ReadOnlySpan<Byte>

The bytes of a PKCS#1 RSAPublicKey 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#1 RSAPublicKey structure.

-or-

The key import failed.

Remarks

This method only supports the binary (BER/CER/DER) encoding of RSAPublicKey. 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