Class CryptoJDK.PrivateKey

java.lang.Object
com.barbantfintech.tools.common.cryptojdk.CryptoJDK.PrivateKey
Enclosing class:
CryptoJDK

public static class CryptoJDK.PrivateKey extends Object
Manages private key operations, including generation and validation of private keys used in various blockchain networks.
  • Constructor Details

    • PrivateKey

      public PrivateKey()
  • Method Details

    • generate

      public static String generate(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String mnemonic, @NonNull @NonNull Integer derivationIndex) throws CryptoJDKException
      Generates a private key for a given blockchain network and address type.
      Parameters:
      network - The blockchain network for which the private key will be generated.
      addrType - The type of address for which the private key will be generated.
      mnemonic - A mnemonic phrase used to derive the private key.
      derivationIndex - The index used in the key derivation process.
      Returns:
      The private key associated with the specified derivation index on the given network.
      Throws:
      CryptoJDKException - If any of the method parameters are invalid or internal validation of the generated result fails.
    • generate

      public static String generate(@NonNull @NonNull Network network, @NonNull @NonNull AddressType addrType, @NonNull @NonNull String mnemonic, String passphrase, @NonNull @NonNull Integer derivationIndex) throws CryptoJDKException
      Generates a private key for a given blockchain network and address type.
      Parameters:
      network - The blockchain network for which the private key will be generated.
      addrType - The type of address for which the private key will be generated.
      mnemonic - A mnemonic phrase used to derive the private key.
      passphrase - An optional passphrase that was used when the extended public key (xPub) was generated.
      derivationIndex - The index used in the key derivation process.
      Returns:
      The private key associated with the specified derivation index on the given network.
      Throws:
      CryptoJDKException - If any of the method parameters are invalid or internal validation of the generated result fails.
    • validate

      public static boolean validate(@NonNull @NonNull Network network, @NonNull @NonNull String privateKey)
      Validates a given private key against the specified blockchain network.
      Parameters:
      network - The blockchain network against which the private key will be validated.
      privateKey - The private key to be validated.
      Returns:
      True if the private key is valid for the given network, otherwise false.