Class DHG


  • public class DHG
    extends AbstractDH
    Diffie-Hellman key generator.
    • Field Detail

      • p

        private java.math.BigInteger p
      • g

        private java.math.BigInteger g
      • f

        private java.math.BigInteger f
    • Constructor Detail

      • DHG

        public DHG​(Factory<? extends Digest> digestFactory)
            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • DHG

        public DHG​(Factory<? extends Digest> digestFactory,
                   java.math.BigInteger pValue,
                   java.math.BigInteger gValue)
            throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • calculateE

        protected byte[] calculateE()
                             throws java.lang.Exception
        Description copied from class: AbstractDH
        Lazy-called by AbstractDH.getE() if the public key data has not been generated yet.
        Specified by:
        calculateE in class AbstractDH
        Returns:
        The calculated public key data
        Throws:
        java.lang.Exception - If failed to generate the relevant data
      • calculateK

        protected byte[] calculateK()
                             throws java.lang.Exception
        Description copied from class: AbstractDH
        Lazy-called by AbstractDH.getK() if the shared secret data has not been calculated yet
        Specified by:
        calculateK in class AbstractDH
        Returns:
        The shared secret data
        Throws:
        java.lang.Exception - If failed to calculate it
      • setP

        public void setP​(byte[] p)
      • setG

        public void setG​(byte[] g)
      • setF

        public void setF​(byte[] f)
        Specified by:
        setF in class AbstractDH
      • getP

        public java.math.BigInteger getP()
      • setP

        public void setP​(java.math.BigInteger p)
      • getG

        public java.math.BigInteger getG()
      • setG

        public void setG​(java.math.BigInteger g)
      • setF

        public void setF​(java.math.BigInteger f)
      • getHash

        public Digest getHash()
                       throws java.lang.Exception
        Specified by:
        getHash in class AbstractDH
        Throws:
        java.lang.Exception