Share via

AsymmetricAlgorithm.ImportSubjectPublicKeyInfo Method


When overriden in a derived class, imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object.

 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)



The bytes of an X.509 SubjectPublicKeyInfo structure in the ASN.1-DER encoding.


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


The contents of source do not represent an ASN.1-DER-encoded X.509 SubjectPublicKeyInfo structure.


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


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


The algorithm-specific key import failed.

A derived type has not overriden this member.


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

Because algorithm-specific support is required to interpret the contents of this data format, ImportSubjectPublicKeyInfo throws a NotImplementedException by default.

Applies to