ECAlgorithm.ImportECPrivateKey(ReadOnlySpan<Byte>, Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
Parameters
- source
- ReadOnlySpan<Byte>
The bytes of an ECPrivateKey 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
A derived class has not provided an implementation for ImportParameters(ECParameters).
The contents of source
do not represent an
ASN.1-BER-encoded PKCS#8 ECPrivateKey structure.
-or-
The key import failed.
Remarks
This method only supports the binary (BER/CER/DER) encoding of ECPrivateKey. If the value is Base64-encoded, the caller must Base64-decode the contents before calling this method. If the value is PEM-encoded, ImportFromPem(ReadOnlySpan<Char>) should be used.