Code example for DHPublicKey

Methods: getParams

0
        { 
            throw new InvalidKeyException("DHKeyAgreement doPhase requires DHPublicKey");
        } 
        DHPublicKey pubKey = (DHPublicKey)key;
 
        if (!pubKey.getParams().getG().equals(g) || !pubKey.getParams().getP().equals(p))
        { 
            throw new InvalidKeyException("DHPublicKey not for this KeyAgreement!");
        } 
 
        if (lastPhase)
        { 
            result = ((DHPublicKey)key).getY().modPow(x, p);
            return null; 
        } 
        else 
        { 
            result = ((DHPublicKey)key).getY().modPow(x, p);
        } 
 
        return new JCEDHPublicKey(result, pubKey.getParams());
    } 
 
    protected byte[] engineGenerateSecret()  
        throws IllegalStateException 
    {