package org.bouncycastle.openpgp.operator.bc;

import org.bouncycastle.bcpg.PublicKeyPacket;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptor;
import org.bouncycastle.openpgp.operator.PBESecretKeyEncryptorFactory;

/* JADX INFO: loaded from: classes2.dex */
public class BcCFBSecretKeyEncryptorFactory implements PBESecretKeyEncryptorFactory {
    private final int iterationCount;
    private final int symmetricKeyAlgorithm;

    public BcCFBSecretKeyEncryptorFactory(int i, int i2) {
        this.symmetricKeyAlgorithm = i;
        this.iterationCount = i2;
    }

    @Override // org.bouncycastle.openpgp.operator.PBESecretKeyEncryptorFactory
    public PBESecretKeyEncryptor build(char[] cArr, PublicKeyPacket publicKeyPacket) {
        if (cArr == null) {
            return null;
        }
        try {
            return new BcPBESecretKeyEncryptorBuilder(this.symmetricKeyAlgorithm, new BcPGPDigestCalculatorProvider().get(8), this.iterationCount).build(cArr);
        } catch (PGPException e) {
            throw new RuntimeException(e);
        }
    }
}
