package org.bouncycastle.crypto.kems;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
class SecretWithEncapsulationImpl implements org.bouncycastle.crypto.SecretWithEncapsulation {
    private final java.util.concurrent.atomic.AtomicBoolean a;
    private final byte[] b;
    private final byte[] c;

    @Override // org.bouncycastle.crypto.SecretWithEncapsulation
    public byte[] a() {
        byte[] bArrJ = org.bouncycastle.util.Arrays.j(this.b);
        c();
        return bArrJ;
    }

    @Override // org.bouncycastle.crypto.SecretWithEncapsulation
    public byte[] b() {
        byte[] bArrJ = org.bouncycastle.util.Arrays.j(this.c);
        c();
        return bArrJ;
    }

    void c() {
        if (isDestroyed()) {
            throw new java.lang.IllegalStateException("data has been destroyed");
        }
    }

    @Override // javax.security.auth.Destroyable
    public void destroy() {
        if (this.a.getAndSet(true)) {
            return;
        }
        org.bouncycastle.util.Arrays.i(this.b);
        org.bouncycastle.util.Arrays.i(this.c);
    }

    @Override // javax.security.auth.Destroyable
    public boolean isDestroyed() {
        return this.a.get();
    }
}
