package org.bouncycastle.openpgp.api;

import java.util.Date;
import org.bouncycastle.openpgp.PGPException;

/* JADX INFO: loaded from: classes3.dex */
public abstract class OpenPGPApi {
    private final OpenPGPImplementation implementation;
    private final OpenPGPPolicy policy;

    public OpenPGPApi(OpenPGPImplementation openPGPImplementation) {
        this(openPGPImplementation, openPGPImplementation.policy());
    }

    public OpenPGPApi(OpenPGPImplementation openPGPImplementation, OpenPGPPolicy openPGPPolicy) {
        this.implementation = openPGPImplementation;
        this.policy = openPGPPolicy;
    }

    public OpenPGPDetachedSignatureGenerator createDetachedSignature() {
        return new OpenPGPDetachedSignatureGenerator(this.implementation, this.policy);
    }

    public OpenPGPMessageProcessor decryptAndOrVerifyMessage() {
        return new OpenPGPMessageProcessor(this.implementation, this.policy);
    }

    public OpenPGPKeyEditor editKey(OpenPGPKey openPGPKey) throws PGPException {
        return editKey(openPGPKey, (char[]) null);
    }

    public OpenPGPKeyEditor editKey(OpenPGPKey openPGPKey, KeyPassphraseProvider keyPassphraseProvider) throws PGPException {
        return new OpenPGPKeyEditor(openPGPKey, keyPassphraseProvider, this.implementation, this.policy);
    }

    public OpenPGPKeyEditor editKey(OpenPGPKey openPGPKey, final char[] cArr) throws PGPException {
        return new OpenPGPKeyEditor(openPGPKey, new KeyPassphraseProvider(this) { // from class: org.bouncycastle.openpgp.api.OpenPGPApi.1
            final /* synthetic */ OpenPGPApi this$0;

            {
                this.this$0 = this;
            }

            @Override // org.bouncycastle.openpgp.api.KeyPassphraseProvider
            public char[] getKeyPassword(OpenPGPKey.OpenPGPSecretKey openPGPSecretKey) {
                return cArr;
            }
        }, this.implementation, this.policy);
    }

    public OpenPGPKeyGenerator generateKey() throws PGPException {
        return generateKey(6);
    }

    public abstract OpenPGPKeyGenerator generateKey(int i) throws PGPException;

    public abstract OpenPGPKeyGenerator generateKey(int i, Date date) throws PGPException;

    public abstract OpenPGPKeyGenerator generateKey(int i, Date date, boolean z) throws PGPException;

    public OpenPGPKeyGenerator generateKey(Date date) throws PGPException {
        return generateKey(6, date);
    }

    public OpenPGPKeyGenerator generateKey(Date date, boolean z) throws PGPException {
        return generateKey(6, date, z);
    }

    public OpenPGPImplementation getImplementation() {
        return this.implementation;
    }

    public OpenPGPKeyReader readKeyOrCertificate() {
        return new OpenPGPKeyReader(this.implementation, this.policy);
    }

    public OpenPGPMessageGenerator signAndOrEncryptMessage() {
        return new OpenPGPMessageGenerator(this.implementation, this.policy);
    }

    public OpenPGPDetachedSignatureProcessor verifyDetachedSignature() {
        return new OpenPGPDetachedSignatureProcessor(this.implementation, this.policy);
    }
}
