Package org.ondc

Class KeyUtil

java.lang.Object
org.ondc.KeyUtil

public class KeyUtil extends Object
Utility Class to Generate Keypairs and Shared Key.
  • Field Details

    • KEYPAIR_GENERATION_ALGORITHM

      public static final String KEYPAIR_GENERATION_ALGORITHM
      The Algorithm used to generate Key pairs. ("X25519").
      See Also:
  • Method Details

    • generateKeyPair

      public static KeyUtil.DHKeyPair generateKeyPair()
      Generate a Keypair.
      Returns:
      Generated Keypair.
    • generateSharedKey

      public static String generateSharedKey(String privateKeyStr, String publicKeyStr)
      Generates a SharedKey.
      Parameters:
      privateKeyStr - Private Key of one party.
      publicKeyStr - Public Key of the other party.
      Returns:
      Shared key as base64 string.