package org.bouncycastle.bcpg;

import java.io.IOException;

/* JADX INFO: loaded from: classes2.dex */
public class ModDetectionCodePacket extends ContainedPacket {
    private byte[] digest;

    ModDetectionCodePacket(BCPGInputStream bCPGInputStream) throws IOException {
        this(bCPGInputStream, false);
    }

    ModDetectionCodePacket(BCPGInputStream bCPGInputStream, boolean z) throws IOException {
        super(19, z);
        this.digest = new byte[20];
        bCPGInputStream.readFully(this.digest);
    }

    public ModDetectionCodePacket(byte[] bArr) throws IOException {
        super(19);
        this.digest = new byte[bArr.length];
        System.arraycopy(bArr, 0, this.digest, 0, this.digest.length);
    }

    @Override // org.bouncycastle.bcpg.ContainedPacket
    public void encode(BCPGOutputStream bCPGOutputStream) throws IOException {
        bCPGOutputStream.writePacket(hasNewPacketFormat(), 19, this.digest);
    }

    public byte[] getDigest() {
        int length = this.digest.length;
        byte[] bArr = new byte[length];
        System.arraycopy(this.digest, 0, bArr, 0, length);
        return bArr;
    }
}
