Example usage for org.bouncycastle.asn1.oiw ElGamalParameter getP

List of usage examples for org.bouncycastle.asn1.oiw ElGamalParameter getP

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.oiw ElGamalParameter getP.

Prototype

public BigInteger getP() 

Source Link

Usage

From source file:ElGamalPrivatePGKey.java

License:Open Source License

public ElGamalPrivatePGKey(PrivateKeyInfo info) {
    ElGamalParameter params = new ElGamalParameter((ASN1Sequence) info.getAlgorithmId().getParameters());
    DERInteger derX = (DERInteger) info.getPrivateKey();

    this.x = derX.getValue();
    this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG());
}

From source file:ElGamalPublicPGKey.java

License:Open Source License

public ElGamalPublicPGKey(SubjectPublicKeyInfo info) {
    ElGamalParameter params = new ElGamalParameter((ASN1Sequence) info.getAlgorithmId().getParameters());
    DERInteger derY = null;/*from   w w w  . ja va2  s.  c  om*/

    try {
        derY = (DERInteger) info.getPublicKey();
    } catch (IOException e) {
        throw new IllegalArgumentException("invalid info structure in DSA public key");
    }

    this.y = derY.getValue();
    this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG());
}