Class KeyPair<P extends PublicKey,S extends SecretKey>

java.lang.Object
org.drasyl.identity.KeyPair<P,S>

public abstract class KeyPair<P extends PublicKey,S extends SecretKey> extends Object
This class is a simple holder for a key pair (a IdentityPublicKey and a IdentitySecretKey). It does not enforce any security, and, when initialized, should be treated like a IdentitySecretKey.

This is an immutable object.

  • Constructor Details

    • KeyPair

      public KeyPair()
  • Method Details

    • getPublicKey

      @NonNull public abstract P getPublicKey()
    • getSecretKey

      @NonNull public abstract S getSecretKey()
    • toUnmaskedString

      public String toUnmaskedString()
      Unlike Object.toString(), this method returns the key pair with the unmasked secret key.
      Returns:
      key pair with unmasked secret key
    • of

      public static <P extends PublicKey, S extends SecretKey> KeyPair<P,S> of(P publicKey, S secretKey)
      Throws:
      NullPointerException - if publiceKey or secretKey is null.