package org.bouncycastle.bcpg;

/* JADX INFO: loaded from: classes3.dex */
public class AEADUtils implements AEADAlgorithmTags {
    private AEADUtils() {
    }

    public static int getAuthTagLength(int i) {
        switch (i) {
            case 1:
            case 2:
            case 3:
                return 16;
            default:
                throw new IllegalArgumentException("Invalid AEAD algorithm tag: " + i);
        }
    }

    public static int getIVLength(int i) {
        switch (i) {
            case 1:
                return 16;
            case 2:
                return 15;
            case 3:
                return 12;
            default:
                throw new IllegalArgumentException("Invalid AEAD algorithm tag: " + i);
        }
    }

    public static byte[][] splitMessageKeyAndIv(byte[] bArr, int i, int i2) {
        int keyLengthInOctets = SymmetricKeyUtils.getKeyLengthInOctets(i);
        int iVLength = getIVLength(i2);
        byte[] bArr2 = new byte[keyLengthInOctets];
        byte[] bArr3 = new byte[iVLength];
        System.arraycopy(bArr, 0, bArr2, 0, keyLengthInOctets);
        System.arraycopy(bArr, keyLengthInOctets, bArr3, 0, iVLength - 8);
        return new byte[][]{bArr2, bArr3};
    }
}
