Casper.Network.SDK
Show / Hide Table of Contents

Class PublicKey

A wrapper for a Public Key. Provides signature verification functionality.

Inheritance
object
PublicKey
Implements
IPurseIdentifier
IEntityIdentifier
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Casper.Network.SDK.Types
Assembly: Casper.Network.SDK.dll
Syntax
public class PublicKey : IPurseIdentifier, IEntityIdentifier

Constructors

| Edit this page View Source

PublicKey(byte[], KeyAlgo)

Declaration
protected PublicKey(byte[] rawBytes, KeyAlgo keyAlgorithm)
Parameters
Type Name Description
byte[] rawBytes
KeyAlgo keyAlgorithm

Properties

| Edit this page View Source

KeyAlgorithm

Declaration
public KeyAlgo KeyAlgorithm { get; }
Property Value
Type Description
KeyAlgo
| Edit this page View Source

RawBytes

Byte array without the Key algorithm identifier.

Declaration
public byte[] RawBytes { get; }
Property Value
Type Description
byte[]

Methods

| Edit this page View Source

Equals(object)

Determines whether the specified object is equal to the current object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with the current object.

Returns
Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

Overrides
object.Equals(object)
| Edit this page View Source

FromBytes(byte[])

Creates a PublicKey object from a byte array. First byte in the array must contain the key algorithm identifier.

Declaration
public static PublicKey FromBytes(byte[] bytes)
Parameters
Type Name Description
byte[] bytes
Returns
Type Description
PublicKey
| Edit this page View Source

FromHexString(string)

Creates a PublicKey object from an hexadecimal string (containing the Key algorithm identifier).

Declaration
public static PublicKey FromHexString(string hexBytes)
Parameters
Type Name Description
string hexBytes
Returns
Type Description
PublicKey
| Edit this page View Source

FromPem(string)

Loads a PublicKey from a PEM file

Declaration
public static PublicKey FromPem(string filePath)
Parameters
Type Name Description
string filePath
Returns
Type Description
PublicKey
| Edit this page View Source

FromRawBytes(byte[], KeyAlgo)

Creates a PublicKey object from a byte array and the key algorithm identifier.

Declaration
public static PublicKey FromRawBytes(byte[] rawBytes, KeyAlgo keyAlgo)
Parameters
Type Name Description
byte[] rawBytes
KeyAlgo keyAlgo
Returns
Type Description
PublicKey
| Edit this page View Source

GetAccountHash()

Returns the Account Hash associated to this Public Key.

Declaration
public string GetAccountHash()
Returns
Type Description
string
| Edit this page View Source

GetBytes()

Returns the bytes of the public key, including the Key algorithm as the first byte.

Declaration
public byte[] GetBytes()
Returns
Type Description
byte[]
| Edit this page View Source

GetEntityIdentifier()

Returns an EntityIdentifier object as defined in the RPC schema for a public key.

Declaration
public Dictionary<string, object> GetEntityIdentifier()
Returns
Type Description
Dictionary<string, object>
| Edit this page View Source

GetHashCode()

Serves as the default hash function.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for the current object.

Overrides
object.GetHashCode()
| Edit this page View Source

GetPurseIdentifier()

Returns a PurseIdentifier object as defined in the RPC schema for a public key.

Declaration
public Dictionary<string, object> GetPurseIdentifier()
Returns
Type Description
Dictionary<string, object>
| Edit this page View Source

ToAccountHex()

Returns the key as an hexadecimal string, including the key algorithm in the first position.

Declaration
public string ToAccountHex()
Returns
Type Description
string
| Edit this page View Source

ToString()

Returns a string that represents the current object.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents the current object.

Overrides
object.ToString()
| Edit this page View Source

VerifySignature(byte[], byte[])

Verifies the signature given its value and the original message.

Declaration
public bool VerifySignature(byte[] message, byte[] signature)
Parameters
Type Name Description
byte[] message
byte[] signature
Returns
Type Description
bool
| Edit this page View Source

VerifySignature(string, string)

Verifies the signature given its value and the original message.

Declaration
public bool VerifySignature(string message, string signature)
Parameters
Type Name Description
string message
string signature
Returns
Type Description
bool
| Edit this page View Source

WriteToPem(string)

Saves the public key to a PEM file.

Declaration
public void WriteToPem(string filePath)
Parameters
Type Name Description
string filePath

Operators

| Edit this page View Source

explicit operator string(PublicKey)

Declaration
public static explicit operator string(PublicKey pk)
Parameters
Type Name Description
PublicKey pk
Returns
Type Description
string

Implements

IPurseIdentifier
IEntityIdentifier
  • Edit this page
  • View Source
In this article
Back to top Maintained by MAKE Technology LLC