net.i2p.crypto.elgamal.impl

## Class ElGamalPrivateKeyImpl

- java.lang.Object
- - net.i2p.crypto.elgamal.impl.ElGamalPrivateKeyImpl

- All Implemented Interfaces:
    Serializable, Key, PrivateKey, DHKey, DHPrivateKey, Destroyable, ElGamalKey, ElGamalPrivateKey

      public class ElGamalPrivateKeyImpl
      extends Object
      implements ElGamalPrivateKey, DHPrivateKey

  Implementation of ElGamal private keys. This class provides a concrete implementation of the ElGamalPrivateKey interface, representing the private component of an ElGamal key pair. It stores the secret exponent x and the ElGamal parameters (prime p and generator g), and supports PKCS#8 encoding for standardized key storage and transmission.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ElGamalPrivateKeyImpl()`
    `` | `ElGamalPrivateKeyImpl(BigInteger x, ElGamalParameterSpec elSpec)`
    `` | `ElGamalPrivateKeyImpl(DHPrivateKey key)`
    `` | `ElGamalPrivateKeyImpl(DHPrivateKeySpec spec)`
    `` | `ElGamalPrivateKeyImpl(ElGamalPrivateKey key)`
    `` | `ElGamalPrivateKeyImpl(ElGamalPrivateKeySpec spec)`
    `` | `ElGamalPrivateKeyImpl(PKCS8EncodedKeySpec spec)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithm()`
    `byte[]` | `getEncoded()` Return a PKCS8 representation of the key.
    `String` | `getFormat()` return the encoding format we produce in getEncoded().
    `ElGamalParameterSpec` | `getParameters()`
    `DHParameterSpec` | `getParams()`
    `BigInteger` | `getX()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.security.auth.Destroyable

      `destroy, isDestroyed`

- - ### Constructor Detail

    - #### ElGamalPrivateKeyImpl

          protected ElGamalPrivateKeyImpl()

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(BigInteger x,
                                       ElGamalParameterSpec elSpec)

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(DHPrivateKey key)

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(DHPrivateKeySpec spec)

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(ElGamalPrivateKey key)

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(ElGamalPrivateKeySpec spec)

    - #### ElGamalPrivateKeyImpl

          public ElGamalPrivateKeyImpl(PKCS8EncodedKeySpec spec)
                                throws InvalidKeySpecException

      Throws:
        `InvalidKeySpecException`

  - ### Method Detail

    - #### getAlgorithm

          public String getAlgorithm()

      Specified by:
        `getAlgorithm` in interface `Key`

    - #### getEncoded

          public byte[] getEncoded()

      Return a PKCS8 representation of the key. The sequence returned represents a full PrivateKeyInfo object.
      Specified by:
        `getEncoded` in interface `Key`
      Returns:
        a PKCS8 representation of the key.

    - #### getFormat

          public String getFormat()

      return the encoding format we produce in getEncoded().
      Specified by:
        `getFormat` in interface `Key`
      Returns:
        the string "PKCS#8"

    - #### getParameters

          public ElGamalParameterSpec getParameters()

      Specified by:
        `getParameters` in interface `ElGamalKey`

    - #### getParams

          public DHParameterSpec getParams()

      Specified by:
        `getParams` in interface `DHKey`

    - #### getX

          public BigInteger getX()

      Specified by:
        `getX` in interface `DHPrivateKey`
      Specified by:
        `getX` in interface `ElGamalPrivateKey`