Class KeyPairKey

java.lang.Object
zeroecho.core.alg.common.agreement.KeyPairKey
All Implemented Interfaces:
Serializable, Key

public final class KeyPairKey extends Object implements Key, Serializable
A Key wrapper that carries a KeyPair through APIs that are constrained to Key types.

This type exists to support capabilities that require both private and public components (e.g., message-oriented key agreement contexts), while preserving backward-compatible capabilities that accept only a PrivateKey.

The wrapper does not expose an encoding via getEncoded() because serializing private key material implicitly is dangerous and not required for capability dispatch.

Since:
1.0
See Also:
  • Constructor Details

    • KeyPairKey

      public KeyPairKey(KeyPair keyPair)
      Creates a wrapper around a KeyPair.
      Parameters:
      keyPair - key pair to wrap (must not be null)
      Throws:
      NullPointerException - if keyPair is null
      Since:
      1.0
  • Method Details

    • keyPair

      public KeyPair keyPair()
      Returns the wrapped KeyPair.
      Returns:
      key pair
      Since:
      1.0
    • privateKey

      public PrivateKey privateKey()
      Returns the wrapped private key.
      Returns:
      private key
      Since:
      1.0
    • publicKey

      public PublicKey publicKey()
      Returns the wrapped public key.
      Returns:
      public key
      Since:
      1.0
    • getAlgorithm

      public String getAlgorithm()
      Returns the algorithm name of the wrapped private key.
      Specified by:
      getAlgorithm in interface Key
      Returns:
      algorithm name
      Since:
      1.0
    • getFormat

      public String getFormat()
      Returns null. This wrapper intentionally does not define a standard encoding format.
      Specified by:
      getFormat in interface Key
      Returns:
      null
      Since:
      1.0
    • getEncoded

      public byte[] getEncoded()
      Returns null. This wrapper intentionally does not expose a combined encoding.
      Specified by:
      getEncoded in interface Key
      Returns:
      null
      Since:
      1.0