Code example for DHParameterSpec

0
 
    JCEDHPrivateKey( 
        DHPrivateKeySpec    spec)
    { 
        this.x = spec.getX();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    } 
 
    JCEDHPrivateKey( 
        PrivateKeyInfo  info)
    { 
        DHParameter     params = new DHParameter((ASN1Sequence)info.getAlgorithmId().getParameters());
        DERInteger      derX = (DERInteger)info.getPrivateKey();
 
        this.x = derX.getValue();
        if (params.getL() != null)
        { 
            this.dhSpec = new DHParameterSpec(params.getP(), params.getG(), params.getL().intValue());
        } 
        else 
        {