package org.bouncycastle.crypto.generators;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class ElGamalKeyPairGenerator implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator {
    private org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters g;

    @Override // org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator
    public org.bouncycastle.crypto.AsymmetricCipherKeyPair a() {
        org.bouncycastle.crypto.generators.DHKeyGeneratorHelper dHKeyGeneratorHelper = org.bouncycastle.crypto.generators.DHKeyGeneratorHelper.a;
        org.bouncycastle.crypto.params.ElGamalParameters elGamalParametersC = this.g.c();
        org.bouncycastle.crypto.params.DHParameters dHParameters = new org.bouncycastle.crypto.params.DHParameters(elGamalParametersC.c(), elGamalParametersC.a(), null, elGamalParametersC.b());
        java.math.BigInteger bigIntegerA = dHKeyGeneratorHelper.a(dHParameters, this.g.a());
        return new org.bouncycastle.crypto.AsymmetricCipherKeyPair(new org.bouncycastle.crypto.params.ElGamalPublicKeyParameters(dHKeyGeneratorHelper.b(dHParameters, bigIntegerA), elGamalParametersC), new org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters(bigIntegerA, elGamalParametersC));
    }

    @Override // org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator
    public void b(org.bouncycastle.crypto.KeyGenerationParameters keyGenerationParameters) {
        org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters elGamalKeyGenerationParameters = (org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters) keyGenerationParameters;
        this.g = elGamalKeyGenerationParameters;
        org.bouncycastle.crypto.CryptoServicesRegistrar.a(new org.bouncycastle.crypto.constraints.DefaultServiceProperties("ElGamalKeyGen", org.bouncycastle.crypto.constraints.ConstraintUtils.a(elGamalKeyGenerationParameters.c().c()), this.g.c(), org.bouncycastle.crypto.CryptoServicePurpose.KEYGEN));
    }
}
