package o; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; /* renamed from: o.igv, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C15797igv implements InterfaceC4280bVg { private static final byte[] c = new byte[0]; private final InterfaceC4280bVg a; private final Jzs e; public C15797igv(Jzs jzs, InterfaceC4280bVg interfaceC4280bVg) { this.e = jzs; this.a = interfaceC4280bVg; } @Override // o.InterfaceC4280bVg public final byte[] b(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { byte[] h = Jtp.d(this.e).h(); byte[] b = this.a.b(h, c); byte[] b2 = ((InterfaceC4280bVg) Jtp.a(this.e.typeUrl_, h, InterfaceC4280bVg.class)).b(bArr, bArr2); return ByteBuffer.allocate(b.length + 4 + b2.length).putInt(b.length).put(b).put(b2).array(); } @Override // o.InterfaceC4280bVg public final byte[] d(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { try { ByteBuffer wrap = ByteBuffer.wrap(bArr); int i = wrap.getInt(); if (i <= 0 || i > bArr.length - 4) { throw new GeneralSecurityException("invalid ciphertext"); } byte[] bArr3 = new byte[i]; wrap.get(bArr3, 0, i); byte[] bArr4 = new byte[wrap.remaining()]; wrap.get(bArr4, 0, wrap.remaining()); return ((InterfaceC4280bVg) Jtp.a(this.e.typeUrl_, this.a.d(bArr3, c), InterfaceC4280bVg.class)).d(bArr4, bArr2); } catch (IndexOutOfBoundsException | NegativeArraySizeException | BufferUnderflowException e) { throw new GeneralSecurityException("invalid ciphertext", e); } } }