Skip to content

OnixLabs.Security.Cryptography.IPrivateKeyRawImportable

matthew edited this page May 27, 2026 · 1 revision

IPrivateKeyRawImportable<T> Interface

Defines a cryptographic private key that can be imported from its raw binary form.

Namespace OnixLabs.Security.Cryptography
Assembly OnixLabs.Security.Cryptography.dll (NuGet)

Definition

public interface IPrivateKeyRawImportable<out T> where T : PrivateKey

Type Parameters

Parameter Description
T The type of PrivateKey returned by the static import members. Declared covariant (out T). Must derive from PrivateKey.

Remarks

IPrivateKeyRawImportable<T> defines the raw binary import contract. The input data is the algorithm-specific raw key material without any wrapping structure. Overloads that include an out int bytesRead parameter report how many bytes were consumed from the input span, which is useful when importing from a larger buffer. All members are declared static abstract and are called on the concrete type.

This interface is composed into IPrivateKeyImportable<T> and is also implemented directly by IEddsaPrivateKey.

Methods

Member Returns Description
Import(ReadOnlySpan<byte>) T Imports raw key bytes from a span.
Import(ReadOnlySpan<byte>, out int) T Imports raw key bytes from a span; reports bytes read.
Import(IBinaryConvertible) T Imports raw key bytes from an IBinaryConvertible.
Import(IBinaryConvertible, out int) T Imports raw key bytes from an IBinaryConvertible; reports bytes read.

Import overloads

public static abstract T Import(ReadOnlySpan<byte> data);
public static abstract T Import(ReadOnlySpan<byte> data, out int bytesRead);
public static abstract T Import(IBinaryConvertible data);
public static abstract T Import(IBinaryConvertible data, out int bytesRead);

Imports a cryptographic private key from its raw binary representation.

Parameter Type Description
data ReadOnlySpan<byte> or IBinaryConvertible The raw private key data to import.
bytesRead out int (bytesRead overloads) Receives the number of bytes consumed from data.

Returns — A new T instance containing the imported private key.

See Also

ONIXLabs .NET Library


Clone this wiki locally