Class K256KeyGenerator
Derives secp256k1 key families from a seed, as rippled does. Keys are 32-byte big-endian scalars and public keys 33-byte compressed points. A null array throws System.ArgumentNullException.
Inheritance
Namespace: Xrpl.Keypairs.K256
Assembly: Xrpl.Keypairs.dll
Syntax
public class K256KeyGenerator
Methods
| Edit this page View SourceComputePrivateGen(byte[])
The private generator (root private key) of a seed: a 32-byte scalar.
Declaration
public static byte[] ComputePrivateGen(byte[] seedBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | seedBytes |
Returns
| Type | Description |
|---|---|
| byte[] |
ComputePublicGenerator(byte[])
The public generator (public root key) of a private generator: a 33-byte compressed point.
Declaration
public static byte[] ComputePublicGenerator(byte[] privateGen)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | privateGen | secret scalar |
Returns
| Type | Description |
|---|---|
| byte[] |
ComputePublicKey(byte[])
Compute Public Key
Declaration
public static byte[] ComputePublicKey(byte[] secretKey)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | secretKey | The 32-byte private key. |
Returns
| Type | Description |
|---|---|
| byte[] | The 33-byte compressed public key. |
ComputePublicKey(byte[], uint)
The public key of account key accountNumber, derived from the public
generator alone: public generator + scalarĀ·G.
Declaration
public static byte[] ComputePublicKey(byte[] publicGenBytes, uint accountNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | publicGenBytes | |
| uint | accountNumber |
Returns
| Type | Description |
|---|---|
| byte[] | The 33-byte compressed public key. |
ComputeScalar(byte[], uint?)
The first SHA-512Half of seedBytes || [discriminator] || i,
for i from 0, that lies in [1, n-1].
Declaration
public static byte[] ComputeScalar(byte[] seedBytes, uint? discriminator)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | seedBytes |
|
| uint? | discriminator |
|
Returns
| Type | Description |
|---|---|
| byte[] | A 32-byte scalar suitable as a private key. |
ComputeSecretKey(byte[], uint)
Account key accountNumber of a family: a 32-byte scalar.
Declaration
public static byte[] ComputeSecretKey(byte[] privateGen, uint accountNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | privateGen | The 32-byte private generator. |
| uint | accountNumber | The account key index. |
Returns
| Type | Description |
|---|---|
| byte[] |
From128Seed(byte[], int)
Derives key keyIndex of the seed's family; -1 is the root key a validator uses.
Declaration
public static K256KeyPair From128Seed(byte[] seedBytes, int keyIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | seedBytes | The seed bytes, 16 for an XRPL seed. |
| int | keyIndex | The account key index, or -1 for the root key. |
Returns
| Type | Description |
|---|---|
| K256KeyPair |