// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.pqc.crypto.hqc;

import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.KeyGenerationParameters;
import java.security.SecureRandom;
import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;

public class HQCKeyPairGenerator implements AsymmetricCipherKeyPairGenerator
{
    private HQCKeyGenerationParameters hqcKeyGenerationParameters;
    private SecureRandom random;
    
    @Override
    public void init(final KeyGenerationParameters keyGenerationParameters) {
        this.hqcKeyGenerationParameters = (HQCKeyGenerationParameters)keyGenerationParameters;
        this.random = keyGenerationParameters.getRandom();
    }
    
    private AsymmetricCipherKeyPair genKeyPair() {
        final HQCEngine engine = this.hqcKeyGenerationParameters.getParameters().getEngine();
        final byte[] array = new byte[this.hqcKeyGenerationParameters.getParameters().getPublicKeyBytes()];
        final byte[] array2 = new byte[this.hqcKeyGenerationParameters.getParameters().getSecretKeyBytes()];
        engine.genKeyPair(array, array2, this.random);
        return new AsymmetricCipherKeyPair(new HQCPublicKeyParameters(this.hqcKeyGenerationParameters.getParameters(), array), new HQCPrivateKeyParameters(this.hqcKeyGenerationParameters.getParameters(), array2));
    }
    
    @Override
    public AsymmetricCipherKeyPair generateKeyPair() {
        return this.genKeyPair();
    }
}
