Class KeyPair
A Private key. Provides signing functionality.
Assembly: Casper.Network.SDK.dll
Syntax
Properties
|
Edit this page
View Source
PublicKey
The public key derived from the private key.
Declaration
public PublicKey PublicKey { get; }
Property Value
|
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
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
|
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
|
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
|
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
|
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
|
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 |
|