Casper.Network.SDK
Show / Hide Table of Contents

Class KeyPair

A Private key. Provides signing functionality.

Inheritance
object
KeyPair
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Casper.Network.SDK.Types
Assembly: Casper.Network.SDK.dll
Syntax
public class KeyPair

Properties

| Edit this page View Source

PublicKey

The public key derived from the private key.

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

RawBytes

The raw bytes of the private key. For ED25519, the 32-byte seed. For SECP256K1, the 32-byte big-endian unsigned scalar.

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

Methods

| Edit this page View Source

Create(KeyAlgo)

Creates a new key pair with the specified algorithm.

Declaration
public static KeyPair Create(KeyAlgo keyAlgorithm)
Parameters
Type Name Description
KeyAlgo keyAlgorithm
Returns
Type Description
KeyPair
| Edit this page View Source

CreateNew(KeyAlgo)

Declaration
[Obsolete("Use Create() instead.", false)]
public static KeyPair CreateNew(KeyAlgo keyAlgorithm)
Parameters
Type Name Description
KeyAlgo keyAlgorithm
Returns
Type Description
KeyPair
| Edit this page View Source

FromBytes(byte[], KeyAlgo)

Loads a key pair from a raw byte array containing the private key. For ED25519, the 32-byte seed is expected. For SECP256K1, the 32-byte big-endian unsigned scalar is expected.

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

FromPem(string)

Loads a key pair from a PEM file containing a private key.

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

Sign(byte[])

Signs a message and returns the signature.

Declaration
public byte[] Sign(byte[] message)
Parameters
Type Name Description
byte[] message
Returns
Type Description
byte[]
| Edit this page View Source

WritePublicKeyToPem(string)

Saves the public key to a PEM file.

Declaration
public void WritePublicKeyToPem(string filePath)
Parameters
Type Name Description
string filePath
| Edit this page View Source

WriteToPem(string)

Saves the private key to a PEM file.

Declaration
public void WriteToPem(string filePath)
Parameters
Type Name Description
string filePath
  • Edit this page
  • View Source
In this article
Back to top Maintained by MAKE Technology LLC