Class PublicKey
A wrapper for a Public Key. Provides signature verification functionality.
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
|
Edit this page
View Source
RawBytes
Byte array without the Key algorithm identifier.
Declaration
public byte[] RawBytes { get; }
Property Value
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
|
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
|
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
|
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
|
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
Returns
|
Edit this page
View Source
GetAccountHash()
Returns the Account Hash associated to this Public Key.
Declaration
public string GetAccountHash()
Returns
|
Edit this page
View Source
GetBytes()
Returns the bytes of the public key, including the Key algorithm as the first byte.
Declaration
Returns
|
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
|
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
|
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
|
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
|
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
|
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
|
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
Returns
|
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
Returns
Implements