Table of Contents

Class PrivateKey

Namespace
Aptos
Assembly
Aptos.dll
public abstract class PrivateKey : Serializable
Inheritance
PrivateKey
Derived
Inherited Members

Constructors

PrivateKey(PrivateKeyVariant)

protected PrivateKey(PrivateKeyVariant type)

Parameters

type PrivateKeyVariant

Fields

AIP80_PREFIXES

The AIP-80 compliant prefixes for each private key type

public static readonly Dictionary<PrivateKeyVariant, string> AIP80_PREFIXES

Field Value

Dictionary<PrivateKeyVariant, string>

Remarks

Type

public PrivateKeyVariant Type

Field Value

PrivateKeyVariant

Methods

FormatPrivateKey(byte[], PrivateKeyVariant)

Format a HexInput to an AIP-80 compliant string.

public static string FormatPrivateKey(byte[] privateKey, PrivateKeyVariant type)

Parameters

privateKey byte[]

The HexString or byte array format of the private key.

type PrivateKeyVariant

The private key type

Returns

string

AIP-80 compliant string.

Remarks

FormatPrivateKey(string, PrivateKeyVariant)

Format a HexInput to an AIP-80 compliant string.

public static string FormatPrivateKey(string privateKey, PrivateKeyVariant type)

Parameters

privateKey string

The HexString or byte array format of the private key.

type PrivateKeyVariant

The private key type

Returns

string

AIP-80 compliant string.

Remarks

ParseHexInput(byte[], PrivateKeyVariant)

Parse a HexInput that may be a HexString, byte array, or a AIP-80 compliant string to a Hex instance.

public static Hex ParseHexInput(byte[] value, PrivateKeyVariant type)

Parameters

value byte[]

A HexString, byte array, or AIP-80 compliant string.

type PrivateKeyVariant

The private key type

Returns

Hex

A Hex instance.

ParseHexInput(string, PrivateKeyVariant, bool?)

Parse a HexInput that may be a HexString, byte array, or a AIP-80 compliant string to a Hex instance.

public static Hex ParseHexInput(string value, PrivateKeyVariant type, bool? strict = null)

Parameters

value string

A HexString, byte array, or AIP-80 compliant string.

type PrivateKeyVariant

The private key type

strict bool?

If true, the value MUST be compliant with AIP-80. If false, the value MAY be compliant with AIP-80 and ignore warnings.

Returns

Hex

A Hex instance.

PublicKey()

public abstract PublicKey PublicKey()

Returns

PublicKey

Sign(byte[])

public abstract PublicKeySignature Sign(byte[] message)

Parameters

message byte[]

Returns

PublicKeySignature

Sign(string)

public virtual PublicKeySignature Sign(string message)

Parameters

message string

Returns

PublicKeySignature

ToAIP80String()

public virtual string ToAIP80String()

Returns

string

ToByteArray()

public abstract byte[] ToByteArray()

Returns

byte[]

ToHexString()

public virtual string ToHexString()

Returns

string

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.